Maintenance
Migrations, upgrades, and backups.
Maintenance
Upgrading
- Pull the new release:
git pull(or pull the new Docker image / redeploy). - Rebuild:
go build -o mellow ./cmd/mellow. - Restart. Embedded migrations run automatically before the bot connects.
To run migrations ahead of the restart:
MELLOW_MIGRATE_ONLY=1 ./mellowSlash commands re-register on every start; a schema or option change is picked up
automatically. Set MELLOW_FORCE_DEPLOY=1 to force a full re-registration if commands look
stale.
Migrations
- Migration files live in
internal/db/migrationsasNNNN_name.up.sql/.down.sqland are embedded in the binary. - They are guarded so they are safe to apply to an already-populated database.
- There is no separate migrate CLI; the binary is the migrator (
MELLOW_MIGRATE_ONLY).
Backups
- Back up the PostgreSQL database on a schedule (
pg_dump). - Sensitive columns are ciphertext. Store
ENCRYPTION_KEYandENCRYPTION_SALT_LISTseparately and securely - a backup without the key is unrecoverable.
Rotating the encryption key
- Add a new salt to the front of
ENCRYPTION_SALT_LIST, keeping the old one:new-salt,mellow-encryption-salt. - Restart. New writes use the new key; reads still try all keys.
- Once you are confident everything sensitive has been rewritten, you may drop the old salt.
Health and logs
GET /healthzfor external monitoring.- Set
LOG_CHANNEL_IDto receive gateway connect/disconnect, guild join/leave, and startup events in Discord. /tools statusand/tools logs(owner-only) show runtime status and recent internal logs.LOG_LEVEL=debugfor verbose logging while diagnosing an issue.