Add initial infrastructure and backup scripts for Gitea and homelab deployment
- Create README.md with project layout and quick start instructions - Implement backup scripts for Gitea, including database and repository exports - Add systemd service and timer for automated Gitea backups - Develop bootstrap scripts for homelab and VPS setup - Document architecture and restore procedures - Configure Caddy reverse proxy and Docker Compose for service management - Establish secrets management guidelines
This commit is contained in:
20
backups/scripts/pg-dump.sh
Normal file
20
backups/scripts/pg-dump.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
TS="$(date +%F_%H%M%S)"
|
||||
OUT="/srv/backups/gitea/pg"
|
||||
mkdir -p "$OUT"
|
||||
|
||||
PGUSER="${PGUSER:-gitea}"
|
||||
PGDATABASE="${PGDATABASE:-gitea}"
|
||||
PGPASSFILE="${PGPASSFILE:-/srv/secrets/postgres_password}"
|
||||
|
||||
if [[ ! -f "$PGPASSFILE" ]]; then
|
||||
echo "Missing $PGPASSFILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
export PGPASSWORD="$(cat "$PGPASSFILE")"
|
||||
docker exec -e PGPASSWORD="$PGPASSWORD" gitea-db sh -lc "pg_dump -U '$PGUSER' -d '$PGDATABASE'" > "$OUT/gitea-pg-$TS.sql"
|
||||
|
||||
echo "Wrote: $OUT/gitea-pg-$TS.sql"
|
||||
Reference in New Issue
Block a user