feat : initial PostgreSQL infrastructure setup
- docker-compose with postgres:16-alpine - Init script to create databases (SIRH + Ferme, prod + recette) - Deploy script with readiness check - Backup script with rotation (keeps last 7) - Auto-tag CI workflow - Full deployment documentation
This commit is contained in:
18
backup.sh
Executable file
18
backup.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
BACKUP_DIR="./backups"
|
||||
DATE=$(date +%Y-%m-%d_%H%M%S)
|
||||
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
echo "==> Dumping all databases..."
|
||||
docker compose exec -T postgres pg_dumpall -U admin > "${BACKUP_DIR}/all-databases-${DATE}.sql"
|
||||
|
||||
echo "==> Backup saved to ${BACKUP_DIR}/all-databases-${DATE}.sql"
|
||||
|
||||
# Garder les 7 derniers backups
|
||||
ls -t "${BACKUP_DIR}"/all-databases-*.sql | tail -n +8 | xargs -r rm --
|
||||
echo "==> Old backups cleaned (keeping last 7)."
|
||||
Reference in New Issue
Block a user