forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 2
/
docker-compose.yml
319 lines (300 loc) · 8.52 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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
# vim: ts=2 sw=2 et
version: '2.2'
services:
db:
restart: always
image: postgres:14-alpine
shm_size: 256mb
networks:
- db_network
healthcheck:
test: ['CMD', 'pg_isready', '-U', 'postgres']
volumes:
- /srv/mastodon/vulpine.club/postgres14:/var/lib/postgresql/data
environment:
- 'POSTGRES_HOST_AUTH_METHOD=trust'
redis:
restart: always
image: redis:7-alpine
networks:
- redis_network
healthcheck:
test: ['CMD', 'redis-cli', 'ping']
volumes:
- /srv/mastodon/vulpine.club/redis:/data
es:
restart: always
image: docker.elastic.co/elasticsearch/elasticsearch:7.17.4
environment:
- "ES_JAVA_OPTS=-Xms512m -Xmx512m -Des.enforce.bootstrap.checks=true"
- "xpack.license.self_generated.type=basic"
- "xpack.security.enabled=false"
- "xpack.watcher.enabled=false"
- "xpack.graph.enabled=false"
- "xpack.ml.enabled=false"
- "bootstrap.memory_lock=true"
- "cluster.name=es-mastodon"
- "discovery.type=single-node"
- "thread_pool.write.queue_size=1000"
networks:
- es_network
healthcheck:
test: ["CMD-SHELL", "curl --silent --fail localhost:9200/_cluster/health || exit 1"]
volumes:
- /srv/mastodon/vulpine.club/elasticsearch:/usr/share/elasticsearch/data
ulimits:
memlock:
soft: -1
hard: -1
nofile:
soft: 65536
hard: 65536
ports:
- '127.0.0.1:9200:9200'
web:
build: .
image: vulpineclub/mastodon:production
restart: always
env_file: .env.production
command: bash -c "rm -f /mastodon/tmp/pids/server.pid; bundle exec rails s -p 3000"
networks:
external_network:
db_network:
es_network:
redis_network:
internal_network:
aliases:
- fe_web
healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:3000/health || exit 1']
#ports:
# - '127.0.0.1:3000:3000'
depends_on:
- db
- redis
- es
volumes:
- /srv/mastodon/vulpine.club/media:/srv/mastodon/vulpine.club/media
- /srv/mastodon/vulpine.club/public/system:/mastodon/public/system
- /etc/localtime:/etc/localtime:ro
cpu_shares: 2048
streaming:
build: .
image: vulpineclub/mastodon:production
restart: always
env_file: .env.production
command: node ./streaming
networks:
external_network:
db_network:
redis_network:
internal_network:
aliases:
- fe_streaming
healthcheck:
# prettier-ignore
test: ['CMD-SHELL', 'wget -q --spider --proxy=off localhost:4000/api/v1/streaming/health || exit 1']
#ports:
# - '127.0.0.1:4000:4000'
depends_on:
- db
- redis
sidekiq_scheduler:
image: vulpineclub/mastodon:production
restart: always
scale: 1
env_file: .env.production
command: bundle exec sidekiq -q scheduler
depends_on:
- db
- redis
networks:
- external_network
- db_network
- es_network
- redis_network
volumes:
- /srv/mastodon/vulpine.club/media:/srv/mastodon/vulpine.club/media
- /srv/mastodon/vulpine.club/public/system:/mastodon/public/system
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
cpu_shares: 512
sidekiq:
build: .
image: vulpineclub/mastodon:production
restart: always
scale: 2
env_file: .env.production
command: bundle exec sidekiq -q default -q push -q ingress -q mailers -q pull
depends_on:
- db
- redis
networks:
- external_network
- db_network
- es_network
- redis_network
volumes:
- /srv/mastodon/vulpine.club/media:/srv/mastodon/vulpine.club/media
- /srv/mastodon/vulpine.club/public/system:/mastodon/public/system
healthcheck:
test: ['CMD-SHELL', "ps aux | grep '[s]idekiq\ 6' || false"]
cpu_shares: 512
## Uncomment to enable federation with tor instances along with adding the following ENV variables
## http_proxy=http://privoxy:8118
## ALLOW_ACCESS_TO_HIDDEN_SERVICE=true
# tor:
# image: sirboops/tor
# networks:
# - external_network
# - internal_network
#
# privoxy:
# image: sirboops/privoxy
# volumes:
# - ./priv-config:/opt/config
# networks:
# - external_network
# - internal_network
# local additions
# ambassador:
# restart: always
# image: vulpineclub/ambassador
# env_file: .env.ambassador
# command: yarn start
# depends_on:
# - db
# networks:
# - external_network
# - db_network
# front end web server
# https://hub.docker.com/r/xcgd/nginx-vts
# now using an image with vts so we have more metrics about how nginx is replying to users
nginx:
restart: always
image: xcgd/nginx-vts:mainline
depends_on:
- web
- streaming
ports:
- "80:80"
- "443:443"
networks:
external_network:
ipv6_address: 2600:3c03:e000:452::e621:10
internal_network:
volumes:
- /etc/letsencrypt:/etc/letsencrypt
- /etc/nginx:/etc/nginx
- /srv/mastodon/vulpine.club/public:/srv/mastodon/vulpine.club/public
- /srv/mastodon/vulpine.club/media:/srv/mastodon/vulpine.club/media
- /srv/mastodon/vulpine.club/nginx_cache:/var/cache/nginx
- /srv/mastodon/vulpine.club/nginx_logs:/var/log/nginx
prometheus:
restart: always
image: prom/prometheus
# TODO depends_on
networks:
- monitoring_network
volumes:
- /srv/mastodon/vulpine.club/monitoring-and-alerting/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
- /srv/mastodon/vulpine.club/monitoring-and-alerting/prometheus/data:/prometheus
prometheus_sidekiq_exporter:
restart: always
image: alexand/sidekiq-prometheus-exporter
networks:
monitoring_network:
aliases:
- sidekiq-exporter
redis_network:
prometheus_elasticsearch_exporter:
restart: always
image: justwatch/elasticsearch_exporter:1.0.2
command:
- '-es.uri=http://es:9200'
networks:
monitoring_network:
aliases:
- elasticsearch-exporter
es_network:
prometheus_node_exporter:
restart: always
image: prom/node-exporter:v0.15.2
volumes:
- /proc:/host/proc:ro
- /sys:/host/sys:ro
- /:/rootfs:ro
- /srv/mastodon/vulpine.club/media:/vulpine-media:ro
command:
- '--path.procfs=/host/proc'
- '--path.sysfs=/host/sys'
- --collector.filesystem.ignored-mount-points
- "^/(sys|proc|dev|host|etc|rootfs/var/lib/docker/containers|rootfs/var/lib/docker/overlay2|rootfs/run/docker/netns|rootfs/var/lib/docker/aufs)($$|/)"
networks:
monitoring_network:
aliases:
- node-exporter
prometheus_nginx_exporter:
restart: always
image: nginx/nginx-prometheus-exporter:0.2.0
command:
- '-nginx.scrape-uri=http://nginx/stub_stats'
networks:
monitoring_network:
aliases:
- nginx-exporter
internal_network:
prometheus_mastodon_exporter:
restart: always
build: /srv/mastodon/vulpine.club/monitoring-and-alerting/mastodon-prometheus-exporter
image: vulpineclub/mastodon-exporter:latest
environment:
- 'MASTODON_HOST=https://nginx/'
networks:
monitoring_network:
aliases:
- mastodon-exporter
internal_network:
prometheus_nginx_vts_exporter:
restart: always
image: sophos/nginx-vts-exporter:latest
environment:
- 'NGINX_STATUS=http://nginx/vts_stats'
networks:
monitoring_network:
aliases:
- nginx-vts-exporter
internal_network:
grafana:
restart: always
image: grafana/grafana:5.3.2
volumes:
- /srv/mastodon/vulpine.club/monitoring-and-alerting/grafana/lib:/var/lib/grafana
- /srv/mastodon/vulpine.club/monitoring-and-alerting/grafana/grafana.ini:/etc/grafana/grafana.ini
- /srv/mastodon/vulpine.club/monitoring-and-alerting/grafana/datasource.yaml:/etc/grafana/provisioning/datasources/datasource.yaml
networks:
- monitoring_network
- internal_network
- external_network
links:
- prometheus
networks:
external_network:
driver: bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 172.31.0.0/16
- subnet: 2600:3c03:e000:0452::/64
internal_network:
internal: true
db_network:
internal: true
redis_network:
internal: true
es_network:
internal: true
monitoring_network:
internal: true