-
Notifications
You must be signed in to change notification settings - Fork 16
/
docker-compose-swarm.yml
87 lines (79 loc) · 1.63 KB
/
docker-compose-swarm.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
version: '3.8'
services:
web:
image: mjhea0/flask-docker-swarm_web:latest
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [node.role == worker]
expose:
- 5000
environment:
- FLASK_ENV=production
- APP_SETTINGS=project.config.ProductionConfig
- DB_USER=postgres
- DB_PASSWORD=postgres
secrets:
- secret_code
depends_on:
- db
networks:
- app
healthcheck:
test: curl --fail http://localhost:5000/ping || exit 1
interval: 10s
timeout: 2s
retries: 5
db:
image: mjhea0/flask-docker-swarm_db:latest
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [node.role == manager]
volumes:
- data-volume:/var/lib/postgresql/data
expose:
- 5432
environment:
- POSTGRES_USER=postgres
- POSTGRES_PASSWORD=postgres
networks:
- app
nginx:
image: mjhea0/flask-docker-swarm_nginx:latest
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints: [node.role == worker]
ports:
- 80:80
depends_on:
- web
networks:
- app
visualizer:
image: dockersamples/visualizer:latest
ports:
- 8080:8080
volumes:
- "/var/run/docker.sock:/var/run/docker.sock"
deploy:
placement:
constraints: [node.role == manager]
networks:
- app
networks:
app:
driver: overlay
volumes:
data-volume:
driver: local
secrets:
secret_code:
external: true