DragonBot

Docker build & run (production)

The Compose setup runs the bot in a separate dragonbot container and connects it to the existing mongodb container and persistent dragonbot_mongoData_Discord volume. Keep .env in the repository root; it is passed to the container at runtime and excluded from the image build context. The marketplace requires MongoDB transactions. Compose configures a single-member replica set (rs0) and waits for its primary before starting the bot.

Existing installations: Back up the MongoDB volume before changing the running Mongo container to replica-set mode. Applying this configuration recreates the Mongo container and initializes replica-set metadata in the existing volume. Plan downtime and confirm the volume and network are correct before proceeding. An existing replica set with a different configuration is not modified automatically.

Validate the Compose configuration and build the bot image:

docker compose config --quiet
docker compose build bot

After the backup and migration have been approved, start the services:

docker compose up -d --build
docker compose ps -a
docker exec mongodb mongosh --quiet --eval "db.hello().isWritablePrimary"
docker logs --tail 100 dragonbot

After the replica set is already configured and healthy, subsequent bot-only updates can avoid recreating Mongo:

docker compose up -d --no-deps bot
docker logs --tail 100 dragonbot

Notes and best practices