THIS PAGE IS THE ACTUAL FILE THAT SHIPS IN THE REPOSITORY — PUBLISHED SO YOU CAN JUDGE THE OPERATIONAL COST BEFORE YOU PAY.

Deployment guide

Vigil deploys as two processes and one database: the Next.js app, the worker, and PostgreSQL 18+. Nothing else is required.

1. Docker Compose (single host)

The included docker-compose.yml is production-shaped: Postgres with a persistent volume, a one-shot migrate service, the standalone app image, and the worker image.

# .env next to docker-compose.yml
BETTER_AUTH_SECRET=<openssl rand -base64 32>
APP_URL=https://vigil.yourdomain.com
POSTGRES_PASSWORD=<strong password>

docker compose up --build -d

Put a TLS-terminating reverse proxy in front of port 3000 (Caddy shown; nginx/Traefik equivalent):

vigil.yourdomain.com {
    reverse_proxy localhost:3000
}

Upgrading a running stack

git pull
docker compose build
docker compose up -d      # migrate runs first, then app/worker restart

2. Managed platforms

Hybrid Setup Example (Vercel + Neon + Fly.io/Render Worker)

  1. Database: Set up a database on Neon, copy the connection string.
  2. Frontend (Vercel): Connect your GitHub repo, set the Framework Preset to Next.js. Add DATABASE_URL (Neon), BETTER_AUTH_SECRET (generate one), and APP_URL (your deployment URL) to the Environment Variables.
  3. Worker: Create a new background worker/VM on Fly.io (free) or Render (paid). Link the same repository. Add the same DATABASE_URL, BETTER_AUTH_SECRET and APP_URL environment variables (the worker embeds APP_URL in incident notification links). Set the Start Command to npm run worker.
  4. Communication: Both processes will securely coordinate through the Neon database using pg-boss. No Redis or open network ports between the frontend and worker are needed.

3. Bare metal / VM without Docker

npm ci
npm run build
npm run db:migrate

# standalone output does not include static assets — copy them in once per build:
cp -r .next/static .next/standalone/.next/static
cp -r public .next/standalone/public

# process manager of your choice (systemd/pm2):
node .next/standalone/server.js     # app, PORT=3000
npm run worker                      # worker

Environment

See sample.env.production for the full annotated template. Required: DATABASE_URL, BETTER_AUTH_SECRET, APP_URL.

Operational notes