Deployment & operations
LineTrail runs as a Docker Compose stack: PostgreSQL, the API and the web dashboard. One API instance per database is the supported setup.
How data reaches the server
Section titled “How data reaches the server”| Path | What it syncs | Runs where |
|---|---|---|
linetrail sync |
Commits and their attribution | A developer machine, cron or CI |
linetrail pr sync / scm sync |
Pull-request attribution | A developer machine, cron or CI |
| Server-side sync (optional) | Pull-request metadata and review and merge timing | Inside the LineTrail server |
linetrail usage collect --upload (opt-in) |
Token usage metadata | Developer machines |
- Uploads go in batches (500 commits by default); each batch is one transaction. Only transient failures are retried (4 attempts by default).
- Re-running a sync is safe. It is idempotent; an incomplete sync exits with status 1, and the fix is to run the same command again.
- Use one
ingest-only service token per repository in CI, limited to that repository. - If a repository’s capture notes live on a remote, fetch them into a separate cache ref and sync from that ref. Never fetch them over the local notes directly.
Server-side pull-request sync
Section titled “Server-side pull-request sync”Off by default. When it is on, the server pulls pull-request metadata and review and merge timing itself; commits and attribution still come from the CLI or CI.
-
Generate the sync worker’s key pair on a trusted machine, never inside the API container:
Terminal window linetrail-api secrets keygen --private-key-file worker.keyIt prints
LINETRAIL_SECRETS_PUBLIC_KEY=<hex>. -
Give the API the public key and set
LINETRAIL_SERVER_SYNC=on. Give the sync worker the private key file asLINETRAIL_SECRETS_KEY_FILE, and setLINETRAIL_SYNC_WORKER_TOKEN(plusLINETRAIL_WEBHOOK_KEYif you use webhooks). The API refuses to start if it can see a private key. -
Start the worker:
Terminal window docker compose --profile server-sync up -d -
Add connections in the dashboard settings. Stored tokens are encrypted to the worker and write-only.
Back up the private key separately from database backups. To rotate it, run linetrail-api sync-worker rewrap (a dry run) and then add --yes.
Backups
Section titled “Backups”Stop writers first, then dump the database:
docker compose stop web apiumask 077docker compose exec -T postgres pg_dump -U linetrail -Fc linetrail > <backup-dir>/linetrail-<release>-<timestamp>.dump- Pause CI and sync jobs before the backup.
- Prove the dump restores into a scratch database, and keep a private copy of the matching
.env. - Scheduled backups:
scripts/backup.sh --backup-dir <dir> [--restore-check] [--keep N] [--stop-writers], for example from cron.
Restore
Section titled “Restore”docker compose exec -T postgres dropdb -U linetrail linetraildocker compose exec -T postgres createdb -U linetrail -O linetrail linetraildocker compose exec -T postgres pg_restore -U linetrail -d linetrail --no-owner --exit-on-error < <backup-dir>/<file>.dumpdocker compose up -d api # then check /readyzdocker compose up -d webA restore brings back the sessions and service tokens in the backup. Repeat every revocation made since the backup was taken.
Upgrades
Section titled “Upgrades”Order: stop writers → back up → API → check readiness → dashboard → CLIs.
- The API applies database migrations when it starts.
docker compose run --rm api migrateruns them without serving. - Migrations are forward-only. Rollback means restoring the pre-upgrade backup under the old release. Never start an older API on a database a newer one migrated.
- Keep the previous images for a fast rollback, for example
docker image tag linetrail-api:latest linetrail-api:rollback(and the same forlinetrail-web). - The CLI checks the API’s ingestion contract before every upload and uploads nothing if they don’t match.
linetrail doctor --api-url …shows the result.
Health and monitoring
Section titled “Health and monitoring”curl -s http://127.0.0.1:8080/healthz # liveness and build identitycurl -s http://127.0.0.1:8080/readyz # database reachable and migrations current; 503 otherwiseGET /metricsserves Prometheus metrics whenLINETRAIL_METRICS_TOKENis set, and requires that token.- Settings → Ingestion health shows the latest run per repository, the last success and failures with fixed reason codes.
- Settings → Capture & exclusions shows whether notes are arriving and which AI tools appear in them.
- Freshness is reported, not judged: LineTrail can’t know about commits that were never synced, so it makes no completeness claim.
- Rate limits live in each API process. DDoS protection (a CDN or WAF in front) is up to you.
Single sign-on (OpenID Connect)
Section titled “Single sign-on (OpenID Connect)”- Register a confidential client with the redirect URI
<dashboard URL>/auth/callback. The flow is Authorization Code with PKCE (S256); default scopes areopenid email profile. - Set
LINETRAIL_OIDC_ISSUER,LINETRAIL_OIDC_CLIENT_ID,LINETRAIL_OIDC_CLIENT_SECRET,LINETRAIL_OIDC_REDIRECT_URLandLINETRAIL_WEB_PUBLIC_URL: all of them or none. - Start the identity provider first. The API won’t start if it can’t discover the issuer, and the issuer URL must be reachable at the same address from browsers and from the API container. Changing the issuer later makes every user a new identity.
- Sign in, then grant the first admin with
linetrail-api admin grant.
Optional controls for corporate providers: allowed groups, allowed verified email domains, group-to-role mapping applied at each sign-in (for example lt-admins=default:admin,lt-viewers=default:viewer), and provider sign-out.
| Provider | Status |
|---|---|
| Keycloak | Tested |
| Microsoft Entra ID, Okta | Same protocol; not yet tested against a live tenant |
SCIM, back-channel logout and client-secret rotation are not supported.
Main settings
Section titled “Main settings”| Variable | Meaning |
|---|---|
POSTGRES_PASSWORD |
Database password (required) |
LINETRAIL_API_PORT, LINETRAIL_WEB_PORT |
Host ports, 8080 and 3000 by default |
LINETRAIL_WEB_PUBLIC_URL |
The dashboard URL people open; must match the web port |
LINETRAIL_API_PUBLIC_URL |
The API URL shown to CLI and CI users |
LINETRAIL_OIDC_* |
Sign-in settings (see above) |
LINETRAIL_SESSION_TTL_SECS |
Session lifetime, 8 hours by default |
LINETRAIL_RETENTION_INGESTION_RUNS_DAYS, …_USAGE_EVENTS_DAYS, …_SCM_RUNS_DAYS |
Opt-in retention, off by default |
LINETRAIL_METRICS_TOKEN |
Turns on /metrics |
LINETRAIL_SERVER_SYNC |
Server-side sync, off by default |
LINETRAIL_AI |
AI insights and chat, off by default |
Variables exported in your shell override .env.