Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
99 lines (94 loc) · 3.53 KB
/
Copy pathdocker-compose.yml
File metadata and controls
99 lines (94 loc) · 3.53 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
services:
postgres:
image: postgres:17-alpine
restart: unless-stopped
environment:
POSTGRES_USER: blackbox_user
POSTGRES_PASSWORD: ${BLACKBOX_POSTGRES_PASSWORD:?Set BLACKBOX_POSTGRES_PASSWORD in .env}
POSTGRES_DB: blackbox_db
ports:
- "127.0.0.1:${BLACKBOX_POSTGRES_HOST_PORT:-15432}:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U blackbox_user -d blackbox_db"]
interval: 5s
timeout: 5s
retries: 5
kafka:
image: apache/kafka:3.8.0
restart: unless-stopped
ports:
- "127.0.0.1:${BLACKBOX_KAFKA_HOST_PORT:-29092}:29092"
environment:
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: broker,controller
KAFKA_LISTENERS: INTERNAL://:9092,CONTROLLER://:9093,EXTERNAL://:29092
KAFKA_ADVERTISED_LISTENERS: INTERNAL://kafka:9092,EXTERNAL://localhost:29092
KAFKA_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT
KAFKA_CONTROLLER_QUORUM_VOTERS: 1@kafka:9093
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_AUTO_CREATE_TOPICS_ENABLE: "true"
healthcheck:
test: ["CMD", "/opt/kafka/bin/kafka-topics.sh", "--bootstrap-server", "localhost:9092", "--list"]
interval: 10s
timeout: 5s
retries: 5
kafka-init:
image: apache/kafka:3.8.0
entrypoint: ["/bin/bash", "-ec"]
command:
- |
/opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic blackbox.workflow.events --partitions 1 --replication-factor 1
/opt/kafka/bin/kafka-topics.sh --bootstrap-server kafka:9092 --create --if-not-exists --topic blackbox.resource.events --partitions 1 --replication-factor 1
depends_on:
kafka:
condition: service_healthy
api:
build:
context: .
dockerfile: src/Blackbox.Api/Dockerfile
restart: unless-stopped
ports:
- "127.0.0.1:${BLACKBOX_API_PORT:-5000}:8080"
environment:
ASPNETCORE_ENVIRONMENT: "Development"
ConnectionStrings__DefaultConnection: "Host=postgres;Port=5432;Database=blackbox_db;Username=blackbox_user;Password=${BLACKBOX_POSTGRES_PASSWORD:?Set BLACKBOX_POSTGRES_PASSWORD in .env}"
Kafka__BootstrapServers: "kafka:9092"
Security__ApiKey: "${BLACKBOX_API_KEY:?Set BLACKBOX_API_KEY in .env}"
depends_on:
postgres:
condition: service_healthy
kafka:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "wget -q -O - http://127.0.0.1:8080/health/ready >/dev/null || exit 1"]
interval: 5s
timeout: 3s
retries: 20
start_period: 10s
worker:
build:
context: .
dockerfile: src/Blackbox.Worker/Dockerfile
restart: unless-stopped
environment:
DOTNET_ENVIRONMENT: "Development"
ConnectionStrings__DefaultConnection: "Host=postgres;Port=5432;Database=blackbox_db;Username=blackbox_user;Password=${BLACKBOX_POSTGRES_PASSWORD:?Set BLACKBOX_POSTGRES_PASSWORD in .env}"
Kafka__BootstrapServers: "kafka:9092"
depends_on:
api:
condition: service_healthy
postgres:
condition: service_healthy
kafka:
condition: service_healthy
kafka-init:
condition: service_completed_successfully
volumes:
postgres_data: