-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.dev.yml
More file actions
98 lines (93 loc) · 3.04 KB
/
docker-compose.dev.yml
File metadata and controls
98 lines (93 loc) · 3.04 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
services:
mongodb:
image: mongo
ports:
- "8100:27017"
volumes:
- ./data/mongo:/data/db
healthcheck:
test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand('ping')"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
redis:
image: redis:alpine
ports:
- "8101:6379"
command: ["redis-server", "--appendonly", "yes"]
volumes:
- ./data/redis:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 3
start_period: 5s
server:
build:
context: .
dockerfile: docker/Dockerfile.dev
ports:
- "${SERVER_PORT:-8002}:${SERVER_PORT:-8002}"
depends_on:
mongodb:
condition: service_healthy
redis:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
environment:
- MONGO_URI=${MONGO_URI:-mongodb://mongodb:27017}
- REDIS_ADDR=${REDIS_ADDR:-redis:6379}
- KAFKA_BROKER=${KAFKA_BROKER:-kafka:29092}
- KAFKA_TOPIC=${KAFKA_TOPIC:-registrations}
- KAFKA_GROUP_ID=${KAFKA_GROUP_ID:-registration-consumers}
- SERVER_PORT=${SERVER_PORT:-8002}
- CLIENT_URL=${CLIENT_URL:-http://localhost:3000}
- CLIENT_API_URL=${CLIENT_API_URL:-http://host.docker.internal:8080}
- AUTO_MIGRATE_ENABLED=${AUTO_MIGRATE_ENABLED:-true}
- AUTO_MIGRATE_INTERVAL_HOURS=${AUTO_MIGRATE_INTERVAL_HOURS:-24}
volumes:
- .:/app
- go-mod-cache:/go/pkg/mod
command: ["air", "-c", ".air.toml"]
kafka:
image: apache/kafka:3.8.0
container_name: kafka
ports:
- "9092:9092"
environment:
- KAFKA_NODE_ID=1
- KAFKA_PROCESS_ROLES=broker,controller
- KAFKA_LISTENERS=PLAINTEXT://:29092,CONTROLLER://:29093,PLAINTEXT_HOST://:9092
- KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092
- KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
- KAFKA_CONTROLLER_LISTENER_NAMES=CONTROLLER
- KAFKA_INTER_BROKER_LISTENER_NAME=PLAINTEXT
- KAFKA_CONTROLLER_QUORUM_VOTERS=1@kafka:29093
- KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1
- KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR=1
- KAFKA_TRANSACTION_STATE_LOG_MIN_ISR=1
- KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS=0
- KAFKA_NUM_PARTITIONS=3
healthcheck:
test: ["CMD-SHELL", "/opt/kafka/bin/kafka-broker-api-versions.sh --bootstrap-server localhost:9092 > /dev/null 2>&1"]
interval: 10s
timeout: 5s
retries: 10
start_period: 30s
kafka-init:
image: apache/kafka:3.8.0
container_name: kafka-init
depends_on:
kafka:
condition: service_healthy
entrypoint:
- /bin/bash
- -c
- |
/opt/kafka/bin/kafka-topics.sh --create --topic registrations --bootstrap-server kafka:29092 --partitions 1 --replication-factor 1 --if-not-exists
echo "Topic registrations created or already exists"
volumes:
go-mod-cache: