forked from PeerConradi/munity
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml
104 lines (97 loc) · 2.98 KB
/
docker-compose.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
version: '3.1'
services:
mariadb:
image: mariadb
restart: unless-stopped
volumes:
- /var/volumes/munity/db:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=${MUNITY_DB_PASS}
networks:
- munity
mail:
image: bytemark/smtp
restart: always
environment:
RELAY_HOST: smtp.mun-tools.com
RELAY_PORT: 587
RELAY_USERNAME: [email protected]
RELAY_PASSWORD: ${SMTP_PASS}
networks:
- traefik
munity-server:
# image: munity-backend
restart: unless-stopped
build:
context: .
volumes:
- /etc/localtime:/etc/localtime:ro
environment:
- MYSQL_SERVER=mariadb
- MYSQL_USER=root
- MYSQL_PASS=${MUNITY_DB_PASS}
- MYSQL_PORT=3306
- MYSQL_DATABASE=munitybase
labels:
- "traefik.enable=true"
- "traefik.docker.network=traefik"
- "traefik.http.routers.munity.rule=Host(`mun-tools.com`,`www.mun-tools.com`)"
- "traefik.http.routers.munity.entrypoints=websecure"
- "traefik.http.routers.munity.tls.certresolver=myresolver"
networks:
- traefik
- munity
traefik:
image: "traefik:v2.4@sha256:08d8a7759f5fffa2441488151cedcd4d556c1f124c097f929f469c1f7b82c16f"
command:
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.web.http.redirections.entrypoint.to=websecure"
- "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--certificatesresolvers.myresolver.acme.httpchallenge=true"
- "--certificatesresolvers.myresolver.acme.httpchallenge.entrypoint=web"
- "--certificatesresolvers.myresolver.acme.email=peerconradi@gmail.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
- "--api.insecure=true"
ports:
- "80:80"
- "443:443"
- "8080:8080"
networks:
- traefik
volumes:
- "/var/volumes/letsencrypt:/letsencrypt"
- "/var/run/docker.sock:/var/run/docker.sock:ro"
restart: unless-stopped
db-backup:
image: mariadb:10@sha256:36288c675a192bd0a8a99cd6ba0780e31df85f0bfd0cbb204837cd108be3d236
volumes:
- /var/volumes/munity/database-dump:/dump
- /etc/localtime:/etc/localtime:ro
environment:
- MYSQL_PWD=${MUNITY_DB_PASS}
- MYSQL_USER=root
- BACKUP_NUM_KEEP=7
- BACKUP_FREQUENCY=1d
entrypoint: |
bash -c 'bash -s <<EOF
trap "break;exit" SIGHUP SIGINT SIGTERM
sleep 2m
while /bin/true; do
mysqldump -h mariadb --all-databases | gzip -c > /dump/dump_\`date +%d-%m-%Y"_"%H_%M_%S\`.sql.gz
(ls -t /dump/dump*.sql.gz|head -n $$BACKUP_NUM_KEEP;ls /dump/dump*.sql.gz)|sort|uniq -u|xargs rm -- {}
sleep $$BACKUP_FREQUENCY
done
EOF'
networks:
- munity
depends_on:
- mariadb
restart: unless-stopped
networks:
traefik:
external: true
munity:
internal: true