Skip to content

Commit 6c150ee

Browse files
committed
chore(docker): add Kafka and frontend services to Docker configurations
- Introduced Kafka and Zookeeper services in a new docker-compose file for better message handling. - Added frontend service to both development and production docker-compose files for improved UI management. - Updated evolution-manager-v2 submodule to the latest commit. - Updated CHANGELOG for version 2.3.5 release.
1 parent dfea584 commit 6c150ee

File tree

7 files changed

+215
-2
lines changed

7 files changed

+215
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# 2.3.5 (develop)
2+
3+
###
4+
15
# 2.3.4 (2025-09-23)
26

37
### Features

Docker/kafka/README.md

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
# Kafka Docker Setup for Evolution API
2+
3+
This directory contains the Docker Compose configuration for running Apache Kafka locally for development and testing with Evolution API.
4+
5+
## Services
6+
7+
### Zookeeper
8+
- **Container**: `zookeeper`
9+
- **Image**: `confluentinc/cp-zookeeper:7.5.0`
10+
- **Port**: `2181`
11+
- **Purpose**: Coordination service for Kafka cluster
12+
13+
### Kafka
14+
- **Container**: `kafka`
15+
- **Image**: `confluentinc/cp-kafka:7.5.0`
16+
- **Ports**:
17+
- `9092` - PLAINTEXT_HOST (localhost access)
18+
- `29092` - PLAINTEXT (internal container access)
19+
- `9094` - OUTSIDE (external Docker access)
20+
- **Purpose**: Message broker for event streaming
21+
22+
## Quick Start
23+
24+
### 1. Start Kafka Services
25+
```bash
26+
cd Docker/kafka
27+
docker-compose up -d
28+
```
29+
30+
### 2. Verify Services
31+
```bash
32+
# Check if containers are running
33+
docker-compose ps
34+
35+
# Check Kafka logs
36+
docker-compose logs kafka
37+
38+
# Check Zookeeper logs
39+
docker-compose logs zookeeper
40+
```
41+
42+
### 3. Test Kafka Connection
43+
```bash
44+
# Create a test topic
45+
docker exec kafka kafka-topics --create --topic test-topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
46+
47+
# List topics
48+
docker exec kafka kafka-topics --list --bootstrap-server localhost:9092
49+
50+
# Produce messages
51+
docker exec -it kafka kafka-console-producer --topic test-topic --bootstrap-server localhost:9092
52+
53+
# Consume messages (in another terminal)
54+
docker exec -it kafka kafka-console-consumer --topic test-topic --from-beginning --bootstrap-server localhost:9092
55+
```
56+
57+
## Evolution API Integration
58+
59+
### Environment Variables
60+
Configure these variables in your Evolution API `.env` file:
61+
62+
```bash
63+
# Kafka Configuration
64+
KAFKA_ENABLED=true
65+
KAFKA_CLIENT_ID=evolution-api
66+
KAFKA_BROKERS=localhost:9092
67+
KAFKA_GLOBAL_ENABLED=true
68+
KAFKA_CONSUMER_GROUP_ID=evolution-api-consumers
69+
KAFKA_TOPIC_PREFIX=evolution
70+
KAFKA_AUTO_CREATE_TOPICS=true
71+
72+
# Event Configuration
73+
KAFKA_EVENTS_APPLICATION_STARTUP=true
74+
KAFKA_EVENTS_INSTANCE_CREATE=true
75+
KAFKA_EVENTS_MESSAGES_UPSERT=true
76+
# ... other events as needed
77+
```
78+
79+
### Connection Endpoints
80+
- **From Evolution API**: `localhost:9092`
81+
- **From other Docker containers**: `kafka:29092`
82+
- **From external applications**: `host.docker.internal:9094`
83+
84+
## Data Persistence
85+
86+
Data is persisted in Docker volumes:
87+
- `zookeeper_data`: Zookeeper data and logs
88+
- `kafka_data`: Kafka topic data and logs
89+
90+
## Network
91+
92+
Services run on the `evolution-net` network, allowing integration with other Evolution API services.
93+
94+
## Stopping Services
95+
96+
```bash
97+
# Stop services
98+
docker-compose down
99+
100+
# Stop and remove volumes (WARNING: This will delete all data)
101+
docker-compose down -v
102+
```
103+
104+
## Troubleshooting
105+
106+
### Connection Issues
107+
1. Ensure ports 2181, 9092, 29092, and 9094 are not in use
108+
2. Check if Docker network `evolution-net` exists
109+
3. Verify firewall settings allow connections to these ports
110+
111+
### Performance Tuning
112+
The configuration includes production-ready settings:
113+
- Log retention: 7 days (168 hours)
114+
- Compression: gzip
115+
- Auto-topic creation enabled
116+
- Optimized segment and retention settings
117+
118+
### Logs
119+
```bash
120+
# View all logs
121+
docker-compose logs
122+
123+
# Follow logs in real-time
124+
docker-compose logs -f
125+
126+
# View specific service logs
127+
docker-compose logs kafka
128+
docker-compose logs zookeeper
129+
```
130+
131+
## Integration with Evolution API
132+
133+
Once Kafka is running, Evolution API will automatically:
134+
1. Connect to Kafka on startup (if `KAFKA_ENABLED=true`)
135+
2. Create topics based on `KAFKA_TOPIC_PREFIX`
136+
3. Start producing events to configured topics
137+
4. Handle consumer groups for reliable message processing
138+
139+
For more details on Kafka integration, see the main Evolution API documentation.

Docker/kafka/docker-compose.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
version: '3.3'
2+
3+
services:
4+
zookeeper:
5+
container_name: zookeeper
6+
image: confluentinc/cp-zookeeper:7.5.0
7+
environment:
8+
- ZOOKEEPER_CLIENT_PORT=2181
9+
- ZOOKEEPER_TICK_TIME=2000
10+
- ZOOKEEPER_SYNC_LIMIT=2
11+
volumes:
12+
- zookeeper_data:/var/lib/zookeeper/
13+
ports:
14+
- 2181:2181
15+
16+
kafka:
17+
container_name: kafka
18+
image: confluentinc/cp-kafka:7.5.0
19+
depends_on:
20+
- zookeeper
21+
environment:
22+
- KAFKA_BROKER_ID=1
23+
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
24+
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,OUTSIDE:PLAINTEXT
25+
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092,OUTSIDE://host.docker.internal:9094
26+
- KAFKA_INTER_BROKER_LISTENER_NAME=PLAINTEXT
27+
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
28+
- KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=1
29+
- KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=1
30+
- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0
31+
- KAFKA_AUTO_CREATE_TOPICS_ENABLE=true
32+
- KAFKA_LOG_RETENTION_HOURS=168
33+
- KAFKA_LOG_SEGMENT_BYTES=1073741824
34+
- KAFKA_LOG_RETENTION_CHECK_INTERVAL_MS=300000
35+
- KAFKA_COMPRESSION_TYPE=gzip
36+
ports:
37+
- 29092:29092
38+
- 9092:9092
39+
- 9094:9094
40+
volumes:
41+
- kafka_data:/var/lib/kafka/data
42+
43+
volumes:
44+
zookeeper_data:
45+
kafka_data:
46+
47+
48+
networks:
49+
evolution-net:
50+
name: evolution-net
51+
driver: bridge

Docker/swarm/evolution_api_v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: "3.7"
22

33
services:
44
evolution_v2:
5-
image: evoapicloud/evolution-api:v2.3.1
5+
image: evoapicloud/evolution-api:v2.3.5
66
volumes:
77
- evolution_instances:/evolution/instances
88
networks:

docker-compose.dev.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,16 @@ services:
1515
expose:
1616
- 8080
1717

18+
frontend:
19+
container_name: evolution_frontend
20+
image: evolution/manager:local
21+
build: ./evolution-manager-v2
22+
restart: always
23+
ports:
24+
- "3000:80"
25+
networks:
26+
- evolution-net
27+
1828
volumes:
1929
evolution_instances:
2030

docker-compose.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ services:
2020
expose:
2121
- "8080"
2222

23+
frontend:
24+
container_name: evolution_frontend
25+
image: evoapicloud/evolution-manager:latest
26+
restart: always
27+
ports:
28+
- "3000:80"
29+
networks:
30+
- evolution-net
31+
2332
redis:
2433
container_name: evolution_redis
2534
image: redis:latest

0 commit comments

Comments
 (0)