This bot is used as example of usage aiogram framework and as admin-helper in our community chats.
- May exist
- Watch new chat members and filter users (ask question and restrict user)
- Has simple admin commands for making restrictions
- Chat admins notifier (command which send message to all admins when someone is report message in chat)
- Can be translated (en, ru, uk languages)
- Python 3.7
- pipenv
- Docker
- docker-compose
- make
- Install dependencies in venv:
pipenv install --dev
- Copy
.env.dist
to.env
file and change values in this file - Run databases in docker:
make docker-up-db
- Apply migrations:
make migrate
- Application package is in
app
- All text translations is placed in
locales
- Migrations is placed in
migrations
- Entry-point is
app/__main__.py
(Can be executed aspython -m app
) ...
Before you will make commit need to run black
, isort
and Flake8
via command make lint
If you change Database models you will need to generate migrations: make migration message="do something"
Here listed only Docker deployment methods. That's mean you can't read here how to deploy the bot with other methods instead of Docker but you can do that manually.
Also this bot can't be normally started in Docker with polling mode because in this mode aiohttp server will be not started and healthcheck can not be started.
Pre-requirements:
- Docker
- docker-compose
Steps:
- Prepare
.env
file - ... (TODO)
make app-create
- for first deploy, for updating or restarting
Stopping:
make docker-stop
Destroying (with volumes):
make docker-destroy
Pre-requirements:
- Docker (with activated swarm mode)
- traefik 2.0 in Docker (with overlay network named
web
)
...
In Docker Swarm at Illemius with CI/CD
Steps:
- GitHub Actions:
- Build docker image
- Publish it to the private Illemius Docker registry
- Trigger Portainer webhook in the Illemius cluster via cURL
- Portainer will trigger updating of the bot service
- Docker run new instance of container at specified node
- When container is started by first step it will run migrations
- Docker wait until new instance will be healthy
- Traefik watch Docker container and update the routes when new one is available
- Stop old instance of Bot container