# Deployment

Godelgate is a single Node.js process with an SQLite file for its audit log and tool pins. Put that file on persistent storage, put the gate behind HTTPS, and keep secrets in the environment.

## Node

```bash
npm ci
npm run build
GODELGATE_CONFIG=/etc/godelgate/godelgate.yaml \
GODELGATE_DB=/var/lib/godelgate/godelgate.db \
GODELGATE_ADMIN_TOKEN=... \
npm start
```

Requires Node.js 22.13 or newer.

## Docker

The repository includes a `Dockerfile`. The image listens on port 8080 and stores data in `/data`.

```bash
docker build -t godelgate .
docker run -d --name godelgate -p 8080:8080 \
  -v godelgate-data:/data \
  -v $PWD/godelgate.yaml:/app/godelgate.yaml:ro \
  -e GODELGATE_ADMIN_TOKEN=... \
  -e ALICE_KEY=... \
  godelgate
```

If your servers run with `command: npx`, they are started inside the container, so the image needs network access to download them on first start.

## Lizard

```bash
lizard up --service godelgate --port 8080
lizard secrets set GODELGATE_ADMIN_TOKEN=... ALICE_KEY=... --service godelgate
lizard volume create data --service godelgate --mount-path /data
lizard domain gate.example.com --service godelgate
```

Lizard builds the `Dockerfile`, provides HTTPS, and keeps `/data` across deploys.

## Production checklist

- **HTTPS:** keys travel in headers, so never expose the gate over plain HTTP.
- **Persistent data:** keep `GODELGATE_DB` on a volume. Losing it loses the audit log and resets tool pins.
- **Admin token:** set `GODELGATE_ADMIN_TOKEN` (or `admin.token`). Without it, a new random token is generated on every start.
- **Health check:** `GET /healthz` returns `{"ok": true}`.
- **Public demo:** set `demo.public: false` unless you want the unauthenticated `/api/demo` endpoint.
- **One replica:** sessions and pending approvals are held in memory, so run a single instance.
