chore: add CMS backup script and status
This commit is contained in:
parent
76f826c2a9
commit
88c081fe23
@ -22,6 +22,7 @@
|
||||
- 因管理入口未通过,尚未建立 CMS 管理员、创建 Product、上传 Media 或执行发布/下架验收。
|
||||
- 草稿不可读、发布可读、下架失效的完整端到端矩阵待 Admin 路由修复后执行。
|
||||
- 当前没有把 CMS 生成的运行时迁移文件提交进仓库,测试数据库迁移已执行但交付还需固化迁移产物。
|
||||
- 当前 `kaotings_cms` 已生成受控 custom-format 备份,备份脚本为 `infra/scripts/backup-cms-db.sh`;现有数据库未清空。
|
||||
|
||||
## 3. 范围边界
|
||||
|
||||
|
||||
17
infra/scripts/backup-cms-db.sh
Normal file
17
infra/scripts/backup-cms-db.sh
Normal file
@ -0,0 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
if [[ "$(id -u)" -ne 0 ]]; then
|
||||
echo "run as root" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
set -a
|
||||
. /etc/kaotings/cms.env
|
||||
set +a
|
||||
stamp="$(date -u +%Y%m%dT%H%M%SZ)"
|
||||
install -d -m 700 /home/flym/backups
|
||||
output="/home/flym/backups/kaotings_cms_${stamp}.dump"
|
||||
pg_dump --format=custom --file="$output" "$DATABASE_URI"
|
||||
chmod 600 "$output"
|
||||
stat -c "%s %n" "$output"
|
||||
Loading…
Reference in New Issue
Block a user