-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.infra.yaml
More file actions
124 lines (112 loc) · 3.62 KB
/
docker-compose.infra.yaml
File metadata and controls
124 lines (112 loc) · 3.62 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
# ============================================
# INFRA_HOST: Set this in .env to your machine's IP/hostname when running
# infrastructure on a separate system from application services.
# Default: host.docker.internal (for same-system deployment)
# ============================================
services:
# ============================================
# Infrastructure Services
# ============================================
mongo:
image: mongo:7.0
container_name: mongo
command: [ "--replSet", "rs0", "--bind_ip_all", "--port", "27017" ]
ports:
- 27017:27017
extra_hosts:
- "host.docker.internal:host-gateway"
healthcheck:
test: echo "try { rs.status() } catch (err) { rs.initiate({_id:'rs0',members:[{_id:0,host:'${INFRA_HOST:-host.docker.internal}:27017'}]}) }" | mongosh --port 27017 --quiet
interval: 5s
timeout: 30s
start_period: 0s
start_interval: 1s
retries: 30
volumes:
- "mongo_data:/data/db"
- "mongo_config:/data/configdb"
kafka:
image: apache/kafka-native
container_name: kafka
ports:
- "9092:9092"
environment:
# Configure listeners for both docker and host communication
KAFKA_LISTENERS: CONTROLLER://localhost:9091,HOST://0.0.0.0:9092,DOCKER://0.0.0.0:9093
KAFKA_ADVERTISED_LISTENERS: HOST://${INFRA_HOST:-host.docker.internal}:9092,DOCKER://kafka:9093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,DOCKER:PLAINTEXT,HOST:PLAINTEXT
# Settings required for KRaft mode
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@localhost:9091
# Listener to use for broker-to-broker communication
KAFKA_INTER_BROKER_LISTENER_NAME: DOCKER
# Required for a single node cluster
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
# Disable auto-topic creation - API server will create topics with correct partitions
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
volumes:
- "kafka_data:/var/lib/kafka/data"
kafka-ui:
image: kafbat/kafka-ui:main
container_name: kafka-ui
ports:
- 8080:8080
environment:
DYNAMIC_CONFIG_ENABLED: "true"
KAFKA_CLUSTERS_0_NAME: local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9093
depends_on:
- kafka
redis:
image: redis:7-alpine
container_name: redis
ports:
- "6379:6379"
command: redis-server --appendonly yes
volumes:
- "redis_data:/data"
healthcheck:
test: [ "CMD", "redis-cli", "ping" ]
interval: 5s
timeout: 3s
retries: 5
# ============================================
# Observability Services
# ============================================
loki:
image: grafana/loki:2.9.0
container_name: loki
ports:
- "3100:3100"
command: -config.file=/etc/loki/local-config.yaml
volumes:
- "loki_data:/loki"
healthcheck:
test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ]
interval: 10s
timeout: 5s
retries: 5
grafana:
image: grafana/grafana:10.2.0
container_name: grafana
ports:
- "3001:3000"
environment:
- GF_PATHS_PROVISIONING=/etc/grafana/provisioning
- GF_AUTH_ANONYMOUS_ENABLED=true
- GF_AUTH_ANONYMOUS_ORG_ROLE=Admin
- GF_SECURITY_ADMIN_PASSWORD=admin
volumes:
- "grafana_data:/var/lib/grafana"
depends_on:
loki:
condition: service_healthy
volumes:
mongo_data:
mongo_config:
kafka_data:
redis_data:
loki_data:
grafana_data: