Mellow LogoMellow

Maintenance

Migrations, upgrades, and backups.

Maintenance

Upgrading

  1. Pull the new release: git pull (or pull the new Docker image / redeploy).
  2. Rebuild: go build -o mellow ./cmd/mellow.
  3. Restart. Embedded migrations run automatically before the bot connects.

To run migrations ahead of the restart:

MELLOW_MIGRATE_ONLY=1 ./mellow

Slash 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/migrations as NNNN_name.up.sql / .down.sql and 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_KEY and ENCRYPTION_SALT_LIST separately and securely - a backup without the key is unrecoverable.

Rotating the encryption key

  1. Add a new salt to the front of ENCRYPTION_SALT_LIST, keeping the old one: new-salt,mellow-encryption-salt.
  2. Restart. New writes use the new key; reads still try all keys.
  3. Once you are confident everything sensitive has been rewritten, you may drop the old salt.

Health and logs

  • GET /healthz for external monitoring.
  • Set LOG_CHANNEL_ID to receive gateway connect/disconnect, guild join/leave, and startup events in Discord.
  • /tools status and /tools logs (owner-only) show runtime status and recent internal logs.
  • LOG_LEVEL=debug for verbose logging while diagnosing an issue.

On this page