Wire CI/CD (Gitea Actions typecheck) and daily Postgres backup
CI / typecheck (push) Failing after 1m57s
CI / typecheck (push) Failing after 1m57s
- .gitea/workflows/ci.yml runs pnpm typecheck on the already-registered forge-runner on push/PR to main - scripts/backup-db.sh + a systemd user timer (stock-app-backup.timer, daily) pg_dump the stocklist Postgres container to ~/backups, pruned to 14 days
This commit is contained in:
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
# Daily pg_dump of the stocklist Postgres container, run by the
|
||||
# stock-app-backup systemd timer. Keeps the last 14 days of backups.
|
||||
set -euo pipefail
|
||||
|
||||
BACKUP_DIR="$HOME/backups/stocklist-postgres"
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
TIMESTAMP=$(date +%Y%m%d-%H%M%S)
|
||||
OUT_FILE="$BACKUP_DIR/stocklist-$TIMESTAMP.sql.gz"
|
||||
|
||||
docker exec stocklist-postgres pg_dump -U stocklist stocklist | gzip > "$OUT_FILE"
|
||||
|
||||
find "$BACKUP_DIR" -name '*.sql.gz' -mtime +14 -delete
|
||||
|
||||
echo "Backed up stocklist database to $OUT_FILE"
|
||||
Reference in New Issue
Block a user