docker-solutions/mariadb.yml

54 lines
1.2 KiB
YAML
Raw Normal View History

---
version: "3"
volumes:
db:
dbbackup:
services:
db:
image: mariadb:latest
restart: unless-stopped
command: --transaction-isolation=READ-COMMITTED --binlog-format=ROW
volumes:
- db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${PW_MYSQLROOT}
- MYSQL_PASSWORD=${PW_MYSQL}
- MYSQL_DATABASE=${DB_DATABASE}
- MYSQL_USER=${DB_USER}
- MARIADB_AUTO_UPGRADE=1
- MARIADB_DISABLE_UPGRADE_BACKUP=1
healthcheck:
test: ['CMD', 'mariadb-admin', 'ping', '-h', 'localhost']
timeout: 10s
retries: 5
labels:
diun.enable: true
db-backup:
image: fradelg/mysql-cron-backup:latest
depends_on:
- db
links:
- db
volumes:
- dbbackup:/backup
environment:
- TZ=Europe/Berlin
- MYSQL_HOST=db
- MYSQL_USER=root
- MYSQL_PASS=${PW_MYSQLROOT}
- MYSQLDUMP_OPTS=--force --single-transaction --quick --compact --extended-insert --order-by-primary
- MAX_BACKUPS=4
- INIT_BACKUP=1
# Every day at 00:30
- CRON_TIME=30 0 * * *
# Make it small
- GZIP_LEVEL=9
restart: unless-stopped
labels:
diun.enable: true
...