Skip to content
joinemmPublic

About

🤖 Discord bot with too many features

Topics

Resources

Stars

142 stars

Watchers

1 watching

Forks

Repository files navigation

noai

License Code style: black Codacy Badge DeepSource Discord Sponsor


Miso Bot

Miso is a multipurpose Discord bot with over 100 commands and features.

For more information and command reference, visit https://misobot.xyz

Development

A Nix development shell is included, using devenv

This environment installs poetry and some useful packages.

nix develop --impure

The dependencies are managed using Poetry

poetry install

Copy/rename .env.example to .env and fill the api keys you need, most importantly the discord bot token. The bot can then be run with

poetry run python main.py
# or in dev mode
poetry run python main.py dev

# if using the nix shell:

run
# or in dev mode
run dev

but it will not function without a MariaDB database. The database can be bootstrapped with

docker compose up db -d

After which the bot can be ran and easily developed. When you're done, remember to shut down the database container:

docker compose down

Contributing

Your pull requests are welcome, as long as they meet the enforced code standards:

The nix shell installs these as pre-commit hook automatically.

Deployment

First copy/rename .env.example to .env and fill it with your own keys. Everything else should be handled by the dockerfile.

Production databases use the encryption configuration in docker-compose.production.yml. The server's SOPS configuration provisions /run/secrets/mariadb_encryption_key before the databases start. Its content is a MariaDB file-key-management entry in the format 1;<64 hexadecimal characters>. The secret has UID/GID 999 and mode 0400, matching the containers' mysql user, and is mounted read-only into both databases. Keep the key in your password manager separately from the database volume. When recovering an existing encrypted database, restore the same key; generating a new key will not decrypt the existing files.

Add the following to the production .env so subsequent Compose commands keep encryption enabled:

COMPOSE_FILE=docker-compose.yml:docker-compose.production.yml

Local development uses docker-compose.yml without the production override.

The production override also enables MARIADB_AUTO_UPGRADE for both databases. The image's entrypoint updates system tables when the MariaDB version changes and backs up the system database before upgrading. Take a full database backup before changing database versions, and keep the encryption key with the recovery materials. An upgrade of system tables does not replace a full backup.

docker compose --profile prod up

The docker compose file bootstraps the entire miso infrastructure, including prometheus metrics, grafana dashboards and nginx reverse proxy.

You likely don't want these if you're just running the bot.

The compose file is using different profiles that start only a handful of containers: dev, dev-extra and prod. prod starts everything, as you might have guessed. dev starts only the db and the bot in debug mode, for fast testing. dev-extra starts extra services used by some commands, but not the infra containers.

docker compose --profile dev up
docker compose --profile dev-extra up

Star History

Star History Chart

Contributor wall

Contributors

About

🤖 Discord bot with too many features

Topics

Resources

Stars

142 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages