-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
123 lines (116 loc) · 3.23 KB
/
docker-compose.yml
File metadata and controls
123 lines (116 loc) · 3.23 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
123
services:
postgres:
build:
context: .
dockerfile: docker/Dockerfile.postgresql
environment:
- POSTGRES_DB=orderbook_db
- POSTGRES_USER=orderbook_user
- POSTGRES_PASSWORD=orderbook_password
volumes:
- postgres_data:/var/lib/postgresql
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U orderbook_user -d orderbook_db"]
interval: 5s
timeout: 5s
retries: 5
start_period: 10s
kafka:
image: confluentinc/cp-kafka:latest
environment:
KAFKA_BROKER_ID: 1
KAFKA_NODE_ID: 1
KAFKA_PROCESS_ROLES: "broker,controller"
KAFKA_CONTROLLER_QUORUM_VOTERS: "1@kafka:29093"
KAFKA_LISTENERS: "INTERNAL://:9092,EXTERNAL://:29092,CONTROLLER://:29093"
KAFKA_ADVERTISED_LISTENERS: "INTERNAL://kafka:9092,EXTERNAL://localhost:29092"
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: "INTERNAL:PLAINTEXT,EXTERNAL:PLAINTEXT,CONTROLLER:PLAINTEXT"
KAFKA_INTER_BROKER_LISTENER_NAME: "INTERNAL"
KAFKA_CONTROLLER_LISTENER_NAMES: "CONTROLLER"
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
CLUSTER_ID: "order-book-dev-cluster-01"
KAFKA_GROUP_MIN_SESSION_TIMEOUT_MS: 6000
KAFKA_GROUP_MAX_SESSION_TIMEOUT_MS: 60000
KAFKA_REPLICA_LAG_TIME_MAX_MS: 1000
KAFKA_NUM_REPLICA_FETCHERS: 4
KAFKA_COMPRESSION_TYPE: "producer"
KAFKA_LINGER_MS: 0
KAFKA_BATCH_SIZE: 8192
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
KAFKA_AUTO_LEADER_REBALANCE_ENABLE: "true"
KAFKA_UNCLEAN_LEADER_ELECTION_ENABLE: "false"
healthcheck:
test: nc -z localhost 9092 || exit 1
interval: 5s
timeout: 10s
retries: 5
start_period: 15s
ports:
- "29092:29092"
volumes:
- kafka_data:/var/lib/kafka/data
gateway:
build:
context: .
dockerfile: docker/Dockerfile.gateway
depends_on:
kafka:
condition: service_healthy
postgres:
condition: service_healthy
environment:
- DATABASE_URL=postgresql+asyncpg://orderbook_user:orderbook_password@postgres:5432/orderbook_db
ports:
- "8000:8000"
volumes:
- ./resources:/app/resources
matching:
build:
context: .
dockerfile: docker/Dockerfile.matching
depends_on:
kafka:
condition: service_healthy
redis:
condition: service_healthy
market-data:
build:
context: .
dockerfile: docker/Dockerfile.market_data
depends_on:
kafka:
condition: service_healthy
postgres:
condition: service_healthy
environment:
- DATABASE_URL=postgresql+asyncpg://orderbook_user:orderbook_password@postgres:5432/orderbook_db
redis:
image: redis:latest
ports:
- "6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 5s
timeout: 3s
retries: 5
streamlit:
build:
context: .
dockerfile: docker/Dockerfile.streamlit
depends_on:
- redis
- gateway
ports:
- "8501:8501"
environment:
- REDIS_URL=redis://redis:6379/0
- GATEWAY_URL=http://gateway:8000
volumes:
- ./src:/app/src # For development hot-reload
volumes:
kafka_data:
driver: local
postgres_data:
driver: local