-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathdocker-compose.yml
301 lines (273 loc) · 8.09 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
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
version: '2'
# Yandex.Cloud external IP with DDoS Protection enabled has a requirement of MTU of 1450
# according to https://github.com/moby/moby/issues/22297#issuecomment-242934050 that's the only way to set it inside docker-compose
networks:
default:
driver: bridge
driver_opts:
com.docker.network.driver.mtu: 1450
services:
certbot:
image: adferrand/dnsrobocert
hostname: certbot
container_name: certbot
volumes:
- ./private/letsencrypt:/etc/letsencrypt
# needed for nginx container autorestart, https://dnsrobocert.readthedocs.io/en/latest/configuration_reference.html#autorestart
- /var/run/docker.sock:/var/run/docker.sock
# should be in the following format:
# https://dnsrobocert.readthedocs.io/en/latest/user_guide.html#configuration
- ./config/dnsrobocert.yml:/etc/dnsrobocert/config.yml
# For yandexcloud:
# AUTH_KEY must be provided, short-lived and set by scripts/update-dns-token.sh
# DNS_ZONE_ID from https://console.cloud.yandex.com/link/dns or
# CLOUD_ID, FOLDER_ID from https://console.cloud.yandex.com/cloud can be provided
env_file: private/environment/dnsrobocert.env
# used in config/dnsrobocert.yml
environment:
- PROVIDER=yandexcloud
- DOMAIN=favor-group.ru
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
restart: unless-stopped
nginx:
build: ./config/nginx
hostname: nginx
container_name: nginx
image: ghcr.io/paskal/nginx:latest
depends_on:
- adminer
- php
- updater
ports:
- "80:80"
- "443:443/tcp"
- "443:443/udp"
expose:
- "8084"
volumes:
- ./web/prod:/web/prod
- ./web/dev:/web/dev
- ./config/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./config/nginx/bitrix.conf:/etc/nginx/bitrix.conf:ro
- ./config/nginx/fastcgi.conf:/etc/nginx/fastcgi.conf:ro
- ./config/nginx/bots.conf:/etc/nginx/bots.conf:ro
- ./config/nginx/security_headers.conf:/etc/nginx/security_headers.conf:ro
- ./config/nginx/static-cdn.conf:/etc/nginx/static-cdn.conf:ro
- ./config/nginx/conf.d:/etc/nginx/conf.d:ro
- ./private/nginx:/etc/nginx/private.conf.d:ro
- ./private/letsencrypt:/etc/nginx/letsencrypt:ro
# Logs
- ./logs/nginx:/var/log/nginx
environment:
- TZ=Europe/Moscow
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
restart: unless-stopped
php:
build:
context: ./config/php
dockerfile: Dockerfile.8.2
image: ghcr.io/paskal/bitrix-php:8.2
hostname: php
container_name: php
depends_on:
- memcached
- memcached-sessions
expose:
- "9000"
volumes:
- ./web/prod:/web/prod
- ./web/dev:/web/dev
- ./private/msmtprc:/etc/msmtprc
# MySQL socket to prevent transferring data through TCP
- ./private/mysqld:/var/run/mysqld
# Logs
- ./logs/php:/var/log/php
# configuration
- ./config/php/90-php.ini:/etc/php/8.2/fpm/conf.d/90-php.ini
- ./config/php/xdebug.ini:/etc/php/8.2/mods-available/xdebug.ini
# for monitoring purposes
- ./logs/nginx:/var/log/nginx
# switch timezone from UTC to Moscow
- ./config/php/moscow-timezone:/etc/timezone:ro
- ./config/php/moscow-localtime:/etc/localtime:ro
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
restart: unless-stopped
php-cron:
command: cron -f
image: ghcr.io/paskal/bitrix-php:8.2
hostname: php-cron
container_name: php-cron
depends_on:
- memcached
- memcached-sessions
volumes:
- ./web/prod:/web/prod
- ./web/dev:/web/dev
- ./private/msmtprc:/etc/msmtprc
# MySQL socket to prevent transferring data through TCP
- ./private/mysqld:/var/run/mysqld
# configuration
- ./config/php/90-php.ini:/etc/php/8.2/cli/conf.d/90-php.ini
# Cronjobs
- ./config/cron/php-cron.cron:/etc/cron.d/tasks:ro
# switch timezone from UTC to Moscow
- ./config/php/moscow-timezone:/etc/timezone:ro
- ./config/php/moscow-localtime:/etc/localtime:ro
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
restart: unless-stopped
mysql:
image: percona/percona-server:8.0
hostname: mysql
container_name: mysql
# MYSQL_ROOT_PASSWORD, MYSQL_USER, MYSQL_PASSWORD
env_file: private/environment/mysql.env
volumes:
# Configuration
- ./config/mysql/my.cnf:/etc/my.cnf.d/my.cnf
# Data persistence
- ./private/mysql-data:/var/lib/mysql
# MySQL socket to prevent transferring data through TCP
# do chown 1001:1001 ./private/mysqld
- ./private/mysqld:/var/mysql-socket
# Logs
- ./logs/mysql:/var/log/mysql
environment:
MYSQL_DATABASE: favor_group_ru
TZ: Europe/Moscow
cap_add:
- SYS_NICE # CAP_SYS_NICE
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
restart: unless-stopped
memcached:
image: memcached:1-alpine
hostname: memcached
container_name: memcached
restart: unless-stopped
command: ["-m", "128"]
expose:
- "11211"
memcached-sessions:
image: memcached:1-alpine
hostname: memcached-sessions
container_name: memcached-sessions
restart: unless-stopped
command: ["-m", "128"]
expose:
- "11211"
adminer:
image: adminer
hostname: adminer
container_name: adminer
expose:
- "8080"
environment:
ADMINER_DEFAULT_SERVER: localhost
volumes:
# MySQL socket to prevent transferring data through TCP
- ./private/mysqld:/var/run/mysqld
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
restart: unless-stopped
# Monitoring
## Zabbix Agent 2
zabbix-agent:
build: ./config/zabbix
image: ghcr.io/paskal/zabbix-agent2:latest
container_name: zabbix-agent
privileged: true
# MYSQL_USER, MYSQL_PASSWORD
# ZBX_HOSTNAME, ZBX_SERVER_HOST
env_file:
- private/environment/mysql.env
- private/environment/zabbix.env
# for monitoring purposes, as AUTH_TOKEN is supposed to be set by scripts/update-dns-token.sh
- private/environment/dnsrobocert.env
depends_on:
- nginx
- memcached
volumes:
# for monitoring purposes
- ./logs/nginx:/var/log/nginx
# for monitoring purposes
- ./web/prod/upload:/web/prod/upload
# this is needed in order to monitor docker
# to make it work you need to create user "zabbix" with id 1997 on the host system,
# and make sure it has enough permissions to read /var/run/docker.sock
- /var/run/docker.sock:/var/run/docker.sock
# MySQL socket to prevent transferring data through TCP
- ./private/mysqld:/var/run/mysqld
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
restart: unless-stopped
# webhooks server
updater:
image: ghcr.io/umputun/updater:master
container_name: updater
hostname: updater
restart: always
logging:
driver: json-file
options:
max-size: "10m"
max-file: "5"
# KEY variable
env_file: private/environment/updater.env
environment:
- LISTEN=0.0.0.0:8080
- CONF=/etc/updater.yml
- APP_UID=1000
ports:
- "8080"
volumes:
- ./config/updater.yaml:/etc/updater.yml
- ./private/updater_ssh_key:/home/app/.ssh/id_rsa
# FTP access
# ftp:
# image: stilliard/pure-ftpd
# container_name: ftp
# # FTP_USER_NAME, FTP_USER_PASS
# env_file: private/environment/ftp.env
# ports:
# - "21:21"
# - "30000-30009:30000-30009"
# volumes:
# - ./web/dev:/home/web
# environment:
# PUBLICHOST: favor-group.ru
# FTP_USER_HOME: /home/web
# FTP_PASSIVE_PORTS: 30000:30009
#
# logging:
# driver: json-file
# options:
# max-size: "10m"
# max-file: "5"
#
# restart: unless-stopped