-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
125 lines (111 loc) · 4.01 KB
/
docker-compose.yml
File metadata and controls
125 lines (111 loc) · 4.01 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
services:
mysql:
image: mysql:8.3.0
container_name: mysql
restart: always
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: watt_tracker_db
ports:
- "3306:3306"
volumes:
- ./docker/mysql/init.sql:/docker-entrypoint-initdb.d/init.sql
- db-data:/var/lib/mysql
kafka:
container_name: kafka
image: apache/kafka:latest
ports:
- "9092:9092" # Internal listener (Docker network)
- "9094:9094" # External listener (host machine)
environment:
############################################
# KRaft Metadata & Node Identity
############################################
# Unique ID for this Kafka node
KAFKA_NODE_ID: 1
# Unique Kafka cluster identifier (required for KRaft mode)
KAFKA_CLUSTER_ID: 'energy-tracker-cluster-1'
# Node roles — this instance will act as BOTH a broker and controller
KAFKA_PROCESS_ROLES: 'broker,controller'
############################################
# Controller Quorum Configuration (Raft)
############################################
# List of controller nodes that form the Raft quorum
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:9093'
# Listener name used by controllers for internal Raft communication
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER'
############################################
# Network Listeners (Internal, External & Controller)
############################################
# Define all listener endpoints for this Kafka node
KAFKA_LISTENERS: >
PLAINTEXT://0.0.0.0:9092,
EXTERNAL://0.0.0.0:9094,
CONTROLLER://0.0.0.0:9093
# What each listener advertises to connecting clients
# Internal (Docker containers): kafka:9092
# External (host machine): localhost:9094
KAFKA_ADVERTISED_LISTENERS: >
PLAINTEXT://kafka:9092,
EXTERNAL://localhost:9094
# Maps listener names to their security protocols
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: >
CONTROLLER:PLAINTEXT,
PLAINTEXT:PLAINTEXT,
EXTERNAL:PLAINTEXT
# Which listener brokers should use for internal communication
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT'
############################################
# Single-Node Cluster Safety Settings
# (because replication >1 would break)
############################################
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
############################################
# Broker Defaults & Quality-of-Life Settings
############################################
# Speed up consumer group startup
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
# Auto-create topics if they don't already exist
KAFKA_AUTO_CREATE_TOPICS_ENABLE: 'true'
# Default number of partitions per topic
KAFKA_NUM_PARTITIONS: 1
volumes:
- ./docker/kafka_data:/var/lib/kafka/data
kafka-ui:
container_name: kafka-ui
image: ghcr.io/kafbat/kafka-ui:latest
ports:
- "8070:8080"
depends_on:
- kafka
environment:
KAFKA_CLUSTERS_0_NAME: local
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:9092 # Use internal Docker network name
DYNAMIC_CONFIG_ENABLED: 'true'
restart: unless-stopped
influxdb:
image: influxdb:2.7
container_name: influxdb
ports:
- "8072:8086"
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=admin
- DOCKER_INFLUXDB_INIT_PASSWORD=admin123
- DOCKER_INFLUXDB_INIT_ORG=watt-tracker
- DOCKER_INFLUXDB_INIT_BUCKET=usage-bucket
- DOCKER_INFLUXDB_INIT_RETENTION=1w
- DOCKER_INFLUXDB_INIT_ADMIN_TOKEN=my-token
volumes:
- ./influxdb_data:/var/lib/influxdb2
mailpit:
image: axllent/mailpit:latest
container_name: mailpit
ports:
- "8025:8025"
- "1025:1025"
volumes:
db-data:
kafka-data: