Giter Site home page Giter Site logo

raif-bootcamp-2024's Introduction

Status

Deployment Status python code style: black MyPy MongoDB Prometheus Grafana

Raiffeisen bootcamp 2024 - Data Scientist assistant telegram bot

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

How to test locally

  1. Install dependencies
poetry install --only main,test,format
  1. 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
  1. Set environment
export ENV=DEV
  1. Set database
docker-compose -f docker-compose.mongodb.yml up -d
  1. Run script
poetry run python wolf_assistant/app.py

Docker

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

Prometheus and Grafana

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.

MongoDb

  • For local development, you can use Pycharm Professional with MongoDB plugin or MongoDB Compass
  • connect to mongodb://localhost:27017/ with username and password from docker-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

Deploy

Force deployment manually:

  1. go to https://github.com/korobkina/raif-bootcamp-2024/actions/workflows/main.yml
  2. 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:

  1. git tag v1.0.1
  2. git push --tags

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.