42 lines
1.2 KiB
YAML
42 lines
1.2 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
app:
|
|
environment:
|
|
- GITEA_DB_TYPE=mysql
|
|
- GITEA_DB_HOST="db:3306"
|
|
- GITEA_DB_NAME=gitea
|
|
- 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.volumes.mariadb.path: "backup.sql"
|
|
backupbot.restore.post-hook: "mariadb -u root -p\"$$(cat /run/secrets/db_root_password)\" gitea < /var/lib/mysql/backup.sql"
|
|
command: |
|
|
mysqld --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
|
environment:
|
|
- MYSQL_DATABASE=gitea
|
|
- MYSQL_USER=gitea
|
|
- MYSQL_PASSWORD_FILE=/run/secrets/db_password
|
|
- MYSQL_ROOT_PASSWORD_FILE=/run/secrets/db_root_password
|
|
secrets:
|
|
- db_password
|
|
- db_root_password
|
|
volumes:
|
|
- "mariadb:/var/lib/mysql"
|
|
networks:
|
|
- internal
|
|
|
|
secrets:
|
|
db_password:
|
|
name: ${STACK_NAME}_db_password_${SECRET_DB_PASSWORD_VERSION}
|
|
external: true
|
|
db_root_password:
|
|
name: ${STACK_NAME}_db_root_password_${SECRET_DB_ROOT_PASSWORD_VERSION}
|
|
external: true
|
|
|
|
volumes:
|
|
mariadb:
|