Dependencies:
- postgres
- golang-migrate (https://github.com/golang-migrate/migrate)
- poetry (https://python-poetry.org)
Create .env with:
PG_HOST=
PG_PORT=
PG_USER=
PG_PASSWORD=
PG_DATABASE=
TOKEN=
Install libs:
poetry install
Apply migrations
migrate -path ./migrations -database "postgres://{PG_USER}:{PG_PASSWORD}@{PG_HOST}:{PG_PORT}/{PG_DATABASE}?sslmode=disable" up
Build image:
docker build --no-cache -t python-problems-bot .
Change in docker-compose.yml env vars and:
docker-compose up -d --no-deps
migrate create -ext sql -dir migrations {migration-name}
poetry run ruff check . --fix
pytest -v tests
Run postgres for tests
docker run --name postgres-ppb -e POSTGRES_USER=python-problems-bot -e POSTGRES_PASSWORD=python-problems-bot -e POSTGRES_DB=python-problems-bot -p 5436:5432 -d postgres
Apply migrations
migrate -path ./migrations -database "postgres://python-problems-bot:python-problems-bot@localhost:5436/python-problems-bot?sslmode=disable" up
Run functional tests
pytest -v tests_functional
Stop postgres for tests
docker stop postgres-ppb