Edit this page on GitHub ↗

Operations

Lares is the most production-shaped project in the lab: tenant-scoped data, RBAC, OIDC, DSAR, metered billing, and a Postgres path. The reference core stays dependency-free and loopback-first.

Configuration

All settings are environment variables with safe defaults.

Variable Default Meaning
LARES_HOST 127.0.0.1 Bind address. A non-loopback host requires auth or an explicit flag.
LARES_PORT 8787 Bind port.
LARES_DATABASE_URL sqlite:///lares.db memory, a path, sqlite://…, or postgresql://….
LARES_LOG_JSON true Structured JSON logs.
LARES_ALLOWED_ORIGINS empty CORS origins.
LARES_RATE_LIMIT_PER_MINUTE 120 Per-key rate.
LARES_RATE_LIMIT_BURST 40 Token-bucket burst.
LARES_MAX_BODY_BYTES 1000000 Request body limit.
LARES_IDEMPOTENCY_TTL 86400 Idempotency-key lifetime.
LARES_RETENTION_DAYS 90 Event and finished-job retention.

Auth, tenancy and the edge

Lares supports three modes:

Tenancy and roles come from claims:

LARES_OIDC_TENANT_CLAIM=tenant_id
LARES_OIDC_ROLES_CLAIM=roles

Cross-tenant reads return 404, not a filtered list. That is intentional: a tenant should not learn that another tenant's object exists.

The edge pattern: terminate TLS and authenticate at the proxy, then pass a short-lived signed session to Lares. Do not inject a shared static admin token for every visitor; that collapses every user into one principal and defeats the tenant model.

Safety and privacy

Do not claim SOC 2, COPPA, or GDPR compliance until the controls are implemented and audited. The reference core is a baseline, not a certification.

Billing and usage

The usage ledger records model spend per tenant, character and day.

lares usage report --tenant <tenant>
lares usage export --customers <file>
lares audit usage

audit usage reports per-tenant spend, unbilled attempts, and estimate exposure. LARES_STRIPE_WEBHOOK_SECRET verifies Stripe webhook signatures; LARES_WEBHOOK_TOLERANCE sets the timestamp tolerance.

Deployment checklist

  1. Python 3.11+, a writable database, and a non-root user.
  2. Keep the bind on loopback unless auth is configured.
  3. Set LARES_AUTH_SECRET or OIDC; never expose the static admin token to browsers.
  4. Migrate the schema (lares db migrate) before serving.
  5. Run lares maintain on a schedule and keep LARES_RETENTION_DAYS honest.
  6. Back up the database and test a restore.
  7. Verify cross-tenant 404 and DSAR export/erase before inviting a second tenant.
  8. Put a model budget and a kill switch in front of any public launch.

Read next