-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebsite-stack-4-swarm.yml
More file actions
99 lines (94 loc) · 2.59 KB
/
website-stack-4-swarm.yml
File metadata and controls
99 lines (94 loc) · 2.59 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
# stack name "website"
version: '3.7'
services:
nginx:
image: nginx:1.17-alpine
# restart: unless-stopped
hostname: nginx
ports:
- target: 80
published: 82
protocol: tcp
mode: host
volumes:
- nginx_conf:/etc/nginx/conf.d:ro
- app:/usr/share/nginx/html
- /srv/data/website/nginx/htaccess.pwd:/etc/nginx/htaccess.pwd:ro
- logs:/var/log/nginx
- /srv/data/website/nginx/entrypoint-nginx.sh:/entrypoint.sh:ro
environment:
TZ: Europe/Rome
depends_on:
- app
entrypoint: ["/entrypoint.sh"]
#command: "/bin/sh -c 'echo -n \"Waiting for app...\"; until ping app -c1 >/dev/null; do sleep 1; echo -n \"...\"; done; echo \"OK\"; nginx -g \"daemon off;\"'"
command: ["nginx", "-g", "daemon off;"]
healthcheck:
test: ["CMD", "/bin/sh", "-c", "nc -w 7 -zv 0.0.0.0 80 || (echo \"Very bad things are happening here...\" && exit 1)"]
interval: 30s
timeout: 10s
start_period: 90s
retries: 6
stop_grace_period: 20s
app:
image: php:7.2-fpm-alpine
hostname: app
volumes:
- app:/usr/share/nginx/html
- /srv/data/website/nginx/entrypoint-app.sh:/entrypoint.sh:ro
environment:
TZ: Europe/Rome
depends_on:
- db
entrypoint: ["/entrypoint.sh"]
command: ["tini", "--", "php-fpm"]
healthcheck:
test: ["CMD", "nc", "-w", "7", "-zv", "0.0.0.0", "9000"]
interval: 30s
timeout: 30s
start_period: 60s
retries: 20
db:
image: mariadb:10.4
hostname: db
volumes:
- db:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD_FILE: /var/lib/mysql/db-root.pwd
MYSQL_PASSWORD_FILE: /var/lib/mysql/db-website.pwd
MYSQL_DATABASE_FILE: /var/lib/mysql/db-name.txt
MYSQL_USER_FILE: /var/lib/mysql/db-user.txt
TZ: Europe/Rome
healthcheck:
test: ["CMD", "/bin/bash", "-c", "read p < $$MYSQL_PASSWORD_FILE ; read u < $$MYSQL_USER_FILE ; mysql -p$$p -u$$u -e status | grep Uptime || (echo \"MariaDB is down\" && exit 1)"]
interval: 30s
timeout: 30s
start_period: 5s
retries: 20
volumes:
common_data:
driver: local
logs:
driver: local
driver_opts:
type: none
o: bind
device: /srv/data/logs/website
db:
driver: local
driver_opts:
type: none
o: bind
device: /srv/data/databases/website
app:
driver: local
driver_opts:
type: none
o: bind
device: /srv/data/website/app
nginx_conf:
driver: local
driver_opts:
type: none
o: bind
device: /srv/data/website/nginx/conf