first commit

This commit is contained in:
Tour
2025-12-09 11:12:08 +01:00
commit c2dadf6148
7 changed files with 382 additions and 0 deletions

14
backup/backup.sh Normal file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
DATE=$(date +"%Y-%m-%d_%H-%M")
FILENAME="backup_$DATE.sql"
echo "Dumping database to $FILENAME"
/usr/bin/pg_dump \
-h postgres-db \
-U auction \
auctiondb \
> /backup/$FILENAME
# optional: keep only 14 days
find /backup -type f -mtime +14 -delete

19
backup/docker-compose.yml Normal file
View File

@@ -0,0 +1,19 @@
version: "3.9"
services:
pgbackup:
image: postgres:16
container_name: postgres-backup
restart: unless-stopped
environment:
PGPASSWORD: ${POSTGRES_PASSWORD}
volumes:
- ../postgres/backup:/backup
- ./backup.sh:/backup.sh
entrypoint: [ "bash", "-c", "echo 'Starting backup scheduler'; while true; do /backup.sh; sleep 86400; done" ]
networks:
- default