mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-09 01:49:37 -06:00
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.
This commit is contained in:
parent
dfea584aa7
commit
6c150eed6d
@ -1,3 +1,7 @@
|
||||
# 2.3.5 (develop)
|
||||
|
||||
###
|
||||
|
||||
# 2.3.4 (2025-09-23)
|
||||
|
||||
### Features
|
||||
|
||||
139
Docker/kafka/README.md
Normal file
139
Docker/kafka/README.md
Normal file
@ -0,0 +1,139 @@
|
||||
# Kafka Docker Setup for Evolution API
|
||||
|
||||
This directory contains the Docker Compose configuration for running Apache Kafka locally for development and testing with Evolution API.
|
||||
|
||||
## Services
|
||||
|
||||
### Zookeeper
|
||||
- **Container**: `zookeeper`
|
||||
- **Image**: `confluentinc/cp-zookeeper:7.5.0`
|
||||
- **Port**: `2181`
|
||||
- **Purpose**: Coordination service for Kafka cluster
|
||||
|
||||
### Kafka
|
||||
- **Container**: `kafka`
|
||||
- **Image**: `confluentinc/cp-kafka:7.5.0`
|
||||
- **Ports**:
|
||||
- `9092` - PLAINTEXT_HOST (localhost access)
|
||||
- `29092` - PLAINTEXT (internal container access)
|
||||
- `9094` - OUTSIDE (external Docker access)
|
||||
- **Purpose**: Message broker for event streaming
|
||||
|
||||
## Quick Start
|
||||
|
||||
### 1. Start Kafka Services
|
||||
```bash
|
||||
cd Docker/kafka
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
### 2. Verify Services
|
||||
```bash
|
||||
# Check if containers are running
|
||||
docker-compose ps
|
||||
|
||||
# Check Kafka logs
|
||||
docker-compose logs kafka
|
||||
|
||||
# Check Zookeeper logs
|
||||
docker-compose logs zookeeper
|
||||
```
|
||||
|
||||
### 3. Test Kafka Connection
|
||||
```bash
|
||||
# Create a test topic
|
||||
docker exec kafka kafka-topics --create --topic test-topic --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
|
||||
|
||||
# List topics
|
||||
docker exec kafka kafka-topics --list --bootstrap-server localhost:9092
|
||||
|
||||
# Produce messages
|
||||
docker exec -it kafka kafka-console-producer --topic test-topic --bootstrap-server localhost:9092
|
||||
|
||||
# Consume messages (in another terminal)
|
||||
docker exec -it kafka kafka-console-consumer --topic test-topic --from-beginning --bootstrap-server localhost:9092
|
||||
```
|
||||
|
||||
## Evolution API Integration
|
||||
|
||||
### Environment Variables
|
||||
Configure these variables in your Evolution API `.env` file:
|
||||
|
||||
```bash
|
||||
# Kafka Configuration
|
||||
KAFKA_ENABLED=true
|
||||
KAFKA_CLIENT_ID=evolution-api
|
||||
KAFKA_BROKERS=localhost:9092
|
||||
KAFKA_GLOBAL_ENABLED=true
|
||||
KAFKA_CONSUMER_GROUP_ID=evolution-api-consumers
|
||||
KAFKA_TOPIC_PREFIX=evolution
|
||||
KAFKA_AUTO_CREATE_TOPICS=true
|
||||
|
||||
# Event Configuration
|
||||
KAFKA_EVENTS_APPLICATION_STARTUP=true
|
||||
KAFKA_EVENTS_INSTANCE_CREATE=true
|
||||
KAFKA_EVENTS_MESSAGES_UPSERT=true
|
||||
# ... other events as needed
|
||||
```
|
||||
|
||||
### Connection Endpoints
|
||||
- **From Evolution API**: `localhost:9092`
|
||||
- **From other Docker containers**: `kafka:29092`
|
||||
- **From external applications**: `host.docker.internal:9094`
|
||||
|
||||
## Data Persistence
|
||||
|
||||
Data is persisted in Docker volumes:
|
||||
- `zookeeper_data`: Zookeeper data and logs
|
||||
- `kafka_data`: Kafka topic data and logs
|
||||
|
||||
## Network
|
||||
|
||||
Services run on the `evolution-net` network, allowing integration with other Evolution API services.
|
||||
|
||||
## Stopping Services
|
||||
|
||||
```bash
|
||||
# Stop services
|
||||
docker-compose down
|
||||
|
||||
# Stop and remove volumes (WARNING: This will delete all data)
|
||||
docker-compose down -v
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Connection Issues
|
||||
1. Ensure ports 2181, 9092, 29092, and 9094 are not in use
|
||||
2. Check if Docker network `evolution-net` exists
|
||||
3. Verify firewall settings allow connections to these ports
|
||||
|
||||
### Performance Tuning
|
||||
The configuration includes production-ready settings:
|
||||
- Log retention: 7 days (168 hours)
|
||||
- Compression: gzip
|
||||
- Auto-topic creation enabled
|
||||
- Optimized segment and retention settings
|
||||
|
||||
### Logs
|
||||
```bash
|
||||
# View all logs
|
||||
docker-compose logs
|
||||
|
||||
# Follow logs in real-time
|
||||
docker-compose logs -f
|
||||
|
||||
# View specific service logs
|
||||
docker-compose logs kafka
|
||||
docker-compose logs zookeeper
|
||||
```
|
||||
|
||||
## Integration with Evolution API
|
||||
|
||||
Once Kafka is running, Evolution API will automatically:
|
||||
1. Connect to Kafka on startup (if `KAFKA_ENABLED=true`)
|
||||
2. Create topics based on `KAFKA_TOPIC_PREFIX`
|
||||
3. Start producing events to configured topics
|
||||
4. Handle consumer groups for reliable message processing
|
||||
|
||||
For more details on Kafka integration, see the main Evolution API documentation.
|
||||
51
Docker/kafka/docker-compose.yaml
Normal file
51
Docker/kafka/docker-compose.yaml
Normal file
@ -0,0 +1,51 @@
|
||||
version: '3.3'
|
||||
|
||||
services:
|
||||
zookeeper:
|
||||
container_name: zookeeper
|
||||
image: confluentinc/cp-zookeeper:7.5.0
|
||||
environment:
|
||||
- ZOOKEEPER_CLIENT_PORT=2181
|
||||
- ZOOKEEPER_TICK_TIME=2000
|
||||
- ZOOKEEPER_SYNC_LIMIT=2
|
||||
volumes:
|
||||
- zookeeper_data:/var/lib/zookeeper/
|
||||
ports:
|
||||
- 2181:2181
|
||||
|
||||
kafka:
|
||||
container_name: kafka
|
||||
image: confluentinc/cp-kafka:7.5.0
|
||||
depends_on:
|
||||
- zookeeper
|
||||
environment:
|
||||
- KAFKA_BROKER_ID=1
|
||||
- KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181
|
||||
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT,OUTSIDE:PLAINTEXT
|
||||
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092,OUTSIDE://host.docker.internal:9094
|
||||
- KAFKA_INTER_BROKER_LISTENER_NAME=PLAINTEXT
|
||||
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
|
||||
- KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=1
|
||||
- KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=1
|
||||
- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0
|
||||
- KAFKA_AUTO_CREATE_TOPICS_ENABLE=true
|
||||
- KAFKA_LOG_RETENTION_HOURS=168
|
||||
- KAFKA_LOG_SEGMENT_BYTES=1073741824
|
||||
- KAFKA_LOG_RETENTION_CHECK_INTERVAL_MS=300000
|
||||
- KAFKA_COMPRESSION_TYPE=gzip
|
||||
ports:
|
||||
- 29092:29092
|
||||
- 9092:9092
|
||||
- 9094:9094
|
||||
volumes:
|
||||
- kafka_data:/var/lib/kafka/data
|
||||
|
||||
volumes:
|
||||
zookeeper_data:
|
||||
kafka_data:
|
||||
|
||||
|
||||
networks:
|
||||
evolution-net:
|
||||
name: evolution-net
|
||||
driver: bridge
|
||||
@ -2,7 +2,7 @@ version: "3.7"
|
||||
|
||||
services:
|
||||
evolution_v2:
|
||||
image: evoapicloud/evolution-api:v2.3.1
|
||||
image: evoapicloud/evolution-api:v2.3.5
|
||||
volumes:
|
||||
- evolution_instances:/evolution/instances
|
||||
networks:
|
||||
|
||||
@ -15,6 +15,16 @@ services:
|
||||
expose:
|
||||
- 8080
|
||||
|
||||
frontend:
|
||||
container_name: evolution_frontend
|
||||
image: evolution/manager:local
|
||||
build: ./evolution-manager-v2
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:80"
|
||||
networks:
|
||||
- evolution-net
|
||||
|
||||
volumes:
|
||||
evolution_instances:
|
||||
|
||||
|
||||
@ -20,6 +20,15 @@ services:
|
||||
expose:
|
||||
- "8080"
|
||||
|
||||
frontend:
|
||||
container_name: evolution_frontend
|
||||
image: evoapicloud/evolution-manager:latest
|
||||
restart: always
|
||||
ports:
|
||||
- "3000:80"
|
||||
networks:
|
||||
- evolution-net
|
||||
|
||||
redis:
|
||||
container_name: evolution_redis
|
||||
image: redis:latest
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit fcb38dd407b89697b7a7154cfd873f76729e6ece
|
||||
Subproject commit e510b5f17fc75cbddeaaba102ddd568e4b127455
|
||||
Loading…
Reference in New Issue
Block a user