-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdocker-compose-cloud.yaml
109 lines (105 loc) · 2.71 KB
/
docker-compose-cloud.yaml
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
version: "3.9"
services:
php:
container_name: php #useful just without docker-swarm
hostname: php
build:
context: docker/php
target: production #target environment (development, production)
volumes:
- ./:/app
#- php-fpm:/usr/local/sbin/
networks:
- overlay
deploy:
mode: replicated
replicas: 2
labels: [APP=PHP]
# service resource management
resources:
# Hard limit - Docker does not allow to allocate more
limits:
cpus: '1'
memory: 1024M
# Soft limit - Docker makes best effort to return to it
reservations:
cpus: '1'
memory: 512M
# 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
# service rallback configuration
rollback_config:
delay: 5s
parallelism: 2
failure_action: pause
max_failure_ratio: 1
# placement constraint - in this case on 'worker' nodes only
placement:
constraints: [node.role == production]
max_replicas_per_node: 1
nginx:
container_name: nginx
hostname: nginx
build:
context: docker/nginx
ports:
- "80:80"
volumes:
- ./:/app
#- php-fpm:/run/php/ volume mapping sock unix php-fpm, you can change for TCP connection on nginx -> .conf -> fastcgi_pass
networks:
- overlay
depends_on:
- php
deploy:
mode: replicated
replicas: 2
labels: [APP=PHP, ENV=DEV]
# service resource management
resources:
# Hard limit - Docker does not allow to allocate more
limits:
cpus: '1'
memory: 1024M
# Soft limit - Docker makes best effort to return to it
reservations:
cpus: '1'
memory: 1024M
# 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
# service rallback configuration
rollback_config:
delay: 5s
parallelism: 2
failure_action: pause
max_failure_ratio: 1
# placement constraint - in this case on 'worker' nodes only
placement:
constraints: [node.role == production]
max_replicas_per_node: 1
#volumes:
# php-fpm:
networks:
overlay: