forked from marianoka/docker-composes-php
-
Notifications
You must be signed in to change notification settings - Fork 1
/
docker-vote.yml
86 lines (86 loc) · 1.86 KB
/
docker-vote.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
version: "3"
services:
redis:
image: redis:3.2-alpine
ports:
- "6379"
networks:
- voteapp
deploy:
placement:
constraints: [node.role == manager]
db:
image: postgres:9.4
volumes:
- db-data:/var/lib/postgresql/data
networks:
- voteapp
deploy:
placement:
constraints: [node.role == manager]
voting-app:
image: gaiadocker/example-voting-app-vote:good
ports:
- 5000:80
networks:
- voteapp
depends_on:
- redis
deploy:
mode: replicated
replicas: 2
labels: [APP=VOTING]
placement:
constraints: [node.role == worker]
result-app:
image: gaiadocker/example-voting-app-result:latest
ports:
- 5001:80
networks:
- voteapp
depends_on:
- db
worker:
image: gaiadocker/example-voting-app-worker:latest
networks:
voteapp:
aliases:
- workers
depends_on:
- db
- redis
# service deployment
deploy:
mode: replicated
replicas: 2
labels: [APP=VOTING]
# service resource management
resources:
# Hard limit - Docker does not allow to allocate more
limits:
cpus: '0.25'
memory: 512M
# Soft limit - Docker makes best effort to return to it
reservations:
cpus: '0.25'
memory: 256M
# service restart policy
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 120s
# service update configuration
update_config:
parallelism: 1
delay: 10s
failure_action: continue
monitor: 60s
max_failure_ratio: 0.3
# placement constraint - in this case on 'worker' nodes only
placement:
constraints: [node.role == worker]
networks:
voteapp:
volumes:
db-data: