Skip to content

Commit

Permalink
Merge pull request #160 from moevm/PB-159
Browse files Browse the repository at this point in the history
#159 Healthcheck
  • Loading branch information
zmm authored Jul 3, 2024
2 parents 5e7ea9a + 7f3207b commit f2867e5
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/container_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- name: Start containers
run: |
docker compose up -d
sleep 30
sleep 45
- name: Check containers
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Installation of testing utilities (Pipreqs, Pylint)
run: |
python -m pip install --upgrade pip
pip install pipreqs pylint
pip install pipreqs==0.5.0 pylint==3.2.4
- name: Dependency check (Run Pipreqs)
run: |
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
5. Заменить в файле `.env` `PasteYourTelegramToken` на токен созданного бота в Telegram
6. Установить режим отладки бота (в `.env` указать `DEBUG=true` или `DEBUG=false`)
7. В терминале в папке репозитория выполнить команды:
```console

```shell
docker-compose build
docker-compose up
```

Можно использовать флаги `--abort-on-container-exit` и\или `--abort-on-container-failure` в комбинации с `docker compose up` для того, чтобы сервисы закрывались при появлении проблем с хотя бы одним из них. Это облегчит отладку проекта и позволит ему стать более гибким в этом плане.


## Правила работы в репозитории
Expand Down
60 changes: 46 additions & 14 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
version: "3"


services:
db:
container_name: "mongo-db"
image: mongo:6.0
restart: unless-stopped
env_file: .env
volumes:
- db-data:/data/db/
- db-data:/data/db
- db-conf:/data/configdb
ports:
- "127.0.0.1:27018:27017"
healthcheck:
test: mongosh --eval 'db.runCommand("ping")' --quiet
interval: 2m
timeout: 5s
retries: 3
start_period: 45s
start_interval: 15s

bot:
container_name: "bot"
Expand All @@ -21,14 +26,29 @@ services:
restart: unless-stopped
env_file: .env
depends_on:
- db
- kafka
db:
condition: service_healthy
silero-tts-service:
condition: service_healthy
whisper-asr-webservice:
condition: service_healthy
zookeeper:
condition: service_started
kafka:
condition: service_started

silero-tts-service:
image: "navatusein/silero-tts-service:1.0.0"
container_name: "silero-tts-service"
restart: unless-stopped
env_file: .env
healthcheck:
test: curl -is localhost:9898 | head -n 1 | grep 200 || exit 1
interval: 2m
timeout: 5s
retries: 3
start_period: 45s
start_interval: 15s
deploy:
resources:
limits:
Expand All @@ -43,21 +63,33 @@ services:
- ASR_MODEL_PATH=/data/whisper
volumes:
- whisper-data:/data/whisper/

healthcheck:
test: timeout 3 bash -c "</dev/tcp/localhost/9000"; echo $?
interval: 2m
timeout: 5s
retries: 3
start_period: 45s
start_interval: 15s

zookeeper:
image: wurstmeister/zookeeper
container_name: zookeeper
ports:
- "2181:2181"
image: "wurstmeister/zookeeper"
container_name: "zookeeper"
volumes:
- zookeeper-data:/opt/zookeeper-3.4.13/data
- zookeeper-conf:/opt/zookeeper-3.4.13/conf

kafka:
image: "wurstmeister/kafka:2.13-2.8.1"
container_name: kafka
ports:
- "9094:9094"
container_name: "kafka"
env_file: .env
volumes:
- kafka-data:/kafka


volumes:
db-data:
db-conf:
whisper-data:
zookeeper-data:
zookeeper-conf:
kafka-data:

0 comments on commit f2867e5

Please sign in to comment.