-
Notifications
You must be signed in to change notification settings - Fork 7
/
compose.yml
182 lines (170 loc) · 4.68 KB
/
compose.yml
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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
networks:
kafka_network:
driver: bridge
services:
api_db:
image: postgres:latest
container_name: binbot_api_db
restart: on-failure
networks:
- kafka_network
volumes:
- ./pg_data:/var/lib/postgresql/data
env_file:
- .env
ports:
- 5432:5432
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $POSTGRES_USER -d $POSTGRES_DB"]
interval: 30s
timeout: 60s
retries: 5
start_period: 30s
data_db:
image: mongo:7.0
container_name: binbot_data_db
restart: on-failure
networks:
- kafka_network
env_file: .env
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_AUTH_USERNAME}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_AUTH_PASSWORD}
MONGO_INITDB_DATABASE: ${MONGO_APP_DATABASE}
ports:
- 27018:27017
volumes:
- ./mongo_data:/data/db
healthcheck:
test: ["CMD", "mongosh", "--quiet", "127.0.0.1/test", "--eval", "'quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)'"]
interval: 10s
timeout: 10s
retries: 5
start_period: 40s
kafka:
image: docker.io/bitnami/kafka:3.4
container_name: binquant_kafka
networks:
- kafka_network
ports:
- "9092:9092"
- "9093:9093"
- "9094:9094"
environment:
- KAFKA_ENABLE_KRAFT=yes
- KAFKA_CFG_PROCESS_ROLES=broker,controller
- KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
- KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093,EXTERNAL://:9094
- KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,EXTERNAL:PLAINTEXT
- KAFKA_CFG_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092,EXTERNAL://kafka:9094
- KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=1@127.0.0.1:9093
- ALLOW_PLAINTEXT_LISTENER=yes
- KAFKA_BROKER_ID=1
- KAFKA_CFG_NODE_ID=1
- KAFKA_CFG_NUM_PARTITIONS=50 # Keep the same as prod (as low as possible to minimize disk space consumption)
- KAFKA_CFG_ENABLE_AUTO_CREATE_TOPICS=true
- BITNAMI_DEBUG=no
# - KAFKA_CFG_OFFSETS_TOPIC_SEGMENT_BYTES=104857600
healthcheck:
test: ["CMD-SHELL", "kafka-topics.sh --bootstrap-server kafka:9092 --topic klines_store_topic --create --if-not-exists", "kafka-topics.sh --bootstrap-server kafka:9092 --topic klines_store_topic --describe"]
start_period: 10s
timeout: 10s
retries: 5
# kafka_producer:
# build: ./binquant
# image: binquant_producer
# container_name: binquant_producer
# restart: on-failure
# networks:
# - kafka_network
# depends_on:
# - kafka
# - api
# env_file:
# - .env
# environment:
# - KAFKA_BOOTSTRAP_SERVERS=http://binquant_kafka:9092
# - FLASK_DOMAIN=http://binbot:8008
# # - KAFKA_TOPIC=${KAFKA_TOPIC}
# volumes:
# - /var/run/docker.sock:/var/run/docker.sock
# command: ["python3", "-m", "producer"]
# kafka_consumer:
# build: ./binquant
# image: binquant_consumer
# container_name: binquant_consumer
# restart: on-failure
# networks:
# - kafka_network
# depends_on:
# - kafka_bitnami
# - api
# env_file:
# - .env
# # environment:
# # - BOOTSTRAP_SERVERS=${BOOTSTRAP_SERVERS}
# # - KAFKA_TOPIC=${KAFKA_TOPIC}
# # - EVENT_TOPIC=${EVENT_TOPIC}
# # - QUEUE_URL=${QUEUE_URL}
# command: ["python3", "-m", "consumer"]
# api:
# build: .
# networks:
# - kafka_network
# restart: on-failure
# container_name: binbot
# depends_on:
# api_db:
# condition: service_healthy
# restart: true
# data_db:
# condition: service_healthy
# env_file:
# - .env
# environment:
# - MONGO_HOSTNAME=localhost
# - POSTGRES_HOSTNAME=api_db
# ports:
# - 8007:80
# - 8008:8006
# streaming:
# build:
# context: .
# dockerfile: Dockerfile.streaming
# image: binbot_streaming
# env_file:
# - .env
# restart: on-failure
# container_name: binbot_streaming
# depends_on:
# - api
# - db
# crobjobs:
# build:
# context: .
# dockerfile: Dockerfile.cronjobs
# image: binbot_cronjobs
# env_file:
# - .env
# restart: on-failure
# container_name: binbot_cronjobs
# depends_on:
# # - api
# - db
# grafana:
# build:
# context: grafana-mongodb-docker
# dockerfile: Dockerfile
# container_name: binquant_grafana
# networks:
# - kafka_network
# restart: on-failure
# volumes:
# - ./grafana-mongodb-docker/data:/var/lib/grafana
# - /var/lib/grafana/plugins
# ports:
# - 4000:3000
# - 3333:3333
volumes:
mongo_data:
pg_data: