#!/bin/bash set -e echo "checking venv..." if [[ "$VIRTUAL_ENV" != "" ]] then echo "process is in venv, skipping." else echo "venv not found, entering..." source $(pwd)/venv/bin/activate fi echo echo "formatting..." ruff check . --fix black . echo echo "checking psql..." if ! pg_isready -h localhost -p 5432; then echo "psql is down, try again" >&2 exit 1 fi echo "psql is up and is recieving connections." echo echo "checking redis..." if ! redis-cli ping | grep PONG > /dev/null; then echo "redis is down, try again" >&2 exit 1 fi echo "redis is up and is recieving connections." echo echo "running migrations..." alembic upgrade head echo echo "starting the bot..." exec python main.py