This repository contains a Telegram bot built with Aiogram 3 and PostgreSQL (asyncpg). The project is prepared for reliable deployment on Render using a Docker-based Blueprint.
- Telegram bot token (BOT_TOKEN)
- Render PostgreSQL instance (DATABASE_URL)
- Optional admin user id (ADMIN_ID)
See .env.example for variables.
render.yaml is configured to deploy a worker with Docker:
- type: worker
- env: docker
- dockerfilePath: ./Dockerfile
- start: uses Dockerfile CMD (
python bot.py) - env vars: BOT_TOKEN, DATABASE_URL, ADMIN_ID
- Push this repo to GitHub (done).
- In Render, click New + -> Blueprint -> choose your repo.
- Ensure
env: dockeris detected andDockerfileis used. - Add environment variables:
BOT_TOKEN— requiredDATABASE_URL— required (from Render Postgres: External Connection string)ADMIN_ID— optional (Telegram numeric ID)
- Create a Render PostgreSQL instance and copy the
External Connectionstring toDATABASE_URL. - Deploy. The worker will start long-running polling.
python -m venv .venv
source .venv/bin/activate # Windows: .venv\\Scripts\\activate
pip install -r requirements.txt
cp .env.example .env
# fill BOT_TOKEN and DATABASE_URL
python bot.py- The app fails fast if
BOT_TOKENorDATABASE_URLare missing (clear error). ADMIN_IDis optional; admin-only features will be hidden if not set.- Avoid committing local DB files (see
.gitignore). - This bot uses long polling; no public HTTP port required on Render.