-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
168 lines (161 loc) · 5.47 KB
/
Copy pathdocker-compose.yml
File metadata and controls
168 lines (161 loc) · 5.47 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
161
162
163
164
165
166
167
168
services:
# ---------------------------------------------------------------------------
# Zookeeper — Kafka coordination
# ---------------------------------------------------------------------------
zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
hostname: zookeeper
container_name: sentinel-zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
healthcheck:
test: ["CMD", "bash", "-c", "echo srvr | nc localhost 2181 | grep -q Mode"]
interval: 10s
timeout: 5s
retries: 5
start_period: 15s
# ---------------------------------------------------------------------------
# Kafka — single broker (local dev)
# ---------------------------------------------------------------------------
kafka:
image: confluentinc/cp-kafka:7.5.0
hostname: kafka
container_name: sentinel-kafka
depends_on:
zookeeper:
condition: service_healthy
ports:
- "9092:9092"
- "9093:9093"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_LISTENERS: INTERNAL://0.0.0.0:9093,EXTERNAL://0.0.0.0:9092
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9093,EXTERNAL://localhost:9092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
KAFKA_AUTO_CREATE_TOPICS_ENABLE: "false"
KAFKA_LOG_RETENTION_HOURS: 72
KAFKA_LOG_SEGMENT_BYTES: 1073741824
KAFKA_NUM_PARTITIONS: 12
healthcheck:
test: ["CMD-SHELL", "kafka-broker-api-versions --bootstrap-server kafka:9093 > /dev/null 2>&1"]
interval: 15s
timeout: 15s
retries: 15
start_period: 30s
# ---------------------------------------------------------------------------
# Confluent Schema Registry
# ---------------------------------------------------------------------------
schema-registry:
image: confluentinc/cp-schema-registry:7.5.0
hostname: schema-registry
container_name: sentinel-schema-registry
depends_on:
kafka:
condition: service_healthy
ports:
- "8081:8081"
environment:
SCHEMA_REGISTRY_HOST_NAME: schema-registry
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: kafka:9093
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8081/subjects"]
interval: 10s
timeout: 5s
retries: 10
# ---------------------------------------------------------------------------
# Redis
# ---------------------------------------------------------------------------
redis:
image: redis:7.2-alpine
hostname: redis
container_name: sentinel-redis
ports:
- "6379:6379"
command: >
redis-server
--maxmemory 2gb
--maxmemory-policy noeviction
--appendonly no
--save ""
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 10
# ---------------------------------------------------------------------------
# PostgreSQL
# ---------------------------------------------------------------------------
postgres:
image: postgres:16-alpine
hostname: postgres
container_name: sentinel-postgres
ports:
- "5432:5432"
environment:
POSTGRES_DB: sentinelswitch
POSTGRES_USER: sentinel
POSTGRES_PASSWORD: sentinel_local_secret
volumes:
- sentinel-postgres-data:/var/lib/postgresql/data
- ./db/migrations:/docker-entrypoint-initdb.d:ro
healthcheck:
test: ["CMD-SHELL", "pg_isready -U sentinel -d sentinelswitch"]
interval: 10s
timeout: 5s
retries: 10
# ---------------------------------------------------------------------------
# Prometheus
# ---------------------------------------------------------------------------
prometheus:
image: prom/prometheus:v2.48.1
hostname: prometheus
container_name: sentinel-prometheus
ports:
- "9090:9090"
volumes:
- ./infra/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml:ro
- sentinel-prometheus-data:/prometheus
command:
- "--config.file=/etc/prometheus/prometheus.yml"
- "--storage.tsdb.path=/prometheus"
- "--storage.tsdb.retention.time=15d"
- "--web.enable-lifecycle"
healthcheck:
test: ["CMD", "wget", "-qO-", "http://localhost:9090/-/healthy"]
interval: 15s
timeout: 5s
retries: 5
# ---------------------------------------------------------------------------
# Grafana
# ---------------------------------------------------------------------------
grafana:
image: grafana/grafana:10.2.2
hostname: grafana
container_name: sentinel-grafana
depends_on:
- prometheus
ports:
- "3000:3000"
environment:
GF_SECURITY_ADMIN_USER: admin
GF_SECURITY_ADMIN_PASSWORD: sentinel_grafana
GF_AUTH_ANONYMOUS_ENABLED: "false"
volumes:
- sentinel-grafana-data:/var/lib/grafana
- ./infra/grafana/provisioning:/etc/grafana/provisioning:ro
# ---------------------------------------------------------------------------
# Named volumes — must be declared here
# ---------------------------------------------------------------------------
volumes:
sentinel-postgres-data:
sentinel-prometheus-data:
sentinel-grafana-data: