Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2.6 KiB
Deployment
Docker
The Dockerfile is a two-stage build: it compiles a static binary with Go, then copies it into a small Alpine image (with CA certificates and timezone data, which /timezone and scheduling need).
docker build -t velox-bot .
docker run --env-file .env velox-bot
The container reads its configuration from environment variables, exactly like a local run. See Getting started.
Docker Compose
docker-compose.yml defines two services:
db: PostgreSQL 16 with a named volume (velox_pgdata) and a health check.bot: the bot, built from this directory, started after the database is healthy. It takes.envthroughenv_file, and defaultsDB_HOSTto thedbservice andLAVALINK_HOSTtows://lavalink:2333if you have not set them.
docker compose up -d # database and bot
docker compose logs -f bot
Compose does not include Lavalink. Run it separately (or add a service) if you want music.
Change the default database password (velox_pwd) before exposing PostgreSQL to anything other than your own machine, and remove the published 5432 port if only the bot needs it.
Running next to the dashboard
If you also run velox-dashboard-api and velox-dashboard-web:
- They all use the same database. Give each the same PostgreSQL, and point
DB_HOST(bot) and the API'sDB_ADDRat it. - The API runs the migrations when it starts. The bot does not run migrations.
- Deploy order for changes that touch the database: API first (it applies the migration), then the bot and the dashboard.
Some changes need the API, the bot and the dashboard to go out together. For example, when a table the dashboard writes changes shape, an old dashboard talking to a new API fails. The release notes for such a change say so.
Updating
git pull
docker compose build bot
docker compose up -d bot
Slash commands are re-registered on every start, so new and changed commands appear after a restart. Commands you removed from the code are not deleted from Discord automatically, except for the beta server (see Beta features).
Backups
All state is in PostgreSQL. Back it up with pg_dump:
pg_dump "postgres://velox:velox_pwd@localhost:5432/velox" > velox-backup.sql
Raid mode, quarantines, lockdowns and ticket state live in the database, so the bot picks them up again after a restart.
Shutting down
Send SIGINT or SIGTERM (Docker does on docker stop). Slash commands stay registered in Discord while the bot is down, and are registered again (updated in place) on the next start.