{"id":25543466,"url":"https://github.com/lixelv/aiogram-docker-template","last_synced_at":"2026-04-10T01:03:45.599Z","repository":{"id":275053244,"uuid":"924792999","full_name":"lixelv/aiogram-docker-template","owner":"lixelv","description":"Docker compose template for aiogram bot (default echo bot), with postgres database.","archived":false,"fork":false,"pushed_at":"2025-02-09T21:58:22.000Z","size":57,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-15T01:29:27.179Z","etag":null,"topics":["aiogram","docker","docker-compose","github-actions","postgresql","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lixelv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-30T16:58:44.000Z","updated_at":"2025-02-14T16:26:21.000Z","dependencies_parsed_at":"2025-02-06T23:20:46.696Z","dependency_job_id":null,"html_url":"https://github.com/lixelv/aiogram-docker-template","commit_stats":null,"previous_names":["lixelv/aiogram-docker-template"],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lixelv%2Faiogram-docker-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lixelv%2Faiogram-docker-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lixelv%2Faiogram-docker-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lixelv%2Faiogram-docker-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lixelv","download_url":"https://codeload.github.com/lixelv/aiogram-docker-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239793061,"owners_count":19697893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aiogram","docker","docker-compose","github-actions","postgresql","telegram-bot"],"created_at":"2025-02-20T07:19:32.871Z","updated_at":"2025-12-30T22:59:47.366Z","avatar_url":"https://github.com/lixelv.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Aiogram Docker Template\n\nA production-ready template for telegram bots using Aiogram 3.x and docker compose for auto deployment by GitHub Actions. By default, this is echo bot with `/help` command to get user's data from database. Also you need to create self-hosted runner for GitHub Actions, there your bot will be deployed. For that you will need your own server.\n\n## Features\n\n-   Built with Aiogram 3.x\n-   PostgreSQL database integration\n-   Docker compose containerization\n-   Multiple deployment modes\n-   GitHub Actions CI/CD\n-   Environment variables configuration\n\n## Deployment Modes\n\nThe template supports three deployment modes:\n\n1. **Local Mode** (`DEPLOY_MODE=\"prod\"`)\n    - Creates a new PostgreSQL container\n    - Perfect for fast deploy and testing\n    - Includes database persistence\n\n2. **Development Mode** (`DEPLOY_MODE=\"dev\"`)\n    - Similar to local mode but optimized for development\n    - Includes hot-reload capabilities\n    - Best for active development\n\n## Setup\n\n1. Create new repository from existing template\n2. Setup local hosted runner for GitHub Actions:\n\n    - Goto https://github.com/your_username/your_repo/settings/actions/runners/new?arch=x64\u0026os=linux (change `your_username` on your github username and `your_repo` on repo_name, created from this template)\n    - Create new local runner on your server\n    - Instead of running `./run.sh` file install github runner as service, here is code are:\n        ```bash\n        sudo ./svc.sh install\n        sudo ./svc.sh start\n        ```\n    - Download docker and docker compose if they are not installed,:\n        ```bash\n        sudo curl -fsSL https://get.docker.com | sh\n        sudo curl -L \"https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)\" -o /usr/local/bin/docker-compose\n        sudo chmod +x /usr/local/bin/docker-compose\n        ```\n\n3. Create environment for your bot:\n\n    - Goto https://github.com/your_username/your_repo/settings/environments/new (change `your_username` on your github username and `your_repo` on repo_name, created from this template)\n    - In name write `production` and continue\n    - In environment secrets write:\n        - `TELEGRAM_BOT_TOKEN`: Your bot token, get it from [@BotFather](https://t.me/BotFather)\n        - `LOGFIRE_TOKEN`: Optional, adding web logging on logfire, get it here: https://logfire.pydantic.dev/\n        - `POSTGRES_HOST`: Postgres host, set here `db` or delete postgres service if you need non local postgres\n        - `POSTGRES_PORT`: 5432 by default, but if you already have postgres container you can set it to `5433`\n        - `POSTGRES_USER`: User for postgres database\n        - `POSTGRES_PASSWORD`: Password for postgres database\n        - `POSTGRES_DB`: Database name\n        - `REDIS_HOST`: Redis host set here `redis`, or delete redis service if you need non local redis\n        - `REDIS_PORT`: 6379 by default, but if you already have redis container you can set it to `6380`\n        - `REDIS_PASSWORD`: Password for redis\n        - `DEPLOY_MODE`: `prod` or `dev`\n    - All variables are required (except LOGFIRE_TOKEN)!\n\n5. Develop your bot:\n    - Firstly edit `.env.example` file and rename it to `.env`\n    - Run `docker-compose -f docker/docker-compose.dev.yaml --env-file .env up --build`\n    - Goto `-dev` container and open bot logs below\n    - Develop your bot\n\n6. Deploy your bot:\n    - Goto https://github.com/your_username/your_repo/actions/workflows/deploy.yml (change `your_username` on your github username and `your_repo` on repo_name, created from this template)\n    - Press Run workflow and start your bot! This workflow will be triggered any time you push any code to `main`.\n\n## Setting new environment variables\n\n1. Create a new secret in `production` environment, in our case this will be `VARIABLE_NAME`.\n2. Change `deploy.yml` file, add `echo \"VARIABLE_NAME=\\\"${{ secrets.VARIABLE_NAME }}\\\"\" \u003e\u003e .env` line\n3. After you can get your variable value in python using `os.getenv(\"VARIABLE_NAME\")`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flixelv%2Faiogram-docker-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flixelv%2Faiogram-docker-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flixelv%2Faiogram-docker-template/lists"}