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:
@@ -31,11 +31,17 @@ services:
|
||||
litestream restore -config /etc/litestream.yml /app/data/app.db \
|
||||
|| echo "==> No backup found, starting fresh"
|
||||
fi
|
||||
if [ ! -f /data/landing/.state.sqlite ]; then
|
||||
echo "==> No state DB found, restoring from R2..."
|
||||
litestream restore -config /etc/litestream.yml /data/landing/.state.sqlite \
|
||||
|| echo "==> No state backup found, starting fresh"
|
||||
fi
|
||||
exec litestream replicate -config /etc/litestream.yml
|
||||
env_file: ./.env
|
||||
volumes:
|
||||
- app-data:/app/data
|
||||
- ./litestream.yml:/etc/litestream.yml:ro
|
||||
- /data/padelnomics/landing:/data/landing
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "kill -0 1"]
|
||||
interval: 5s
|
||||
|
||||
Reference in New Issue
Block a user