-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
223 lines (207 loc) · 6.26 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
x-logging: &logging
logging:
driver: syslog
options:
syslog-address: tcp://10.5.5.1:514
syslog-format: rfc3164
tag: '{{.Name}}'
x-app-env: &app-env
TZ: UTC
DOMAIN_NAME: ${DOMAIN_NAME?}
DATA_DIR_ROOT: /data
NODE_ENV: ${NODE_ENV?} #See https://github.com/nodejs/docker-node/blob/main/docs/BestPractices.md
# DEBUG: '*' # Useful for debuggind Express.js routing
SMTP_CONNECTION_STRING: ${SMTP_CONNECTION_STRING?}
STRIPE_PUBLISHABLE_KEY: ${STRIPE_PUBLISHABLE_KEY?}
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY?}
x-disable-ipv6: &x-disable-ipv6
sysctls:
net.ipv6.conf.all.disable_ipv6: 1
net.ipv6.conf.default.disable_ipv6: 1
net.ipv6.conf.lo.disable_ipv6: 1
x-dns: &x-dns
dns: 10.5.5.2
services:
smtp-out:
depends_on: [logger, resolver]
container_name: smtp-out
hostname: smtp-out
image: smtp-out
restart: always
ports: ['127.0.0.1:1587:587']
volumes:
- ./.tmp/opendkim-keys:/etc/opendkim/keys
- ${POSTFIX_DIR_ROOT?}:/var/spool/postfix # to persist queue during container restarts
environment:
TZ: UTC
ALLOWED_SENDER_DOMAINS: feedsubscription.com
POSTFIX_myhostname: feedsubscription.com
POSTFIX_notify_classes: 'bounce,resource,software'
POSTFIX_message_size_limit: 10485760 # 10M
POSTFIX_virtual_alias_domains: feedsubscription.com
POSTFIX_virtual_alias_maps: 'texthash:/etc/postfix/virtual'
POSTFIX_transport_maps: 'texthash:/etc/postfix/transport'
# fragile destinations
POSTFIX_fragile_destination_concurrency_limit: 1
POSTFIX_fragile_destination_rate_delay: 2s
<<: [*logging, *x-disable-ipv6, *x-dns]
healthcheck:
disable: true # Disabled because makes it makes following the logs harder when degugging
networks:
net:
ipv4_address: 10.5.5.9
smtp-in:
depends_on: [logger, resolver]
container_name: smtp-in
hostname: smtp-in
image: smtp-in
ports: ['25:25']
restart: always
volumes:
- ./.tmp/smtp-in/opendkim-keys:/var/db/dkim/
- ./.tmp/certbot/conf/live/feedsubscription.com/fullchain.pem:/etc/postfix/cert/smtp.cert:ro
- ./.tmp/certbot/conf/live/feedsubscription.com/privkey.pem:/etc/postfix/cert/smtp.key:ro
environment:
SMF_DOMAIN: feedsubscription.com
SMF_CONFIG: '@feedsubscription.com:[email protected]'
SMF_SRS: 'true'
SMF_POSTFIXMAIN_sender_canonical_maps: 'tcp:localhost:10001'
SMF_POSTFIXMAIN_sender_canonical_classes: 'envelope_sender'
SMF_POSTFIXMAIN_recipient_canonical_maps: 'tcp:localhost:10002'
SMF_POSTFIXMAIN_recipient_canonical_classes: 'envelope_recipient,header_recipient'
# TLS: No ECDSA certificate in this setup, only RSA
SMF_POSTFIXMAIN_smtpd_tls_eccert_file: ''
SMF_POSTFIXMAIN_smtpd_tls_eckey_file: ''
<<: [*logging, *x-disable-ipv6, *x-dns]
networks:
net:
ipv4_address: 10.5.5.8
app:
depends_on: [logger, resolver]
container_name: app
hostname: app
image: app
init: true # This is to tell Node process to stop when the container is asked to stop.
restart: always
volumes:
- ${DATA_DIR_ROOT?}:/data
# NOTE: This doesn’t work, and I’m not fixing it now because I don’t
# know how, and it’s not worth the effort of further investigation.
# extra_hosts:
# - 'feedsubscription.com:207.154.253.211'
environment:
<<: *app-env
command: node dist/app/cron.js
<<: [*logging, *x-disable-ipv6, *x-dns]
networks:
net:
ipv4_address: 10.5.5.7
delmon:
depends_on: [logger, resolver]
container_name: delmon
hostname: delmon
image: delmon
init: true # This is to tell Node process to stop when the container is asked to stop.
restart: always
volumes:
- .tmp/logs/feedsubscription:/logs:ro
- ${DATA_DIR_ROOT?}:/data
environment:
<<: *app-env
<<: [*logging, *x-disable-ipv6, *x-dns]
networks:
net:
ipv4_address: 10.5.5.6
api:
depends_on: [logger, resolver]
container_name: api
hostname: api
image: app
init: true # This is to tell Node process to stop when the container is asked to stop.
restart: always
command: node dist/api/server.js
volumes:
- ${DATA_DIR_ROOT?}:/data
environment:
# DEBUG: 'express:*'
# TS_NODE_DEBUG: 'true'
<<: *app-env
<<: [*logging, *x-disable-ipv6, *x-dns]
networks:
net:
ipv4_address: 10.5.5.5
# Thanks to https://github.com/wmnnd/nginx-certbot
website:
depends_on: [api]
container_name: website
hostname: website
image: website
restart: always
ports: ['80:80', '443:443']
volumes:
- ./website/html:/usr/share/nginx/html:ro
- ./website/nginx/conf.d:/etc/nginx/conf.d:ro
- ./.tmp/certbot/conf:/etc/letsencrypt
- ./.tmp/certbot/www:/var/www/certbot
environment:
NGINX_HOST: feedsubscription.com
<<: [*logging, *x-disable-ipv6, *x-dns]
networks:
net:
ipv4_address: 10.5.5.4
# Thanks to https://github.com/wmnnd/nginx-certbot
certbot:
depends_on: [logger, resolver]
container_name: certbot
hostname: certbot
image: certbot
restart: always
volumes:
- ./.tmp/certbot/conf:/etc/letsencrypt
- ./website/html:/var/www/certbot
entrypoint: >-
/bin/sh -c '
trap exit TERM;
trap "certbot renew" HUP;
while :; do
date;
certbot --version;
certbot renew;
sleep 7d & wait $${!};
done;
'
<<: [*logging, *x-disable-ipv6, *x-dns]
networks:
net:
ipv4_address: 10.5.5.3
logger:
container_name: logger
hostname: logger
image: logger
restart: always
volumes:
- ./.tmp/logs:/var/log/syslog-ng
<<: [*x-dns]
networks:
net:
ipv4_address: 10.5.5.1
resolver:
depends_on: [logger]
hostname: resolver
image: resolver
container_name: resolver
restart: always
volumes:
- ./.tmp/resolver/etc/hosts:/etc/hosts:ro
networks:
net:
ipv4_address: 10.5.5.2
<<: [*logging, *x-disable-ipv6]
networks:
net:
enable_ipv6: false # Trying to simplify the DNS issue context
driver: bridge
ipam:
config:
- subnet: 10.5.5.0/24
gateway: 10.5.5.100