Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
304 lines (298 loc) · 9.34 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
304 lines (298 loc) · 9.34 KB
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
services:
traefik:
ports:
- target: 80
published: 80
protocol: tcp
mode: host
- target: 443
published: 443
protocol: tcp
mode: host
networks:
- web-public
deploy:
update_config:
parallelism: 1
delay: 5s
order: stop-first
placement:
constraints:
- node.role==manager
volumes:
# Mount the Docker socket as read-only so Traefik can listen to events
- /var/run/docker.sock:/var/run/docker.sock:ro
- certificates:/certificates
configs:
- source: traefik
target: /etc/traefik/traefik.yml
php:
image: ${SPIN_IMAGE_DOCKERFILE_PHP}
environment:
AUTORUN_ENABLED: "true" # 👈 Remove this line if you don't want Laravel Automations
APP_ENV: "${SPIN_DEPLOYMENT_ENVIRONMENT}"
PHP_OPCACHE_ENABLE: "1"
HEALTHCHECK_PATH: "/up"
networks:
- web-public
volumes:
- "storage_private:/var/www/html/storage/app/private/"
- "storage_public:/var/www/html/storage/app/public/"
- "storage_sessions:/var/www/html/storage/framework/sessions"
- "storage_logs:/var/www/html/storage/logs"
deploy:
replicas: 1
update_config:
failure_action: rollback
parallelism: 1
delay: 5s
order: start-first
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 10s
max_attempts: 3
window: 120s
labels:
- "traefik.enable=true"
- "traefik.http.routers.laravel-web.rule=Host(`${SPIN_APP_DOMAIN}`)"
- "traefik.http.routers.laravel-web.entrypoints=websecure"
- "traefik.http.routers.laravel-web.tls=true"
- "traefik.http.routers.laravel-web.tls.certresolver=letsencryptresolver"
- "traefik.http.services.laravel-web.loadbalancer.server.port=8443"
- "traefik.http.services.laravel-web.loadbalancer.server.scheme=https"
# Health check
- "traefik.http.services.laravel-web.loadbalancer.healthcheck.path=/up"
- "traefik.http.services.laravel-web.loadbalancer.healthcheck.interval=30s"
- "traefik.http.services.laravel-web.loadbalancer.healthcheck.timeout=5s"
- "traefik.http.services.laravel-web.loadbalancer.healthcheck.scheme=https"
schedule:
image: ${SPIN_IMAGE_DOCKERFILE_PHP}
environment:
APP_ENV: "${SPIN_DEPLOYMENT_ENVIRONMENT}"
networks:
- web-public
volumes:
- "storage_private:/var/www/html/storage/app/private/"
- "storage_public:/var/www/html/storage/app/public/"
- "storage_sessions:/var/www/html/storage/framework/sessions"
- "storage_logs:/var/www/html/storage/logs"
deploy:
replicas: 1
update_config:
failure_action: rollback
parallelism: 1
delay: 5s
order: start-first
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 10s
max_attempts: 3
window: 120s
postgres:
networks:
- web-public
environment:
POSTGRES_DB: "${DB_DATABASE}"
POSTGRES_USER: "${DB_USERNAME}"
POSTGRES_PASSWORD: "${DB_PASSWORD}"
deploy:
placement:
constraints:
- node.role==manager
volumes:
- postgres_data:/var/lib/postgresql
- postgres_shared:/shared
ssh:
# We use an SSH image so we can securely tunnel into the Docker network with
# tools like Sequel Pro, TablePlus, Sequel Ace, etc.
# Learn more how to secure your tunnel here: https://github.com/serversideup/docker-ssh
image: serversideup/docker-ssh:v3
ports:
- target: 2222
published: 2222
mode: host
environment:
# Be sure to set the authorized keys in the .env file or GitHub Actions secrets
AUTHORIZED_KEYS: "${AUTHORIZED_KEYS}"
# You can lock to a specific IP too (AllowUsers tunnel@1.2.3.4)
ALLOWED_IPS: "AllowUsers tunnel"
volumes:
- tunnel_ssh_host_keys:/etc/ssh/ssh_host_keys
networks:
- web-public
redis:
command: "redis-server --appendonly yes --requirepass ${REDIS_PASSWORD}"
volumes:
- redis_data:/data
networks:
- web-public
deploy:
replicas: 1
update_config:
parallelism: 1
delay: 5s
order: start-first
horizon:
image: ${SPIN_IMAGE_DOCKERFILE_PHP}
environment:
APP_ENV: "${SPIN_DEPLOYMENT_ENVIRONMENT}"
stop_grace_period: 30s
networks:
- web-public
volumes:
- "storage_private:/var/www/html/storage/app/private/"
- "storage_public:/var/www/html/storage/app/public/"
- "storage_sessions:/var/www/html/storage/framework/sessions"
- "storage_logs:/var/www/html/storage/logs"
deploy:
update_config:
failure_action: rollback
parallelism: 1
delay: 5s
order: stop-first
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 10s
max_attempts: 3
window: 120s
reverb:
image: ${SPIN_IMAGE_DOCKERFILE_PHP}
environment:
APP_ENV: "${SPIN_DEPLOYMENT_ENVIRONMENT}"
networks:
- web-public
volumes:
- "storage_private:/var/www/html/storage/app/private/"
- "storage_public:/var/www/html/storage/app/public/"
- "storage_sessions:/var/www/html/storage/framework/sessions"
- "storage_logs:/var/www/html/storage/logs"
deploy:
replicas: 1
update_config:
failure_action: rollback
parallelism: 1
delay: 5s
order: start-first
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 10s
max_attempts: 3
window: 120s
labels:
- "traefik.enable=true"
- "traefik.http.routers.laravel-reverb.rule=Host(`${REVERB_HOST}`)"
- "traefik.http.routers.laravel-reverb.entrypoints=websecure"
- "traefik.http.routers.laravel-reverb.tls=true"
- "traefik.http.routers.laravel-reverb.tls.certresolver=letsencryptresolver"
- "traefik.http.services.laravel-reverb.loadbalancer.server.port=8000"
- "traefik.http.services.laravel-reverb.loadbalancer.server.scheme=http"
ssr:
image: ${SPIN_IMAGE_DOCKERFILE_SSR}
networks:
- web-public
command: node bootstrap/ssr/ssr.js
deploy:
replicas: 1
update_config:
failure_action: rollback
parallelism: 1
delay: 5s
order: start-first
rollback_config:
parallelism: 0
order: stop-first
restart_policy:
condition: any
delay: 10s
max_attempts: 3
window: 120s
healthcheck:
test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:13714/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 10s
rustfs:
image: rustfs/rustfs:latest
environment:
RUSTFS_ACCESS_KEY: "${RUSTFS_ACCESS_KEY}"
RUSTFS_SECRET_KEY: "${RUSTFS_SECRET_KEY}"
RUSTFS_VOLUMES: '/data'
RUSTFS_ADDRESS: '0.0.0.0:9000'
RUSTFS_CONSOLE_ADDRESS: '0.0.0.0:9001'
RUSTFS_CONSOLE_ENABLE: 'true'
RUSTFS_EXTERNAL_ADDRESS: ':9000'
RUSTFS_CORS_ALLOWED_ORIGINS: '*'
RUSTFS_CONSOLE_CORS_ALLOWED_ORIGINS: '*'
RUSTFS_LOG_LEVEL: 'info'
RUSTFS_OBS_LOGGER_LEVEL: 'info'
volumes:
- rustfs_storage:/data
networks:
- web-public
deploy:
replicas: 1
labels:
- traefik.enable=true
- traefik.http.routers.rustfs.rule=Host(`storage.${SPIN_APP_DOMAIN}`)
- traefik.http.routers.rustfs.entrypoints=websecure
- traefik.http.routers.rustfs.tls=true
- traefik.http.routers.rustfs.tls.certresolver=letsencryptresolver
- traefik.http.routers.rustfs.service=rustfs
- traefik.http.services.rustfs.loadbalancer.server.port=9000
- traefik.http.services.rustfs.loadbalancer.server.scheme=http
- traefik.http.routers.rustfs-console.rule=Host(`console-storage.${SPIN_APP_DOMAIN}`)
- traefik.http.routers.rustfs-console.entrypoints=websecure
- traefik.http.routers.rustfs-console.tls=true
- traefik.http.routers.rustfs-console.tls.certresolver=letsencryptresolver
- traefik.http.routers.rustfs-console.service=rustfs-console
- traefik.http.services.rustfs-console.loadbalancer.server.port=9001
- traefik.http.services.rustfs-console.loadbalancer.server.scheme=http
# rustfs-bucket-init:
# image: minio/mc:latest
# entrypoint: >
# /bin/sh -c "
# sleep 10 &&
# mc alias set rustfs http://rustfs:9000 $RUSTFS_ACCESS_KEY $RUSTFS_SECRET_KEY &&
# mc mb rustfs/\${RUSTFS_BUCKET} --ignore-existing || true
# "
# environment:
# RUSTFS_ACCESS_KEY: "${RUSTFS_ACCESS_KEY}"
# RUSTFS_SECRET_KEY: "${RUSTFS_SECRET_KEY}"
# RUSTFS_BUCKET: "media"
# networks:
# - web-public
# deploy:
# restart_policy:
# condition: on-failure
# delay: 5s
# max_attempts: 2
configs:
traefik:
name: "traefik-${SPIN_MD5_HASH_TRAEFIK_YML}.yml"
file: ./.infrastructure/conf/traefik/prod/traefik.yml
volumes:
certificates:
storage_private:
storage_public:
storage_sessions:
storage_logs:
postgres_data:
postgres_shared:
tunnel_ssh_host_keys:
redis_data:
rustfs_storage:
networks:
web-public: