-
Notifications
You must be signed in to change notification settings - Fork 3
/
docker-compose.yaml
127 lines (121 loc) · 3.52 KB
/
docker-compose.yaml
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
services:
kafka:
container_name: kafka
image: bitnami/kafka:3.5.1-debian-11-r3
environment:
- ALLOW_PLAINTEXT_LISTENER=yes
- 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://kafka:9092,EXTERNAL://localhost:9094
- KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=false
# volumes:
# - ./kafka:/bitnami/kafka:rw
ports:
- 9094:9094
- 9092:9092
healthcheck:
test: ["CMD", "kafka-topics.sh", "--list", "--bootstrap-server", "localhost:9092"]
# during this period fails are not considered
start_period: 30s
# time between cmd
interval: 30s
# time given to the cmd
timeout: 5s
retries: 5
networks:
- botdetector-network
kafdrop:
container_name: kafdrop
image: obsidiandynamics/kafdrop:latest
environment:
- KAFKA_BROKERCONNECT=kafka:9092
- JVM_OPTS=-Xms32M -Xmx64M
- SERVER_SERVLET_CONTEXTPATH=/
ports:
- 9000:9000
restart: on-failure
networks:
- botdetector-network
depends_on:
kafka:
condition: service_healthy
kafka_setup:
container_name: kafka_setup
build:
context: ./kafka_setup
image: kafka_setup
environment:
- KAFKA_BROKER=kafka:9092
networks:
- botdetector-network
depends_on:
kafka:
condition: service_healthy
mysql:
container_name: database
build:
context: ./mysql
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=root_bot_buster
volumes:
- ./mysql/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d
- ./mysql/conf.d:/etc/mysql/conf.d
# - ./mysql/mount:/var/lib/mysql # creates persistence
ports:
- 3307:3306
networks:
- botdetector-network
healthcheck:
test: "mysqladmin ping -h localhost -u root -proot_bot_buster"
# during this period fails are not considered
start_period: 30s
# time between cmd
interval: 30s
# time given to the cmd
timeout: 5s
public_api:
container_name: public_api
build:
context: .
dockerfile: Dockerfile
target: base
args:
root_path: ""
api_port: 5000
image: public_api
# command: bash -c "apt update && apt install -y curl && sleep infinity"
command: uvicorn src.core.server:app --host 0.0.0.0 --reload --reload-include src/* --log-level warning
volumes:
- ./src:/project/src
ports:
- 5000:5000
networks:
- botdetector-network
# this overrides the env_file for the specific variable
environment:
- KAFKA_HOST=kafka:9092
- DATABASE_URL=mysql+asyncmy://root:root_bot_buster@mysql/playerdata
- ENV=DEV
- POOL_RECYCLE=60
- POOL_TIMEOUT=30
# env_file:
# - .env
healthcheck:
test: ["CMD-SHELL", "python -c 'import urllib.request; assert urllib.request.urlopen(\"http://localhost:5000/\").getcode() == 200'"]
interval: 5s
timeout: 10s
retries: 3
depends_on:
kafka:
condition: service_healthy
mysql:
condition: service_healthy
wait_for_api:
image: alpine:latest
container_name: wait_for_api
depends_on:
public_api:
condition: service_healthy
networks:
botdetector-network: