This repository was archived by the owner on Sep 16, 2026. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
122 lines (115 loc) · 3.91 KB
/
Copy pathdocker-compose.yml
File metadata and controls
122 lines (115 loc) · 3.91 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
services:
zookeeper:
image: confluentinc/cp-zookeeper:7.3.3
container_name: zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
kafka:
image: confluentinc/cp-kafka:7.3.3
container_name: kafka
ports:
- "9092:9092" # For internal Docker network
- "29092:29092" # For host access
depends_on:
- zookeeper
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 # for single broker cluster
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 # for single broker cluster
healthcheck:
test: ["CMD-SHELL", "kafka-topics --bootstrap-server kafka:9092 --list || exit 1"]
interval: 10s
timeout: 5s
retries: 5
postgres_db_main:
image: postgres:15-alpine
container_name: postgres_db_main
ports:
- "5432:5432"
environment:
POSTGRES_USER: ${POSTGRES_USER_MAIN:-user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD_MAIN:?set POSTGRES_PASSWORD_MAIN in .env (see .env.example)}
POSTGRES_DB: ${POSTGRES_DB_MAIN:-mahasiswa_db}
volumes:
- postgres_main_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U user -d mahasiswa_db"]
interval: 10s
timeout: 5s
retries: 5
postgres_db_log:
image: postgres:15-alpine
container_name: postgres_db_log
ports:
- "5433:5432" # Different host port
environment:
POSTGRES_USER: ${POSTGRES_USER_LOG:-log_user}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD_LOG:?set POSTGRES_PASSWORD_LOG in .env (see .env.example)}
POSTGRES_DB: ${POSTGRES_DB_LOG:-log_db}
volumes:
- postgres_log_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U log_user -d log_db"]
interval: 10s
timeout: 5s
retries: 5
rest_api:
build:
context: .
dockerfile: ./api-service/Dockerfile
container_name: api-service
ports:
- "3000:3000"
depends_on:
postgres_db_main:
condition: service_healthy
kafka:
condition: service_healthy
environment:
PORT: 3000
DATABASE_URL: ${DATABASE_URL:?set DATABASE_URL in .env (see .env.example)}
KAFKA_BROKERS: ${KAFKA_BROKERS:-kafka:9092} # Use internal Docker DNS name
KAFKA_TOPIC: ${KAFKA_TOPIC:-mahasiswa_events}
KAFKA_CLIENT_ID: mahasiswa-api-producer-compose
OUTBOX_POLL_MS: ${OUTBOX_POLL_MS:-1000}
consumer_service:
build:
context: .
dockerfile: ./consumer-service/Dockerfile
container_name: consumer_service_mahasiswa
depends_on:
postgres_db_log:
condition: service_healthy
kafka:
condition: service_healthy
environment:
LOG_DATABASE_URL: ${LOG_DATABASE_URL:?set LOG_DATABASE_URL in .env (see .env.example)}
KAFKA_BROKERS: ${KAFKA_BROKERS:-kafka:9092} # Use internal Docker DNS name
KAFKA_TOPIC: ${KAFKA_TOPIC:-mahasiswa_events}
KAFKA_CONSUMER_GROUP: log_processors_group_compose
KAFKA_CONSUME_FROM_BEGINNING: "true"
ports:
- "9400:9400"
frontend:
build:
context: .
dockerfile: ./frontend/mahasiswa-app-frontend/Dockerfile
container_name: frontend_mahasiswa
ports:
- "8080:80"
volumes:
- ./frontend/mahasiswa-app-frontend/nginx-local.conf:/etc/nginx/conf.d/nginx.conf:ro
depends_on:
- rest_api
volumes:
postgres_main_data:
postgres_log_data: