# Coolify deployment ## Resource Create a project and add this repository as a Docker Compose resource. Use the root `compose.yaml`. Assign the public domain to the `web` service on port 80. Do not add custom Compose networks or Traefik labels. Coolify creates the deployment network and connects its proxy. The `web` service proxies `/api` and the SSE stream to `api`; `api` and `db` remain internal. ## Required variables Set these as production variables in Coolify: - `PUBLIC_URL=https://mix.example.com` - `POSTGRES_DB` - `POSTGRES_USER` - `POSTGRES_PASSWORD` — generate a unique value - `DATABASE_URL=postgres://:@db:5432/?sslmode=disable` - `DISCORD_CLIENT_ID` - `DISCORD_CLIENT_SECRET` - `DISCORD_REDIRECT_URL=https://mix.example.com/api/auth/discord/callback` - `ADMIN_DISCORD_IDS` — comma-separated Discord user IDs Do not copy production values into `.env` in the repository. ## Discord In the Discord Developer Portal: 1. Create an application. 2. Add the exact production callback URL. 3. Use only the `identify` OAuth scope. 4. Store the client secret only in Coolify. ## Storage and backups PostgreSQL uses the `postgres_data` named volume. Confirm that Coolify recognizes it as persistent storage before accepting users. Persistent storage is not a backup. Schedule an encrypted `pg_dump` to storage outside the VPS, define retention, and test restoration before launch. Back up before schema migrations. ## Deployment verification 1. Ensure `migrations` exits successfully. 2. Ensure `db`, `api`, and `web` become healthy. 3. Open `/health` through the public domain. 4. Complete Discord login and verify the admin role. 5. Create a test event and RSVP. 6. Restart/redeploy and confirm the event remains. 7. Verify SSE remains connected through the proxy. Rollback application images only when the database migration is backward-compatible. Otherwise restore the matching database backup.