Bot: https://t.me/ds_wolf_bot
Service dashboard: http://159.65.124.137:3000/d/edmo0ry0ykphca/ds-bootcamp-telegram-bot-team-3?orgId=1
- Install dependencies
poetry install --only main,test,format
- Check TELEGRAM_BOT_TOKEN, OPENAI_API_KEY, GPT_VERSION in
wolf_assistant/settings.py
or set.env
file with the following variables:
TELEGRAM_BOT_TOKEN=
OPENAI_API_KEY=
ENV=DEV
MONGO_INITDB_ROOT_USERNAME=admin
MONGO_INITDB_ROOT_PASSWORD=admin_password
- Set environment
export ENV=DEV
- Set database
docker-compose -f docker-compose.mongodb.yml up -d
- Run script
poetry run python wolf_assistant/app.py
You can build and run Docker locally
docker build -t dswolves/telegram-bot:latest .
docker run -d -e TELEGRAM_BOT_TOKEN=<your token> -e OPENAI_API_KEY=<your api key> \
-e MONGO_INITDB_ROOT_USERNAME=<your mongo user> -e MONGO_INITDB_ROOT_PASSWORD=<your mongo pass> \
-e ENV=PROD --name telegram-bot dswolves/telegram-bot:latest
(you also can specify these variables in settings.py and backend/db_con.py)
Or get latest version from DockerHub (https://hub.docker.com/repository/docker/dswolves/telegram-bot/general)
docker pull dswolves/telegram-bot:latest
docker run -d -e TELEGRAM_BOT_TOKEN=<your token> -e OPENAI_API_KEY=<your api key> \
-e MONGO_INITDB_ROOT_USERNAME=<your mongo user> -e MONGO_INITDB_ROOT_PASSWORD=<your mongo pass> \
-e ENV=PROD --name telegram-bot dswolves/telegram-bot:latest
Using docker compose (for bot
, mongodb
, prometheus
and grafana
)
export ENV=DEV_DOCKER
docker-compose -f docker-compose.yml up -d
Configure Grafana:
- Open Grafana at http://localhost:3000.
- Log in (default credentials: admin/admin).
- Add Prometheus as a data source:
- Go to Configuration > Data Sources.
- Click on "Add data source".
- Select "Prometheus".
- Set the URL to http://prometheus:9090. \
Create a dashboard:
- Go to Create > Dashboard.
- Add a new panel and configure it to use the metrics from Prometheus.
- For local development, you can use Pycharm Professional with MongoDB plugin or MongoDB Compass
- connect to
mongodb://localhost:27017/
with username and password fromdocker-compose.mongodb.yml
- You can find tables:
- error - info about errors in your app
- messages - what message reply and what message return from GPT4o
- users - register all users
Force deployment manually:
- go to https://github.com/korobkina/raif-bootcamp-2024/actions/workflows/main.yml
- Press "Run workflow" button and actually run it
or tag a commit with some version in format v*.*.*
(for ex. v1.0.1
) and let CI/CD do its work:
git tag v1.0.1
git push --tags