-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
202 lines (181 loc) · 4.95 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
version: '3.7'
services:
mongo:
image: mongo:4.2.3
volumes:
- $PWD/data/mongo:/data/db
environment:
MONGO_INITDB_ROOT_USERNAME: user
MONGO_INITDB_ROOT_PASSWORD: pass
labels:
traefik.enable: 'false'
backup-mongo:
build:
context: .
dockerfile: Dockerfile
volumes:
- $PWD/data/backups/mongo:/data
depends_on:
- mongo
- mail
- s3
secrets:
- BACKUP_PASS
- BACKUP_S3_ACCESS_KEY
- BACKUP_S3_SECRET_KEY
environment:
BACKUP_DRIVER: mongo
BACKUP_CRON_TIME: "* * * * *"
BACKUP_RUN_ON_START: 'true'
BACKUP_RUN_ON_START_DELAY: 10
BACKUP_DB: test
BACKUP_HOST: mongo
BACKUP_PORT: 27017
BACKUP_USER: user
BACKUP_PASS_FILE: /run/secrets/BACKUP_PASS
BACKUP_EXTRA_OPTS: '--authenticationDatabase=admin'
BACKUP_S3_ACCESS_KEY_FILE: /run/secrets/BACKUP_S3_ACCESS_KEY
BACKUP_S3_SECRET_KEY_FILE: /run/secrets/BACKUP_S3_SECRET_KEY
BACKUP_S3_HOST_BASE: s3:9000
BACKUP_S3_HOST_BUCKET: s3:9000
BACKUP_S3_PATH: s3://backup/mongo/
BACKUP_S3_USE_HTTPS: 'False'
BACKUP_S3_OPS: --delete-removed
BACKUP_ALERT: mail
BACKUP_ALERT_NAME: Backup Mongo
BACKUP_ALERT_IF_THE_SIZE_OF_LAST_BACKUP_GREATER_THAN: 10
BACKUP_ALERT_IF_THE_BACKUP_SIZE_IS_SMALLER_THAN: 100
BACKUP_MAIL_HOST: mail
BACKUP_MAIL_FROM: [email protected]
BACKUP_MAIL_TO: [email protected]
BACKUP_ROTATE_MINUTELY: 2
BACKUP_ROTATE_HOURLY: 5
BACKUP_ROTATE_DAILY: 4
BACKUP_ROTATE_WEEKLY: 2
BACKUP_ROTATE_MONTHLY: 12
BACKUP_ROTATE_YEARLY: 2
redis:
image: redis:5.0.7-alpine
command: --requirepass pass
volumes:
- $PWD/data/redis:/data
backup-redis:
build:
context: .
dockerfile: Dockerfile
volumes:
- $PWD/data/backups/redis:/data
depends_on:
- redis
- mail
- s3
environment:
BACKUP_DRIVER: redis
BACKUP_CRON_TIME: "* * * * *"
BACKUP_RUN_ON_START: 'true'
BACKUP_RUN_ON_START_DELAY: 10
BACKUP_HOST: redis
BACKUP_PASS: pass
BACKUP_PORT: 6379
BACKUP_S3_ACCESS_KEY: s3_key
BACKUP_S3_SECRET_KEY: s3_secret
BACKUP_S3_HOST_BASE: s3:9000
BACKUP_S3_HOST_BUCKET: s3:9000
BACKUP_S3_PATH: s3://backup/redis/
BACKUP_S3_USE_HTTPS: 'False'
BACKUP_S3_OPS: --delete-removed
BACKUP_ALERT: mail
BACKUP_ALERT_NAME: Backup Redis
BACKUP_ALERT_IF_THE_SIZE_OF_LAST_BACKUP_GREATER_THAN: 10
BACKUP_ALERT_IF_THE_BACKUP_SIZE_IS_SMALLER_THAN: 100
BACKUP_MAIL_HOST: mail
BACKUP_MAIL_FROM: [email protected]
BACKUP_MAIL_TO: [email protected]
BACKUP_ROTATE_MINUTELY: 2
BACKUP_ROTATE_HOURLY: 5
BACKUP_ROTATE_DAILY: 4
BACKUP_ROTATE_WEEKLY: 2
BACKUP_ROTATE_MONTHLY: 12
BACKUP_ROTATE_YEARLY: 2
mysql:
image: mariadb:10
volumes:
- $PWD/data/mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: test
MYSQL_USER: user
MYSQL_PASSWORD: pass
backup-mysql:
build:
context: .
dockerfile: Dockerfile
volumes:
- $PWD/data/backups/mysql:/data
depends_on:
- mysql
- mail
- s3
environment:
BACKUP_DRIVER: mysql
BACKUP_CRON_TIME: "* * * * *"
BACKUP_RUN_ON_START: 'true'
BACKUP_RUN_ON_START_DELAY: 10
BACKUP_DB: test
BACKUP_HOST: mysql
BACKUP_PORT: 3306
BACKUP_USER: user
BACKUP_PASS: pass
BACKUP_S3_ACCESS_KEY: s3_key
BACKUP_S3_SECRET_KEY: s3_secret
BACKUP_S3_HOST_BASE: s3:9000
BACKUP_S3_HOST_BUCKET: s3:9000
BACKUP_S3_PATH: s3://backup/mysql/
BACKUP_S3_USE_HTTPS: 'False'
BACKUP_S3_OPS: --delete-removed
BACKUP_ALERT: mail
BACKUP_ALERT_NAME: Backup Mysql
BACKUP_ALERT_IF_THE_SIZE_OF_LAST_BACKUP_GREATER_THAN: 10
BACKUP_ALERT_IF_THE_BACKUP_SIZE_IS_SMALLER_THAN: 100
BACKUP_MAIL_HOST: mail
BACKUP_MAIL_FROM: [email protected]
BACKUP_MAIL_TO: [email protected]
BACKUP_ROTATE_MINUTELY: 2
BACKUP_ROTATE_HOURLY: 5
BACKUP_ROTATE_DAILY: 4
BACKUP_ROTATE_WEEKLY: 2
BACKUP_ROTATE_MONTHLY: 12
BACKUP_ROTATE_YEARLY: 2
mail:
image: djfarrelly/maildev
ports:
- 8042:80
s3:
image: minio/minio
command: ['server', '/data']
environment:
MINIO_ACCESS_KEY: s3_key
MINIO_SECRET_KEY: s3_secret
volumes:
- "./data/s3:/data"
ports:
- 9000:9000
s3createbuckets:
image: minio/mc
depends_on:
- s3
entrypoint: >
/bin/sh -c "
sleep 10;
/usr/bin/mc config host add myminio http://s3:9000/ s3_key s3_secret;
/usr/bin/mc mb myminio/backup;
/usr/bin/mc policy set download myminio/backup;
exit 0;
"
secrets:
BACKUP_PASS:
file: ./secrets/BACKUP_PASS
BACKUP_S3_ACCESS_KEY:
file: ./secrets/BACKUP_S3_ACCESS_KEY
BACKUP_S3_SECRET_KEY:
file: ./secrets/BACKUP_S3_SECRET_KEY