-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.infra.yml
More file actions
160 lines (142 loc) · 3.83 KB
/
Copy pathdocker-compose.infra.yml
File metadata and controls
160 lines (142 loc) · 3.83 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
version: "3.9"
networks:
smartcart-network:
name: smartcart-network
driver: bridge
volumes:
postgres_data:
mongo_data:
kafka_data:
grafana_data:
services:
# ---------------------------
# DATABASES
# ---------------------------
postgres:
image: postgres:16-alpine
container_name: smartcart-postgres
restart: unless-stopped
environment:
POSTGRES_USER: ${POSTGRES_USER}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD}
ports:
- "${POSTGRES_PORT}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
- ./postgres-init:/docker-entrypoint-initdb.d
networks:
- smartcart-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"]
interval: 10s
retries: 5
mongodb:
image: mongo:7
container_name: smartcart-mongodb
restart: unless-stopped
ports:
- "${MONGO_PORT}:27017"
volumes:
- mongo_data:/data/db
networks:
- smartcart-network
healthcheck:
test: [ "CMD-SHELL", "echo 'db.runCommand(\"ping\").ok' | mongosh localhost:27017/test --quiet" ]
interval: 10s
retries: 5
redis:
image: redis:7-alpine
container_name: smartcart-redis
restart: unless-stopped
ports:
- "${REDIS_PORT}:6379"
networks:
- smartcart-network
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 10s
retries: 5
# ---------------------------
# KAFKA (KRaft mode - modern)
# ---------------------------
kafka:
image: apache/kafka:3.7.0
container_name: smartcart-kafka
restart: unless-stopped
ports:
- "9092:9092"
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
KAFKA_LISTENERS: INTERNAL://0.0.0.0:29092,EXTERNAL://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:29092,EXTERNAL://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
volumes:
- kafka_data:/tmp/kraft-combined-logs
networks:
- smartcart-network
healthcheck:
test: [ "CMD-SHELL", "nc -z localhost ${KAFKA_PORT}" ]
interval: 15s
timeout: 5s
retries: 5
akhq:
image: tchiotludo/akhq:0.24.0
container_name: smartcart-akhq
restart: unless-stopped
ports:
- "9191:8080"
environment:
AKHQ_CONFIGURATION: |
akhq:
server:
access-log:
enabled: false
connections:
smartcart:
properties:
bootstrap.servers: "kafka:29092"
depends_on:
kafka:
condition: service_healthy
networks:
- smartcart-network
# ---------------------------
# MONITORING
# ---------------------------
prometheus:
image: prom/prometheus:v2.48.1
container_name: smartcart-prometheus
ports:
- "${PROMETHEUS_PORT}:9090"
volumes:
- ${PROM_CONFIG_FILE}:/etc/prometheus/prometheus.yml
networks:
- smartcart-network
grafana:
image: grafana/grafana:10.2.2
container_name: smartcart-grafana
ports:
- "${GRAFANA_PORT}:${GRAFANA_PORT}"
volumes:
- grafana_data:/var/lib/grafana
networks:
- smartcart-network
# ---------------------------
# DISTRIBUTED TRACING
# ---------------------------
zipkin:
image: openzipkin/zipkin:3
container_name: smartcart-zipkin
restart: unless-stopped
ports:
- "9411:9411"
networks:
- smartcart-network