- deploy/backup-production-config.sh: env files, .monitor.env, state records, compose/Caddyfile, Caddy data+config volumes and host units bundled, encrypted to the owner's OpenPGP public key only, kept locally (14) and uploaded to OSS production/config/ with the existing write-only key; --dry-run lists only. - systemd unit + timer (05:05 Asia/Shanghai) and a root installer. - sync-production-tree.sh no longer deletes /.monitor.env on every deploy. - Restore drill on 83.229.126.99 (isolated temp Postgres, ~12 s, counts match), config restore doc, capacity note (#355). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DbBXoyn7Hj3LCW3BUs5bZ8
29 lines
866 B
Bash
Executable File
29 lines
866 B
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
if [ "$#" -ne 2 ] || [ ! -d "$1" ] || [ ! -d "$2" ]; then
|
|
echo "usage: sync-production-tree.sh SOURCE_DIRECTORY DESTINATION_DIRECTORY" >&2
|
|
exit 1
|
|
fi
|
|
|
|
destination_deploy="$2/deploy"
|
|
if [ -d "$destination_deploy" ]; then
|
|
docker run --rm --pull never --network none --read-only --user 0:0 \
|
|
--cap-drop ALL --cap-add CHOWN --security-opt no-new-privileges \
|
|
-v "$destination_deploy:/destination" postgres:17-alpine \
|
|
chown -R "$(id -u):$(id -g)" /destination
|
|
chmod -R u+rwX "$destination_deploy"
|
|
fi
|
|
|
|
rsync -az --delete --no-owner --no-group \
|
|
--exclude='/.git/' \
|
|
--exclude='/.env*' \
|
|
--exclude='/.monitor.env' \
|
|
--exclude='/.docker/' \
|
|
--exclude='/backups/' \
|
|
--exclude='/.state/' \
|
|
--exclude='/.incoming/' \
|
|
--exclude='/frontend/node_modules/' \
|
|
--exclude='/frontend/.next/' \
|
|
"$1/" "$2/"
|