HA stage 0: health reads workers registry, daily pg_dump timer, backup freshness in monitor (#48)

Co-authored-by: host <host@test.local>
This commit is contained in:
openqjandhost authored and GitHub committed 2026-10-26 23:51:54 +08:00
1 parent 275de39148
commit 455513dd33
6 files changed
+150 -10

No files matched your search

+17
View File
@@ -0,0 +1,17 @@
#!/bin/sh
# 每日 Postgres 备份(由 codex-pg-backup.service 调,timer 每天触发)。
#
# 连接参数只走 CLOUD_DB_* 环境变量(service 的 EnvironmentFile 指向
# /etc/codex-app-server/env,0600 root);密码绝不出现在命令行与日志里。
# 备份目录默认 /var/lib/codex-app-server/backups,轮转只留最近 7 份
# (每天一次 = 一周);备份文件含生产库全量(含 GitHub App 配置),
# 目录 700、service 的 UMask=0077 保证文件 600,绝不要放宽。
set -eu
APP_DIR=${APP_DIR:-/opt/codex-app-server}
BACKUP_DIR=${BACKUP_DIR:-/var/lib/codex-app-server/backups}
mkdir -p "$BACKUP_DIR"
chmod 700 "$BACKUP_DIR"
cd "$APP_DIR"
python3 -m cloud.backup --backend postgres --out "$BACKUP_DIR" --keep 7