-
Notifications
You must be signed in to change notification settings - Fork 0
Deployment
This page is for operators deploying Battlevive Bot with Docker or Podman Compose.
- Docker or Podman with Compose support.
- A Discord bot token.
- Battlevive/Supabase API credentials.
- PostgreSQL credentials for the local database container.
Do not commit or paste real .env files or tokens. Use utils/.env.example as the template.
From utils/.env.example, the deployment expects values for:
DISCORD_TOKENSUPABASE_URLSUPABASE_API_KEYBATTLEVIVE_URLLOG_LEVELDISCORD_LOG_LEVELPOSTGRES_USERPOSTGRES_PASSWORDPOSTGRES_DBDATABASE_URL
DATABASE_URL points at the Compose database service by default: postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}.
cd utils
cp .env.example .env
# fill required values in .env
./init.shinit.sh installs helper dependencies and runs the environment generator/finalizer. Follow its prompts before starting the containers.
From the repository root after setup:
docker compose up -d --buildor with Podman:
podman compose up -d --buildTo build and recreate only the bot service when the database is already running:
podman compose up -d --build --no-deps botIf podman-compose is installed and preferred, use equivalent podman-compose commands.
Check logs with:
docker compose logs -f bot
podman compose logs -f botCompose defines two services:
-
bot, built as imagebattlevive-bot:local, using.envand mounting./app/data:/app/dataand./app/logs:/app/logs. -
db, usingpostgres:18, loading bootstrap SQL from./app/init-db, storing PostgreSQL data under./app/data/postgresql, and binding PostgreSQL to127.0.0.1:5432for local host access only.
The database service has a pg_isready healthcheck, and the bot waits for the database to become healthy before starting.
podman build . --file Dockerfile --tag battlevive-bot:localor:
docker build . --file Dockerfile --tag battlevive-bot:localFresh database volumes run all files in app/init-db/ automatically. Existing PostgreSQL volumes do not rerun container initialization scripts automatically. Apply any missing numbered migrations manually and in order as a database administrator.
Known idempotent migrations for existing volumes include:
psql "$DATABASE_URL" -f app/init-db/04_guild_config.sql
psql "$DATABASE_URL" -f app/init-db/05_leaderboards.sql
psql "$DATABASE_URL" -f app/init-db/06_leaderboard_disk_cache.sqlMigration 06_leaderboard_disk_cache.sql removes database-stored PNG data, clamps leaderboard limits above 50, and enforces the 1-50 range.
See Database Schema for the schema and persistence notes.