# 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). ```bash 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](getting-started.md#2-configure-the-environment). ## 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 `.env` through `env_file`, and defaults `DB_HOST` to the `db` service and `LAVALINK_HOST` to `ws://lavalink:2333` if you have not set them. ```bash 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. ## Database changes The bot does not run migrations. When a release adds tables, load `schema.sql` again before restarting the bot (it only creates what is missing, and is safe to repeat). A release that changes an existing table says so in its notes. ## Updating ```bash 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](beta-features.md)). ## Backups All state is in PostgreSQL. Back it up with `pg_dump`: ```bash 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.