feat: landing zone backup to R2 via rclone + Litestream
Landing files (append-only JSON.gz) synced to R2 every 30 min via systemd timer + rclone. Extraction state DB (.state.sqlite) continuously replicated via Litestream (second DB entry). Auto-restore on container startup for both app.db and .state.sqlite. Reuses existing R2 bucket and credentials — no new env vars needed. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -38,6 +38,32 @@ else
|
||||
echo "Deploy key already exists, skipping"
|
||||
fi
|
||||
|
||||
# Install rclone (landing zone backup to R2)
|
||||
if ! command -v rclone &>/dev/null; then
|
||||
echo "Installing rclone..."
|
||||
curl -fsSL https://rclone.org/install.sh | bash
|
||||
echo "Installed rclone $(rclone version --check | head -1)"
|
||||
else
|
||||
echo "rclone already installed, skipping"
|
||||
fi
|
||||
|
||||
# Create landing data directory
|
||||
mkdir -p /data/padelnomics/landing
|
||||
echo "Created /data/padelnomics/landing"
|
||||
|
||||
# Install and enable landing backup timer
|
||||
cp "$APP_DIR/infra/landing-backup/padelnomics-landing-backup.service" /etc/systemd/system/
|
||||
cp "$APP_DIR/infra/landing-backup/padelnomics-landing-backup.timer" /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now padelnomics-landing-backup.timer
|
||||
echo "Enabled landing backup timer (every 30 min)"
|
||||
|
||||
# Install and enable supervisor service
|
||||
cp "$APP_DIR/infra/supervisor/padelnomics-supervisor.service" /etc/systemd/system/
|
||||
systemctl daemon-reload
|
||||
systemctl enable --now padelnomics-supervisor.service
|
||||
echo "Enabled supervisor service"
|
||||
|
||||
echo ""
|
||||
echo "=== Next steps ==="
|
||||
echo "1. Add this deploy key to GitLab (Settings → Repository → Deploy Keys, read-only):"
|
||||
|
||||
Reference in New Issue
Block a user