Permalink
Branch: master
Find file Copy path
7d1e3c3 Feb 4, 2019
1 contributor

Users who have contributed to this file

90 lines (76 sloc) 1.84 KB
version: '3.7'
x-default-opts:
&default-opts
logging:
options:
max-size: "1m"
# driver: "gelf"
# options:
# gelf-address: "udp://127.0.0.1:5000"
services:
ghost:
<<: *default-opts
image: ghost:alpine
networks:
- proxy
- ghost
environment:
# see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
database__client: mysql
database__connection__host: db
database__connection__user: root
database__connection__password: YOURDBPASSWORDhere
database__connection__database: ghost
url: http://ghost.dogvs.cat
deploy:
replicas: 1
labels:
- traefik.port=2368
- traefik.frontend.rule=Host:ghost.dogvs.cat
db:
<<: *default-opts
image: mysql:5.7
volumes:
- db:/var/lib/mysql
secrets:
- db-password
networks:
- ghost
deploy:
endpoint_mode: dnsrr
environment:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
# NOTE: table locking is a concern. Maybe use --single-transaction=TRUE for innoDB
db-backup:
<<: *default-opts
image: mysql:5.7
command: sh -c "while true; do /usr/bin/mysqldump -u root --password=$$(< $$MYSQL_ROOT_PASSWORD_FILE) --all-databases --host=db > /backup/backup$$(date +'%H').sql ; sleep 3600; done"
volumes:
- db-backup:/backup
secrets:
- db-password
networks:
- ghost
environment:
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
deploy:
restart_policy:
delay: 600s
#TODO: backup for static content
networks:
ghost: {}
proxy:
external: true
volumes:
db:
driver: rexray/dobs
driver_opts:
size: 1
db-backup:
driver: rexray/dobs
driver_opts:
size: 1
secrets:
db-password:
file: ./secret-ghost-db
name: db-password