-
Install poetry and project requirements with
poetry install
. It will automatically create python virtualenv and manage python requirements for you. -
Create
.env
file with following variables:
COMPOSE_PROJECT_NAME="inventory"
POSTGRES_DSN="postgresql://postgres:postgres@localhost:5432/main"
TELEGRAM_TOKEN="<your telegram bot token>"
-
Run docker compose (postgres only):
docker compose --env-file .env up postgres --build -d
. Now you have a postgres instance running onlocalhost:5432
. If the port is busy, try another - replace it both indocker-compose.yml
and.env
. -
Run migrations for postgres:
poetry run pem migrate
. -
Run python application locally (without docker):
poetry run python main.py
. It's recommended to always usepoetry run
instead ofpoetry shell
because it ensures that environment variables from.env
are always reloaded. -
To deploy entire stack (postgresql + python app) on a remote server, configure docker context and deploy as usual:
docker --context <your server> compose --env-file .env up --build -d
.
- Python 3.9
- PostgreSQL 15
- Poetry
- Peewee ORM
- Python-Telegram-Bot
- Dependency Injector
- Pydantic
- Loguru