Docs
Self-hosting
Run the nono website, hosted API and PostgreSQL on your own server with Docker Compose and Caddy.
The hosted side of nono is optional. Local verification never needs it. Self-host it when you want project-scoped report history and revocable share links under your own control.
The hosted service stores sanitized manifests uploaded explicitly with nono sync. It does not run your application, launch browsers or fetch URLs on your behalf; verification always runs on your machine or in your CI.
Architecture#
Internet ──HTTPS──▶ nono-caddy (80/443, automatic TLS, security headers)
├─▶ nono-web :3000 Next.js standalone [nono-edge]
└─▶ nono-api :8080 Hono [nono-edge, nono-internal]
└─▶ nono-postgres :5432 [nono-internal only]
- nono-caddy terminates TLS with automatic certificates and routes
APP_DOMAINto the web app andAPI_DOMAINto the API. It is the only service that publishes ports. - nono-web (
apps/web) serves the landing page, documentation, demo and hosted dashboard. It is built withoutput: 'standalone'and receives no database or session secrets. - nono-api (
apps/api) is the Hono API used by the dashboard and bynono login/nono sync. Its container is read-only; it stores everything in PostgreSQL. - nono-postgres (PostgreSQL 17) sits on an internal-only Docker network with no published port — never add one.
infra/README.md in the repository is the detailed operations guide; this page summarizes it.
Requirements#
- A Linux server (Ubuntu LTS is what the scripts target). 2 vCPU and 4 GB RAM is a reasonable start; building the Next.js image is the most memory-hungry step.
- Docker Engine with the Compose plugin (
bootstrap.shinstalls them if missing). - Two DNS records pointing at the server, for example
app.example.comandapi.example.com, before Caddy can obtain certificates.
Configuration#
Copy the example environment file and fill it in, or let infra/scripts/bootstrap.sh create it with generated secrets. Never commit the real file.
cp .env.example .env
| Variable | Used by | Description |
|---|---|---|
APP_DOMAIN, API_DOMAIN |
Caddy | Hostnames for the website and the API. |
ACME_EMAIL |
Caddy | Email for the ACME (Let's Encrypt) account. |
APP_URL |
web, api | Public URL of the website, e.g. https://app.example.com. The API allows CORS only from this origin. |
API_URL |
web, api | Public URL of the API, e.g. https://api.example.com. |
POSTGRES_USER, POSTGRES_DB, POSTGRES_PASSWORD |
postgres, api | Database credentials. Compose derives the API's DATABASE_URL from them. POSTGRES_PASSWORD only takes effect when the volume is first initialised. |
DATABASE_URL |
api (outside Docker) | Only needed when running the API outside Compose. |
SESSION_SECRET |
api | HMAC key for the session-token hashes stored in the database. Rotating it signs everyone out. |
AUTH_SECRET |
api | HMAC key for the CSRF tokens bound to each session. |
MAX_UPLOAD_SIZE |
api | Maximum POST /v1/reports body, in bytes or kb/mb (1kb–50mb). Default 5mb. |
ARTIFACT_RETENTION_DAYS |
api | Uploaded reports (and their share links) older than this are deleted. Default 30. |
ARTIFACT_STORAGE_PATH |
api | Reserved. The API currently stores sanitized manifests in PostgreSQL only and never accepts artifact bytes. |
COOKIE_DOMAIN |
api | Optional parent domain for cookies. Leave empty unless needed. |
LOG_LEVEL |
api | debug, info, warn, error or silent. Default info. |
BACKUP_RETENTION_DAYS |
backup.sh |
Days of database dumps to keep. Default 14. |
Generate SESSION_SECRET and AUTH_SECRET with openssl rand -hex 32. In production the API refuses to start unless both are at least 32 characters, differ from each other and are not placeholders. deploy.sh also refuses to run while any CHANGE_ME value remains.
The web image bakes NEXT_PUBLIC_API_URL (the API URL the browser dashboard calls) and NEXT_PUBLIC_SITE_URL in at build time from the API_URL and APP_URL build arguments, so changing either URL requires rebuilding nono-web. The web container also reads APP_URL at runtime.
Further API settings — SESSION_TTL_DAYS, COOKIE_SECURE, TRUST_PROXY, SCRYPT_COST, RETENTION_INTERVAL_MINUTES and the RATE_LIMIT_* variables — are documented in the API configuration table in infra/README.md. Compose sets COOKIE_SECURE=true and TRUST_PROXY=true.
Running with Docker Compose#
From the repository root:
docker compose up -d --build
docker compose ps
Database migrations run automatically: the API container runs node dist/migrate.js before starting the server. To run them explicitly (as deploy.sh does):
docker compose run --rm nono-api node dist/migrate.js
Check health:
curl -fsS https://api.example.com/health
# {"ok":true,"db":true,"version":"…"}
/health returns 503 with "db":false when the database is unreachable.
Deployment scripts#
infra/scripts/ contains scripts for a single-server deployment under /opt/nono. They are written to be safe to re-run.
| Script | Purpose |
|---|---|
bootstrap.sh |
One-time server setup, run as root with SSH_PUBKEY, REPO_URL, APP_DOMAIN, API_DOMAIN and ACME_EMAIL. Installs Docker if missing, creates a deploy user, adds ufw allow rules (never removes any), creates /opt/nono/{app,shared,backups,state}, writes /opt/nono/shared/.env with generated secrets (never overwriting existing values) and installs a daily backup cron job. SSH hardening is only printed as advice unless you pass --harden-ssh. |
deploy.sh [revision] |
Deploys a branch, tag or SHA (default main): fetch and detached checkout, env and compose validation, image build tagged with the short SHA, a pre-migration backup (SKIP_BACKUP=1 skips it), migrations, docker compose up -d, health checks through Caddy, and records the revision. AUTO_ROLLBACK=1 redeploys the previous revision if health checks fail. |
backup.sh |
Writes a gzipped plain-SQL pg_dump to /opt/nono/backups/nono-<timestamp>.sql.gz and deletes dumps older than BACKUP_RETENTION_DAYS. |
| `rollback.sh [--list |
.github/workflows/deploy.yml runs deploy.sh over SSH from GitHub Actions, and .github/workflows/uptime.yml checks /health and the website every 15 minutes. Read each script before running it on a server you care about.
Point the CLI at your instance#
In the hosted dashboard, create a project and a project token (shown once), then:
nono login --api https://api.example.com --token nono_…
nono sync --latest
You can omit --token and set NONO_TOKEN instead.
Operations checklist#
- HTTPS everywhere, handled by Caddy.
- Restart policies — every service uses
restart: unless-stopped. - Persistent volumes —
nono-pgdatafor PostgreSQL, plus Caddy's certificate volumes. - Backups —
backup.shruns daily from cron and before each deploy. Copy dumps off the server and test restoring them. - Log rotation — compose configures json-file logs at 10 MB × 5 files per container.
- Uptime monitoring against
/health, in addition to the GitHub workflow. - Firewall allowing only SSH, HTTP and HTTPS. Docker-published ports bypass ufw, so publish ports only from
nono-caddy.
Restoring from backup#
From /opt/nono/app on the server:
Stop the writers, leaving PostgreSQL running:
docker compose stop nono-api nono-web.Restore the dump (it contains
DROP … IF EXISTS, so it replaces the current schema and data):gunzip -c /opt/nono/backups/nono-<timestamp>.sql.gz | \ docker compose exec -T nono-postgres \ sh -c 'psql -v ON_ERROR_STOP=1 --single-transaction -U "$POSTGRES_USER" -d "$POSTGRES_DB"'Redeploy the revision that was running when the dump was taken:
infra/scripts/rollback.sh <sha>(ordeploy.sh <revision>).Check
/healthand sign in to the dashboard.
Keep the old .env: if SESSION_SECRET changes, existing sessions are invalidated. Project tokens keep working because they are stored as plain SHA-256 hashes.