Telegram Bot template with aiogram, mongodb and docker
- Aiogram
- Redis
- Motor
- MongoDB
- i18n
- Docker and docker compose
$ git clone -b aiogram3 https://github.com/webshining/aiogram-mongo-template project_name
$ cd project_name
$ pip install -r requirements.txt
Copy variables from .env.ren file to .env
$ cp .env.ren .env
TELEGRAM_BOT_TOKEN
- your bot token (required)
I18N_DOMAIN
- locales file name
If you are not using redis, by default used MemoryStorage
RD_URI
- connection url to your redis server
MongoDB URL format
>mongodb://[username:password@]host1[:port1][,...hostN[:portN]][/[defaultauthdb][?options]]
Specify one of the following options to configure MongoDB connection:
MONGO_HOST
— MongoDB server address (e.g., localhost)MONGO_PORT
— MongoDB port (default: 27017)MONGO_USER
— username for authenticationMONGO_PASS
— password for authenticationMONGO_NAME
— database name
Or use a ready-to-use connection string in the MONGO_URL
variable.
$ python main.py
# If you have make you can enter
$ make run
Run only one service:
>$ docker-compose up -d service-name
$ docker-compose up -d
# If you have make you can enter
$ make rebuild
$ docker-compose logs -f app
# If you have make you can enter
$ make logs
$ docker-compose up -d --build --no-deps --force-recreate
# If you have make you can enter
$ make rebuild