forked from avatsaev/angular-contacts-swarm-stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
144 lines (131 loc) · 3.3 KB
/
docker-compose.yml
File metadata and controls
144 lines (131 loc) · 3.3 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
version: "3.6"
services:
db-primary:
hostname: db-primary
image: crunchydata/crunchy-postgres:centos7-10.3-1.8.2
environment:
- PGHOST=/tmp
- MAX_CONNECTIONS=10
- MAX_WAL_SENDERS=5
- PG_MODE=primary
- PG_PRIMARY_USER=primaryuser
- PG_PRIMARY_PASSWORD=password
- PG_DATABASE=contacts_dev
- PG_USER=contacts_dev
- PG_PASSWORD=contacts_dev_pass
- PG_ROOT_PASSWORD=password
- PG_PRIMARY_PORT=5432
volumes:
- db-primary-vol:/pgdata # storing data on a mapped network volume
ports:
- 5432
networks:
- db-net
deploy:
update_config:
failure_action: rollback
max_failure_ratio: .3
placement:
constraints:
- node.role == manager
#####################################################################
db-replica:
image: crunchydata/crunchy-postgres:centos7-10.3-1.8.2
environment:
- PGHOST=/tmp
- MAX_CONNECTIONS=10
- MAX_WAL_SENDERS=5
- PG_MODE=replica
- PG_PRIMARY_HOST=db-primary
- PG_PRIMARY_PORT=5432
- PG_PRIMARY_USER=primaryuser
- PG_PRIMARY_PASSWORD=password
- PG_DATABASE=contacts_dev
- PG_USER=contacts_dev
- PG_PASSWORD=contacts_dev_pass
- PG_ROOT_PASSWORD=password
volumes:
- db-replica-vol:/pgdata # replicated data doesn't need to be stored on a mapped volume
ports:
- 5432
networks:
- db-net
deploy:
mode: global
restart_policy:
condition: on-failure
update_config:
parallelism: 2
failure_action: rollback
max_failure_ratio: .3
placement:
constraints:
- node.role == worker
##########################################################################
redis:
image: redis:4.0.11-alpine
ports:
- 6379:6379
volumes:
- redis-vol:/data
networks:
- redis-net
deploy:
replicas: 1
restart_policy:
condition: on-failure
placement:
constraints:
- node.role == manager
################################################################################
api:
image: avatsaev/angular-contacts-api:dev
ports:
- 3000:3000
deploy:
mode: global
restart_policy:
condition: on-failure
update_config:
parallelism: 2
failure_action: rollback
max_failure_ratio: .3
placement:
constraints:
- node.role == worker
networks:
- db-net
- backend-net
- redis-net
environment:
DB_MASTER_URL: postgres://contacts_dev:contacts_dev_pass@db-primary/contacts_dev
DB_REPLICAS_URL: postgres://contacts_dev:contacts_dev_pass@db-replica/contacts_dev
REDIS_HOST: redis
#################################################################################
client:
image: avatsaev/angular-contacts-client:dev
ports:
- 4000:80
networks:
- frontend-net
deploy:
mode: global
restart_policy:
condition: on-failure
update_config:
parallelism: 2
failure_action: rollback
max_failure_ratio: .3
placement:
constraints:
- node.role == worker
##################################################################
networks:
db-net:
frontend-net:
backend-net:
redis-net:
volumes:
db-primary-vol:
db-replica-vol:
redis-vol: