Skip to content

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.

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.

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.

  1. 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.key

    It prints LINETRAIL_SECRETS_PUBLIC_KEY=<hex>.

  2. Give the API the public key and set LINETRAIL_SERVER_SYNC=on. Give the sync worker the private key file as LINETRAIL_SECRETS_KEY_FILE, and set LINETRAIL_SYNC_WORKER_TOKEN (plus LINETRAIL_WEBHOOK_KEY if you use webhooks). The API refuses to start if it can see a private key.

  3. Start the worker:

    Terminal window
    docker compose --profile server-sync up -d
  4. 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.

Stop writers first, then dump the database:

Terminal window
docker compose stop web api
umask 077
docker 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.
Terminal window
docker compose exec -T postgres dropdb -U linetrail linetrail
docker compose exec -T postgres createdb -U linetrail -O linetrail linetrail
docker compose exec -T postgres pg_restore -U linetrail -d linetrail --no-owner --exit-on-error < <backup-dir>/<file>.dump
docker compose up -d api # then check /readyz
docker compose up -d web

A restore brings back the sessions and service tokens in the backup. Repeat every revocation made since the backup was taken.

Order: stop writers → back up → API → check readiness → dashboard → CLIs.

  • The API applies database migrations when it starts. docker compose run --rm api migrate runs 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 for linetrail-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.
Terminal window
curl -s http://127.0.0.1:8080/healthz # liveness and build identity
curl -s http://127.0.0.1:8080/readyz # database reachable and migrations current; 503 otherwise
  • GET /metrics serves Prometheus metrics when LINETRAIL_METRICS_TOKEN is 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.
  1. Register a confidential client with the redirect URI <dashboard URL>/auth/callback. The flow is Authorization Code with PKCE (S256); default scopes are openid email profile.
  2. Set LINETRAIL_OIDC_ISSUER, LINETRAIL_OIDC_CLIENT_ID, LINETRAIL_OIDC_CLIENT_SECRET, LINETRAIL_OIDC_REDIRECT_URL and LINETRAIL_WEB_PUBLIC_URL: all of them or none.
  3. 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.
  4. 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.

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.