Updating a self-hosted bot
Back up, pull the new images, run the database migrations, start again.
New versions of Member Counter ship as new container images.
Run the steps in order, from a terminal in the bot folder you created when you set the bot up. Your counters stop updating while the bot is down.
Update
Back up storage/db and .env
Copy both somewhere safe while nothing is running:
storage/dbholds your server settings, templates and channel settings..envholds your token, secrets and settings.
A migration can fail and leave the database half-updated, and this backup is how you restore it. Redis holds only a cache, so it needs no backup.
Check for new settings
Compare the refreshed example file with your own:
diff .env.example .envOn Windows without diff, open both files side by side. Only add variables that appear in .env.example and are missing from .env; the lines that differ because you filled them in are supposed to differ. The meaning of every variable is in the configuration reference.
Apply the database migrations
docker compose run --rm -T db-utils npm run db:migrate up
docker compose run --rm -T db-utils npm run db:pushBoth commands exit when they are done. If either one fails, stop here and ask in #support on the support server before starting the bot, so your database stays in a state you can still restore.
If the update goes wrong
Rolling back takes two parts: the data and the code. Restoring the backup alone is not enough, because the tags in docker-compose.yml now point at the new images.
Stop everything:
docker compose downPut your backed-up
storage/dband.envback in place.Pin the previous images. Find the digest you wrote down before the pull, or list what is still on disk:
docker image ls --digests --filter=reference="ghcr.io/member-counter/*"Then in
docker-compose.yml, replace the tag with that digest, for every service you are rolling back:image: ghcr.io/member-counter/bot@sha256:<old digest>Start again:
docker compose up -d
Then bring the failure to #support on the support server with the output of docker compose logs --tail 50 bot. Never paste your bot token. A custom bot is the same bot on our hosting, updated for you: see How to get a custom bot.
Last updated