use anchor for db service
This commit is contained in:
parent
637bf7c768
commit
0e9553be66
29
compose.yml
29
compose.yml
|
@ -65,7 +65,7 @@ services:
|
|||
retries: 10
|
||||
start_period: 10s
|
||||
|
||||
db:
|
||||
db: &db
|
||||
image: "mariadb:10.8"
|
||||
volumes:
|
||||
- "mariadb:/var/lib/mysql"
|
||||
|
@ -89,40 +89,19 @@ services:
|
|||
labels:
|
||||
backupbot.backup: "true"
|
||||
backupbot.backup.path: "/tmp/dump.sql"
|
||||
backupbot.backup.pre-hook: "sh -c 'mysqldump --single-transaction -u root -p\"$$(cat /run/secrets/db_root_password)\" wordpress > /tmp/dump.sql'"
|
||||
backupbot.backup.pre-hook: "sh -c 'mysqldump --single-transaction -u root -p\"$$(cat /run/secrets/db_root_password)\" $${MYSQL_DATABASE} > /tmp/dump.sql'"
|
||||
backupbot.backup.post-hook: "rm -f /tmp/dump.sql"
|
||||
backupbot.restore: "true"
|
||||
backupbot.restore.post-hook: "sh -c 'mysql -u root -p\"$$(cat /run/secrets/db_root_password)\" wordpress < /tmp/dump.sql && rm -f /tmp/dump.sql'"
|
||||
backupbot.restore.post-hook: "sh -c 'mysql -u root -p\"$$(cat /run/secrets/db_root_password)\" $${MYSQL_DATABASE} < /tmp/dump.sql && rm -f /tmp/dump.sql'"
|
||||
|
||||
|
||||
civicrm-db:
|
||||
image: "mariadb:10.8"
|
||||
<<: *db
|
||||
volumes:
|
||||
- "civicrm-db:/var/lib/mysql"
|
||||
environment:
|
||||
- MYSQL_DATABASE=civicrm
|
||||
- MYSQL_USER=civicrm
|
||||
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
||||
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
|
||||
secrets:
|
||||
- db_password
|
||||
- db_root_password
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", 'mysqladmin -p"$$(cat /run/secrets/db_root_password)" ping']
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 1m
|
||||
deploy:
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
labels:
|
||||
backupbot.backup: "true"
|
||||
backupbot.backup.path: "/tmp/dump.sql"
|
||||
backupbot.backup.pre-hook: "sh -c 'mysqldump --single-transaction -u root -p\"$$(cat /run/secrets/db_root_password)\" civicrm > /tmp/dump.sql'"
|
||||
backupbot.backup.post-hook: "rm -f /tmp/dump.sql"
|
||||
backupbot.restore: "true"
|
||||
backupbot.restore.post-hook: "sh -c 'mysql -u root -p\"$$(cat /run/secrets/db_root_password)\" civicrm < /tmp/dump.sql && rm -f /tmp/dump.sql'"
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
|
|
Loading…
Reference in New Issue