Skip to content

Commit 92fac77

Browse files
authored
Merge pull request #336 from meysamhadeli/refactor/refactor-deployments
refactor: refactor deployments
2 parents c9c2478 + 5dde8aa commit 92fac77

File tree

3 files changed

+427
-67
lines changed

3 files changed

+427
-67
lines changed

1-monolith-architecture-style/deployments/.gitkeep

Whitespace-only changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,361 @@
1+
# ref: https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/examples/demo/docker-compose.yaml
2+
# ref: https://github.com/joaofbantunes/DotNetMicroservicesObservabilitySample/blob/main/docker-compose.yml
3+
# ref: https://github.com/oskardudycz/EventSourcing.NetCore/blob/main/docker-compose.yml
4+
# https://github.com/grafana/intro-to-mltp
5+
# https://stackoverflow.com/questions/65272764/ports-are-not-available-listen-tcp-0-0-0-0-50070-bind-an-attempt-was-made-to
6+
7+
8+
name: booking-monolith-infrastructure
9+
10+
services:
11+
#######################################################
12+
# rabbitmq
13+
#######################################################
14+
rabbitmq:
15+
image: rabbitmq:management
16+
container_name: rabbitmq
17+
restart: unless-stopped
18+
ports:
19+
- "5672:5672"
20+
- "15672:15672"
21+
# volumes:
22+
# - rabbitmq:/var/lib/rabbitmq
23+
networks:
24+
- infrastructure
25+
26+
#######################################################
27+
# postgres
28+
#######################################################
29+
postgres:
30+
image: postgres:latest
31+
container_name: postgres
32+
restart: unless-stopped
33+
ports:
34+
- '5432:5432'
35+
environment:
36+
- POSTGRES_USER=postgres
37+
- POSTGRES_PASSWORD=postgres
38+
command:
39+
- "postgres"
40+
- "-c"
41+
- "wal_level=logical"
42+
- "-c"
43+
- "max_prepared_transactions=10"
44+
volumes:
45+
- postgres-data:/var/lib/postgresql/data
46+
networks:
47+
- infrastructure
48+
49+
50+
#######################################################
51+
# EventStoreDB
52+
#######################################################
53+
eventstore:
54+
container_name: eventstore
55+
image: eventstore/eventstore:latest
56+
restart: unless-stopped
57+
environment:
58+
- EVENTSTORE_CLUSTER_SIZE=1
59+
- EVENTSTORE_RUN_PROJECTIONS=All
60+
- EVENTSTORE_START_STANDARD_PROJECTIONS=True
61+
- EVENTSTORE_HTTP_PORT=2113
62+
- EVENTSTORE_INSECURE=True
63+
- EVENTSTORE_ENABLE_ATOM_PUB_OVER_HTTP=True
64+
ports:
65+
- "2113:2113"
66+
networks:
67+
- infrastructure
68+
69+
70+
# #######################################################
71+
# # Mongo
72+
# #######################################################
73+
mongo:
74+
image: mongo:latest
75+
container_name: mongo
76+
restart: unless-stopped
77+
# environment:
78+
# - MONGO_INITDB_ROOT_USERNAME=root
79+
# - MONGO_INITDB_ROOT_PASSWORD=secret
80+
ports:
81+
- 27017:27017
82+
networks:
83+
- infrastructure
84+
85+
86+
# #######################################################
87+
# # Redis
88+
# #######################################################
89+
redis:
90+
image: redis
91+
container_name: redis
92+
restart: unless-stopped
93+
ports:
94+
- 6379:6379
95+
networks:
96+
- infrastructure
97+
98+
99+
# #######################################################
100+
# # jaeger
101+
# # https://www.jaegertracing.io/docs/1.64/deployment/
102+
# # https://www.jaegertracing.io/docs/1.6/deployment/
103+
# #######################################################
104+
jaeger-all-in-one:
105+
image: jaegertracing/all-in-one:latest
106+
container_name: jaeger-all-in-one
107+
restart: unless-stopped
108+
ports:
109+
- "6831:6831/udp" # UDP port for Jaeger agent
110+
- "16686:16686" # endpoints and Jaeger UI
111+
- "14268:14268" # HTTP port for accept trace spans directly from clients
112+
- "14317:4317" # OTLP gRPC receiver for jaeger
113+
- "14318:4318" # OTLP http receiver for jaeger
114+
# - "9411" # Accepts Zipkin spans - /api/v2/spans
115+
networks:
116+
- infrastructure
117+
118+
119+
# #######################################################
120+
# # zipkin
121+
# # https://zipkin.io/pages/quickstart
122+
# #######################################################
123+
zipkin-all-in-one:
124+
image: openzipkin/zipkin:latest
125+
container_name: zipkin-all-in-one
126+
restart: unless-stopped
127+
ports:
128+
- "9411:9411"
129+
networks:
130+
- infrastructure
131+
132+
133+
# #######################################################
134+
# # otel-collector
135+
# # https://opentelemetry.io/docs/collector/installation/
136+
# # https://github.com/open-telemetry/opentelemetry-collector
137+
# # https://github.com/open-telemetry/opentelemetry-collector-contrib
138+
# # we can use none contrib docker `otel/opentelemetry-collector` version from `https://github.com/open-telemetry/opentelemetry-collector` repository but,
139+
# # if we need more components like `elasticsearch` we should use `otel/opentelemetry-collector-contrib` image of `https://github.com/open-telemetry/opentelemetry-collector-contrib` repository.
140+
# #######################################################
141+
otel-collector:
142+
image: otel/opentelemetry-collector-contrib:latest
143+
container_name: otel-collector
144+
restart: unless-stopped
145+
command: ["--config=/etc/otelcol-contrib/config.yaml"]
146+
volumes:
147+
- ./../configs/otel-collector-config.yaml:/etc/otelcol-contrib/config.yaml
148+
ports:
149+
- "11888:1888" # pprof extension
150+
- "8888:8888" # Prometheus metrics exposed by the Collector
151+
- "8889:8889" # Prometheus exporter metrics
152+
- "13133:13133" # health_check extension
153+
- "4317:4317" # OTLP gRPC receiver
154+
- "4318:4318" # OTLP http receiver
155+
- "55679:55679" # zpages extension
156+
networks:
157+
- infrastructure
158+
159+
160+
# #######################################################
161+
# # prometheus
162+
# # https://prometheus.io/docs/introduction/first_steps/
163+
# # https://prometheus.io/docs/prometheus/3.1/installation/
164+
# # https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/prometheus-config-examples/docker-compose-linux/
165+
# #######################################################
166+
prometheus:
167+
image: prom/prometheus:latest
168+
restart: unless-stopped
169+
ports:
170+
- "9090:9090"
171+
volumes:
172+
- ./../configs/prometheus.yaml:/etc/prometheus/prometheus.yml
173+
# to passe one flag, such as "--log.level=debug" or "--web.enable-remote-write-receiver", we need to override the whole command, as we can't just pass one extra argument
174+
command:
175+
- "--config.file=/etc/prometheus/prometheus.yml"
176+
- "--storage.tsdb.path=/prometheus"
177+
- "--web.console.libraries=/usr/share/prometheus/console_libraries"
178+
- "--web.console.templates=/usr/share/prometheus/consoles"
179+
# need this for the OpenTelemetry collector to be able to put metrics into Prometheus
180+
- "--web.enable-remote-write-receiver"
181+
# - "--log.level=debug"
182+
networks:
183+
- infrastructure
184+
185+
186+
# #######################################################
187+
# # node-exporter
188+
# # https://prometheus.io/docs/guides/node-exporter/
189+
# # https://grafana.com/docs/grafana-cloud/send-data/metrics/metrics-prometheus/prometheus-config-examples/docker-compose-linux/
190+
# #######################################################
191+
node-exporter:
192+
image: prom/node-exporter:latest
193+
container_name: node-exporter
194+
restart: unless-stopped
195+
volumes:
196+
- /proc:/host/proc:ro
197+
- /sys:/host/sys:ro
198+
- /:/rootfs:ro
199+
command:
200+
- '--path.procfs=/host/proc'
201+
- '--path.rootfs=/rootfs'
202+
- '--path.sysfs=/host/sys'
203+
ports:
204+
- "9101:9100"
205+
networks:
206+
- infrastructure
207+
208+
209+
# #######################################################
210+
# # grafana
211+
# # https://grafana.com/docs/grafana/latest/administration/provisioning/
212+
# # https://grafana.com/docs/grafana/latest/setup-grafana/installation/docker/
213+
# # https://grafana.com/docs/grafana/latest/setup-grafana/configure-docker/
214+
# # https://github.com/grafana/intro-to-mltp/blob/main/grafana/provisioning/datasources/datasources.yaml
215+
# #######################################################
216+
grafana:
217+
image: grafana/grafana:latest
218+
container_name: grafana
219+
restart: unless-stopped
220+
environment:
221+
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
222+
- GF_SECURITY_ADMIN_USER=admin
223+
- GF_SECURITY_ADMIN_PASSWORD=admin
224+
- GF_FEATURE_TOGGLES_ENABLE=traceqlEditor
225+
# - GF_AUTH_ANONYMOUS_ENABLED=true
226+
# - GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
227+
# - GF_AUTH_DISABLE_LOGIN_FORM=true
228+
depends_on:
229+
- prometheus
230+
ports:
231+
- "3000:3000"
232+
volumes:
233+
- ./../configs/grafana/provisioning:/etc/grafana/provisioning
234+
- ./../configs/grafana/dashboards:/var/lib/grafana/dashboards
235+
## https://grafana.com/docs/grafana/latest/setup-grafana/configure-grafana/
236+
# - ./../configs/grafana/grafana.ini:/etc/grafana/grafana.ini
237+
networks:
238+
- infrastructure
239+
240+
241+
# #######################################################
242+
# # tempo
243+
# # https://github.com/grafana/tempo/blob/main/example/docker-compose/otel-collector/docker-compose.yaml
244+
# # https://github.com/grafana/tempo/blob/main/example/docker-compose/shared
245+
# # https://github.com/grafana/tempo/blob/main/example/docker-compose/local
246+
# # https://github.com/grafana/tempo/tree/main/example/docker-compose
247+
# #######################################################
248+
tempo:
249+
image: grafana/tempo:latest
250+
container_name: tempo
251+
restart: unless-stopped
252+
command: [ "-config.file=/etc/tempo.yaml" ]
253+
volumes:
254+
- ./../configs/tempo.yaml:/etc/tempo.yaml
255+
ports:
256+
- "3200" # tempo
257+
- "24317:4317" # otlp grpc
258+
- "24318:4318" # otlp http
259+
networks:
260+
- infrastructure
261+
262+
263+
# #######################################################
264+
# # loki
265+
# # https://grafana.com/docs/opentelemetry/collector/send-logs-to-loki/
266+
# # https://github.com/grafana/loki/blob/main/production/docker-compose.yaml
267+
# # https://github.com/grafana/loki/blob/main/examples/getting-started/docker-compose.yaml
268+
# #######################################################
269+
loki:
270+
image: grafana/loki:latest
271+
hostname: loki
272+
container_name: loki
273+
ports:
274+
- "3100:3100"
275+
command: -config.file=/etc/loki/local-config.yaml
276+
volumes:
277+
- ./../configs/loki-config.yaml:/etc/loki/local-config.yaml
278+
networks:
279+
- infrastructure
280+
281+
282+
# #######################################################
283+
# # elasticsearch
284+
# # https://www.elastic.co/guide/en/elasticsearch/reference/7.17/docker.html#docker-compose-file
285+
# #######################################################
286+
elasticsearch:
287+
container_name: elasticsearch
288+
restart: unless-stopped
289+
image: docker.elastic.co/elasticsearch/elasticsearch:8.17.0
290+
environment:
291+
- discovery.type=single-node
292+
- cluster.name=docker-cluster
293+
- node.name=docker-node
294+
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
295+
- xpack.security.enabled=false
296+
- xpack.security.http.ssl.enabled=false
297+
- xpack.security.transport.ssl.enabled=false
298+
- network.host=0.0.0.0
299+
- http.port=9200
300+
- transport.host=localhost
301+
- bootstrap.memory_lock=true
302+
- cluster.routing.allocation.disk.threshold_enabled=false
303+
ulimits:
304+
memlock:
305+
soft: -1
306+
hard: -1
307+
volumes:
308+
- elastic-data:/usr/share/elasticsearch/data
309+
ports:
310+
- ${ELASTIC_HOST_PORT:-9200}:${ELASTIC_PORT:-9200}
311+
- 9300:9300
312+
networks:
313+
- infrastructure
314+
315+
316+
# #######################################################
317+
# # kibana
318+
# # https://www.elastic.co/guide/en/kibana/current/docker.html
319+
# #######################################################
320+
kibana:
321+
image: docker.elastic.co/kibana/kibana:8.17.0
322+
container_name: kibana
323+
restart: unless-stopped
324+
environment:
325+
- ELASTICSEARCH_HOSTS=http://elasticsearch:9200
326+
ports:
327+
- ${KIBANA_HOST_PORT:-5601}:${KIBANA_PORT:-5601}
328+
depends_on:
329+
- elasticsearch
330+
networks:
331+
- infrastructure
332+
333+
334+
# #######################################################
335+
# # cadvisor
336+
# #######################################################
337+
cadvisor:
338+
image: gcr.io/cadvisor/cadvisor:latest
339+
container_name: cadvisor
340+
restart: unless-stopped
341+
ports:
342+
- "8080:8080"
343+
volumes:
344+
- /:/rootfs:ro
345+
- /var/run:/var/run:ro
346+
- /sys:/sys:ro
347+
- /var/lib/docker/:/var/lib/docker:ro
348+
- /dev/disk/:/dev/disk:ro
349+
devices:
350+
- /dev/kmsg
351+
networks:
352+
- infrastructure
353+
354+
355+
networks:
356+
infrastructure:
357+
name: infrastructure
358+
driver: bridge
359+
360+
volumes:
361+
postgres-data:

0 commit comments

Comments
 (0)