add backup label

This commit is contained in:
Moritz 2024-04-29 14:54:02 +02:00
parent 46bb242fe7
commit 3915bf7493
3 changed files with 11 additions and 0 deletions

View File

@ -9,6 +9,11 @@ services:
- GITEA_DB_USER=gitea
db:
image: "mariadb:10.11.2"
deploy:
labels:
backupbot.backup.pre-hook: 'mysqldump --single-transaction -u root -p"$$(cat /run/secrets/db_root_password)" gitea > /var/lib/mysql/backup.sql'
backupbot.backup.post-hook: "rm -rf /var/lib/mysql/backup.sql"
backupbot.backup.path: "/var/lib/mysql/backup.sql"
command: |
mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
environment:

View File

@ -9,6 +9,11 @@ services:
- GITEA_DB_USER=gitea
db:
image: postgres:15.3
deploy:
labels:
backupbot.backup.pre-hook: "PGPASSWORD=$$(cat $${POSTGRES_PASSWORD_FILE}) pg_dump -U $${POSTGRES_USER} $${POSTGRES_DB} > /var/lib/postgresql/data/backup.sql"
backupbot.backup.post-hook: "rm -r /var/lib/postgresql/data/backup.sql"
backupbot.backup.path: "/var/lib/postgresql/data"
environment:
- POSTGRES_DB=gitea
- POSTGRES_USER=gitea

View File

@ -48,6 +48,7 @@ services:
failure_action: rollback
order: start-first
labels:
- "backupbot.backup=true"
- "traefik.enable=true"
- "traefik.http.routers.${STACK_NAME}.rule=Host(`${DOMAIN}`)"
- "traefik.http.routers.${STACK_NAME}.entrypoints=web-secure"