-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompose.yaml
215 lines (200 loc) · 4.91 KB
/
compose.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
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
# This docker compose is for testing a real production env locally..
# Simulates a network etc.
version: '3.7'
services:
# ----- GENERAL SERVICES -------
service_webserver:
image: ahmad45123/workup:webserver
depends_on:
- service_mq
- service_mediaserver
ports:
- "80:8080"
networks:
- frontend
env_file:
- ./webserver/.env
deploy:
labels:
swarm.autoscaler: 'true'
swarm.autoscaler.minimum: '1'
swarm.autoscaler.maximum: '4'
service_mediaserver:
image: ahmad45123/workup:mediaserver
ports:
- "8080:8080"
env_file:
- ./mediaserver/.env
service_mq:
image: rabbitmq:3.13-management
ports:
- "5672:5672" # hacky method.. dont ever do this :(
- "15672:15672"
healthcheck:
test: rabbitmq-diagnostics -q ping
interval: 30s
timeout: 30s
retries: 3
networks:
- default
- frontend
labels:
com.datadoghq.ad.check_names: '["rabbitmq"]'
com.datadoghq.ad.init_configs: '[{}]'
com.datadoghq.ad.instances: '[{"prometheus_plugin": {"url": "http://service_mq:15692"}}]'
service_redis:
image: redis:7.2.4
healthcheck:
test: redis-cli ping
interval: 30s
timeout: 30s
retries: 3
networks:
- default
labels:
com.datadoghq.ad.check_names: '["redisdb"]'
com.datadoghq.ad.init_configs: '[{}]'
com.datadoghq.ad.instances: '[{"host": "service_redis","port":"6379"}]'
service_datadog:
image: gcr.io/datadoghq/agent:latest
container_name: service_datadog
deploy:
mode: global
networks:
- default
environment:
DD_API_KEY: 26913604f1968f188b5ca541aa58e092
DD_SYSTEM_PROBE_NETWORK_ENABLED: "true"
DD_PROCESS_AGENT_ENABLED: "true"
DD_SITE: us5.datadoghq.com
DD_LOGS_ENABLED: "true"
DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL: "true"
DD_CONTAINER_EXCLUDE: "name:service_datadog name:docker-swarm-autoscaler name:cadvisor name:prometheus"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /proc/:/host/proc/:ro
- /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
- /sys/kernel/debug:/sys/kernel/debug
security_opt:
- apparmor:unconfined
cap_add:
- SYS_ADMIN
- SYS_RESOURCE
- SYS_PTRACE
- NET_ADMIN
- NET_BROADCAST
- NET_RAW
- IPC_LOCK
- CHOWN
# ----- JOBS MICROSERVICE -------
service_jobs:
image: ahmad45123/workup:service_jobs
depends_on:
- jobs_db
- service_mq
networks:
- default
- jobs
env_file:
- ./services/jobs/.env
deploy:
labels:
swarm.autoscaler: 'true'
swarm.autoscaler.minimum: '1'
swarm.autoscaler.maximum: '3'
jobs_db:
image: ahmad45123/workup:sasicassandra
healthcheck:
test: [ "CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 20s
timeout: 10s
retries: 60
networks:
- jobs
# ----- PAYMENTS MICROSERVICE -------
service_payments:
image: ahmad45123/workup:service_payments
depends_on:
- payments_db
- service_mq
- service_redis
networks:
- default
- payments
env_file:
- ./services/payments/.env
deploy:
labels:
swarm.autoscaler: 'true'
swarm.autoscaler.minimum: '1'
swarm.autoscaler.maximum: '3'
payments_db:
image: postgres:12.18
command: -c 'max_connections=1000'
environment:
POSTGRES_PASSWORD: payments_password
POSTGRES_USER: payments_user
POSTGRES_DB: payments_database
healthcheck:
test: [ "CMD", "pg_isready" ]
interval: 20s
timeout: 10s
retries: 10
networks:
- payments
# ----- CONTRACTS MICROSERVICE -------
service_contracts:
image: ahmad45123/workup:service_contracts
depends_on:
- contracts_db
- service_mq
networks:
- default
- contracts
env_file:
- ./services/contracts/.env
deploy:
labels:
swarm.autoscaler: 'true'
swarm.autoscaler.minimum: '1'
swarm.autoscaler.maximum: '3'
contracts_db:
image: cassandra:4.0.7
healthcheck:
test: [ "CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 20s
timeout: 10s
retries: 60
networks:
- contracts
# ----- USERS MICROSERVICE -------
service_users:
image: ahmad45123/workup:service_users
depends_on:
- users_db
- service_mq
networks:
- default
- users
env_file:
- ./services/users/.env
deploy:
labels:
swarm.autoscaler: 'true'
swarm.autoscaler.minimum: '1'
swarm.autoscaler.maximum: '3'
users_db:
image: mongo:7.0
restart: always
environment:
MONGO_INITDB_ROOT_USERNAME: user
MONGO_INITDB_ROOT_PASSWORD: password
networks:
- users
networks:
default:
jobs:
payments:
contracts:
users:
frontend: