-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmaadb-stack.yml
220 lines (207 loc) · 4.93 KB
/
maadb-stack.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
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
version: "3.7"
networks:
mongo-net:
postgres-net:
services:
postgres:
image: postgres
networks:
- postgres-net
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
ports:
- 5432:5432
deploy:
restart_policy:
delay: 0s
max_attempts: 10
window: 5s
placement:
constraints:
- node.labels.type==rpi2
environment:
- POSTGRES_PASSWORD=postgres
sql-analytics-server:
image: lamba92/maadb-project-sql-analytics-server
networks:
- postgres-net
depends_on:
- postgres
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 15s
placement:
constraints:
- node.labels.type==rpi4
environment:
- DATABASE_URL=jdbc:postgresql://postgres:5432/
- DATABASE_USER=postgres
- DATABASE_PASSWORD=postgres
ports:
- 8083:80
nosql-analytics-server:
image: lamba92/maadb-project-nosql-analytics-server
networks:
- mongo-net
depends_on:
- supervisor
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 15s
placement:
constraints:
- node.labels.type==rpi4
environment:
- MONGO_URL=mongodb://supervisor:27017
- MONGO_DB_NAME=maadb
ports:
- 8084:80
supervisor:
image: lamba92/maadb-project-supervisor
networks:
- mongo-net
- postgres-net
depends_on:
- postgres
- mongo-cfg-1
- mongo-cfg-2
- ms1
- ms2
- ms3
- ms4
healthcheck:
test: ["CMD", "mongo", "--eval", "db.stats()"]
deploy:
restart_policy:
condition: on-failure
delay: 5s
max_attempts: 3
window: 15s
environment:
- MONGO_CONFIGS=mongo-cfg-1:27019,mongo-cfg-2:27019
- MONGO_SHARDS=ms1:27018,ms2:27018,ms3:27018,ms4:27018
- MONGO_CONFIGS_RPL_NAME=cfgrs
- MONGO_SHARDS_RPL_NAME=datars
- MONGO_DB_NAME=maadb
- RELATIONAL_DB_URL=jdbc:postgresql://postgres:5432/
- RELATIONAL_DB_USER=postgres
- RELATIONAL_DB_PASSWORD=postgres
ports:
- 27017:27017
mongo-cfg-1:
image: mongo
command: mongod --configsvr --bind_ip_all --replSet cfgrs
networks:
- mongo-net
healthcheck:
test: ["CMD", "mongo", "--port", "27019", "--eval", "db.stats()"]
deploy:
restart_policy:
delay: 5s
max_attempts: 5
window: 10s
placement:
constraints:
- node.labels.mongo.role==data1
mongo-cfg-2:
image: mongo
command: mongod --configsvr --bind_ip_all --replSet cfgrs
networks:
- mongo-net
healthcheck:
test: ["CMD", "mongo", "--port", "27019", "--eval", "db.stats()"]
deploy:
restart_policy:
delay: 5s
max_attempts: 5
window: 10s
placement:
constraints:
- node.labels.mongo.role==data2
ms1:
image: mongo
command: mongod --shardsvr --bind_ip_all --replSet datars
networks:
- mongo-net
healthcheck:
test: ["CMD", "mongo", "--port", "27018", "--eval", "db.stats()"]
deploy:
placement:
constraints:
- node.labels.mongo.role==data1
restart_policy:
delay: 5s
max_attempts: 5
window: 10s
ms2:
image: mongo
command: mongod --shardsvr --bind_ip_all --replSet datars
networks:
- mongo-net
healthcheck:
test: ["CMD", "mongo", "--port", "27018", "--eval", "db.stats()"]
deploy:
placement:
constraints:
- node.labels.mongo.role==data2
restart_policy:
delay: 5s
max_attempts: 5
window: 10s
ms3:
image: mongo
command: mongod --shardsvr --bind_ip_all --replSet datars
networks:
- mongo-net
healthcheck:
test: ["CMD", "mongo", "--port", "27018", "--eval", "db.stats()"]
deploy:
placement:
constraints:
- node.labels.mongo.role==data1
restart_policy:
delay: 5s
max_attempts: 5
window: 10s
ms4:
image: mongo
command: mongod --shardsvr --bind_ip_all --replSet datars
networks:
- mongo-net
healthcheck:
test: ["CMD", "mongo", "--port", "27018", "--eval", "db.stats()"]
deploy:
placement:
constraints:
- node.labels.mongo.role==data2
restart_policy:
delay: 5s
max_attempts: 5
window: 10s
api-gateway:
image: nginx
command: ["nginx-debug", "-g", "daemon off;"]
deploy:
placement:
constraints:
- node.labels.type==rpi2
depends_on:
- sql-analytics-server
- nosql-analytics-server
networks:
- mongo-net
- postgres-net
volumes:
- ./nginx.conf:/etc/nginx/nginx.conf:ro
- ./nginx.log:/nginx.log:rw
ports:
- 80:80