Self-Hosting

Production Checklist

What to verify before taking an Appstrate instance live.

The defaults suit local development. Going live takes a few deliberate decisions. Walk through this list before you open the instance to real users. Variables are described in Environment Variables, and appstrate install already does several of these steps for you.

Choose the stack

  • Single node: Tier 2 (PostgreSQL and Redis, files on a persisted volume) with RUN_ADAPTER=docker. This is the installer's recommended stack.
  • Several platform instances, or object storage: add S3-compatible storage (S3_BUCKET, S3_REGION, S3_ENDPOINT for MinIO or R2) and point every instance at the same PostgreSQL, Redis and bucket. Bundled MinIO is Tier 3.
  • A microVM per run: RUN_ADAPTER=firecracker is an early preview. Read Firecracker for the workloads it suits.
  • Do not use Tier 0, Tier 1 or RUN_ADAPTER=process in production. They give up persistence, shared state or isolation. See Progressive Infrastructure.

Terminate TLS and set the public URL

Appstrate does not terminate HTTPS. Put a reverse proxy in front (nginx, Caddy, Traefik, or a cloud load balancer) and set:

APP_URL=https://appstrate.example.com
TRUST_PROXY=1

With NODE_ENV=production, APP_URL must be HTTPS (loopback excepted), and an HTTPS APP_URL with TRUST_PROXY=false refuses to boot. TRUST_PROXY is the number of proxies that append to X-Forwarded-For, and a value higher than your topology lets callers spoof their IP. Raise the proxy's body limit above your largest upload (100 MiB by default) and do not buffer or compress event streams. See Docker Compose.

Preview

The instance's own metadata document as an OAuth client, and the INTEGRATION_OAUTH_CIMD setting, are not yet in the latest release.

Remote MCP integrations connect by OAuth, and by default this instance presents a metadata document at APP_URL to authorization servers that accept one, which only works when APP_URL is reachable from the internet. If it is not (internal hostname, split DNS, an access proxy), set INTEGRATION_OAUTH_CIMD=off so the instance registers its clients dynamically instead. Changing the origin of APP_URL later flags the connections minted with a document client for reconnection. See Environment Variables.

Generate and protect the secrets

Five secrets are required, and each rotates independently:

VariableFormatImpact of changing it
BETTER_AUTH_SECRETRandom stringChanging it in place leaves what was encrypted under it (the keys that sign CLI and OIDC tokens) unreadable. Rotate through the BETTER_AUTH_SECRETS keyring instead, which signs everyone out
CONNECTION_ENCRYPTION_KEY32 bytes, base64Stored credentials become unreadable unless you rotate with a key id. See the rotation procedure in Environment Variables
UPLOAD_SIGNING_SECRETAt least 16 charactersInvalidates in-flight upload tokens
RUN_TOKEN_SECRETAt least 16 charactersInvalidates tokens of in-flight runs
CONNECT_SESSION_SECRETAt least 16 charactersInvalidates in-flight connect sessions

The installer generates them. If you do it by hand, use openssl rand -hex 32 for the first four and openssl rand -base64 32 for the encryption key. Keep them in a secret manager, never in git, and keep an offline copy of CONNECTION_ENCRYPTION_KEY: without it, no backup of the database can decrypt the credentials it holds.

Close the instance

Open mode lets anyone with the URL create an account and an organization. For a private deployment, run in closed mode: AUTH_DISABLE_SIGNUP, AUTH_DISABLE_ORG_CREATION, AUTH_PLATFORM_ADMIN_EMAILS and a one-time AUTH_BOOTSTRAP_TOKEN, claimed at <APP_URL>/claim. The installer sets this up when you give it an owner email or run unattended. Then:

  • Remove AUTH_BOOTSTRAP_TOKEN from .env once the instance is claimed.
  • Check that you can sign in to every address listed in AUTH_BOOTSTRAP_OWNER_EMAIL and AUTH_PLATFORM_ADMIN_EMAILS.
  • If your Compose file predates 1.0.0-beta.65, confirm it forwards AUTH_BOOTSTRAP_TOKEN to the container. The current files do (see Docker Compose).

The full recipes and pitfalls are in AUTH_MODES.md.

Restrict CORS

TRUSTED_ORIGINS is a comma-separated list of browser origins trusted beyond APP_URL's own, which needs no entry. It is empty by default and adds no origin. Set it only for another origin that calls the API with cookies, or that a sign-in may redirect back to (a separate front end, for example).

Review the limits

The defaults are conservative: 200 run launches per minute and 50 concurrent runs per organization, a 30 minute run ceiling, and 1536 MiB and 2 vCPU per run. Override only what you need, in PLATFORM_RUN_LIMITS and INLINE_RUN_LIMITS. Lower timeout_ceiling_seconds if your agents never need 30 minutes. Pair rate limiting with Redis, otherwise limits are per process and reset on restart. See Rate Limits.

Pin image versions

Pin one release for every image:

APPSTRATE_VERSION=1.0.0-beta.68

Tags have no v prefix. APPSTRATE_VERSION is a Compose variable that moves the platform, the agent runtime, the sidecar and the MCP runner images together, and the platform refuses to boot if the platform and runtime image versions disagree. If you run your own Compose file, pin all of them yourself. Read Upgrading before changing the pin.

Configure model providers

Appstrate needs at least one LLM provider. Either set SYSTEM_PROVIDER_KEYS (a JSON array of providers with their models, injected by the sidecar and never exposed to agents) or let organizations add their own. A model on a private endpoint needs its host in EGRESS_ALLOW_INTERNAL_HOSTS. An administrator can instead set a configuration to be provided by each member: the organization then connects nothing for it, and every member brings their own key or subscription (see LLM Models).

Review egress

Agents can only reach hosts that an integration's authorized_uris allows, and private ranges are blocked. If an integration must call an internal API, add its host to EGRESS_ALLOW_INTERNAL_HOSTS. That is an instance-wide trust decision: a listed host also opens at the TCP level to the local integration runners of every organization, on the ports their authorized_uris names literally. List only hosts that every organization may reach. That includes host.docker.internal, often listed for a local model: it is not loopback, so listing it opens the Docker host's declared ports to those runners. On RUN_ADAPTER=firecracker, a private host also needs its range left out of the runner's deny list, see Firecracker. The sidecar needs working DNS. See Isolation and Security.

The API process itself also makes outbound requests to get.appstrate.dev to read the live model catalog. On a network that must stay closed, set MODEL_CATALOG_URL=off (see Isolation and Security).

Configure email

Email verification and magic-link sign-in need SMTP. Set SMTP_HOST, SMTP_USER, SMTP_PASS and SMTP_FROM together (SMTP_PORT defaults to 587): mail is enabled only when all four are set, and no error is raised when they are not. Test with a magic link or a password reset before go-live.

With SMTP on, the instance also mails account notices: a password change or reset is reported to the account's address, a sign-up with an address that already has an account is answered at that address, and an email change must be approved from the current address before anything is sent to the new one. Without SMTP, an email change applies at once, with no confirmation.

These sign-in and account emails are written in the language of the account's profile, and in French for an address that has no account yet (a magic-link sign-up). When the mail server refuses one, the request still answers as if it had been sent, and the platform logs the warning auth: auth e-mail not sent with the template name, addresses masked. Look for it when you test.

The Compose files shipped with Appstrate forward the SMTP and the Google, GitHub and Microsoft sign-in variables. A file copied from an earlier release may not, so check that the ones you set are listed under appstrate.environment (see Docker Compose).

Sign in with Microsoft Entra ID

Set MICROSOFT_CLIENT_ID and MICROSOFT_CLIENT_SECRET to add a "Continue with Microsoft" button for work and school accounts. Google and GitHub sign-in follow the same pattern, with their own variable pairs.

  1. In the Entra admin center, open App registrations, then New registration. For Supported account types, choose "Accounts in any organizational directory" (multitenant), "Accounts in any organizational directory and personal Microsoft accounts" (to also admit personal accounts) or "Accounts in this organizational directory only" (single tenant).
  2. Add a Web redirect URI: {APP_URL}/api/auth/callback/microsoft. Entra requires https, except for the exact host localhost: a local http://<name>.localhost address is accepted at registration but refused at sign-in (AADSTS500117).
  3. Under Certificates & secrets, create a client secret.
  4. Under Token configuration, choose Add optional claim, token type ID, and add email and xms_edov.
  5. Set the variables, and MICROSOFT_TENANT_ID when needed:
MICROSOFT_CLIENT_ID=<application (client) ID>
MICROSOFT_CLIENT_SECRET=<client secret value>
# optional: organizations (default), common, consumers or a tenant GUID
MICROSOFT_TENANT_ID=organizations

MICROSOFT_TENANT_ID decides who may sign in, and must match the supported account types of the app registration:

ValueWho may sign in
organizations (default)Work and school accounts of any tenant
commonWork and school accounts, and personal Microsoft accounts (Outlook.com, Hotmail, Live)
consumersPersonal Microsoft accounts only
a tenant GUIDThat tenant's members only (required for a single-tenant app registration)

The sign-in always shows Microsoft's account picker, so a user signed in to several Microsoft accounts chooses which one to use.

Appstrate checks the tenant itself: the token's issuer must name the account's own tenant, and MICROSOFT_TENANT_ID must admit that tenant. Guest users of a tenant are always refused: an account is accepted only when a member signs in to their own tenant. A personal account is a member of Microsoft's consumer tenant.

xms_edov is required. An Entra administrator can set any email address on a user, so an address alone proves nothing. Appstrate accepts a Microsoft identity only when Entra asserts, through xms_edov, that the tenant verified the domain of that address. For a personal account the claim means less: Microsoft verified that the user controlled the address, and no organization vouches for its domain. Under common or consumers, AUTH_ALLOWED_SIGNUP_DOMAINS and the linking to an existing account with the same address rest on that verification. Without the claim, or when it is false, the sign-in is refused with email_not_found, and linking a Microsoft account from the preferences page is refused too. Each refusal is logged as auth: Microsoft sign-in refused, with the tenant id and the reason: if every member of a tenant is refused at once, check that the app registration still emits xms_edov.

Never set removeUnverifiedEmailClaim to false on the app registration (authenticationBehaviors in Microsoft Graph). Its default removes the email claim when Entra cannot verify the domain, and it is the first line of defense against forged addresses.

An instance that serves a single organization is simpler to run with its tenant GUID in MICROSOFT_TENANT_ID: only that tenant's administrator can then set the addresses its members sign in with.

A tenant that restricts user consent needs an administrator to grant consent once before its members can sign in.

Choose your modules

MODULES defaults to oidc,webhooks,mcp,core-providers,@appstrate/module-chat. Drop what you do not use to reduce the attack surface, but keep oidc if you use the CLI. The opt-in modules are listed in Progressive Infrastructure.

Protect the Docker socket

The docker backend needs the socket, and access to it is root on the host. Keep it root:docker 0660, run the platform with the host's docker group (DOCKER_GID in the tier templates), and read the socket-proxy notes in the root docker-compose.yml. See Isolation and Security.

Set up monitoring

  • Health. GET /health returns healthy, degraded, unhealthy or starting with per-subsystem checks, answering 503 when the database is unhealthy or the server is still starting. Right after startup it reports degraded for a short window while the run capacity initializes, and launches answer 503 run_capacity_starting (retry after Retry-After) until it is ready. GET / serves the dashboard and is not a health signal.
  • Logs. The platform writes structured JSON to stdout. LOG_LEVEL=info is the default. Use debug during incidents (it adds one access line per request), and warn for steady state. Forward the logs to your stack and correlate on the Request-Id response header.
  • Traces and metrics. Append @appstrate/module-observability to MODULES and set OTEL_EXPORTER_OTLP_ENDPOINT to export OpenTelemetry over OTLP/HTTP. It is off by default. See OBSERVABILITY.md.
  • Log levels and messages change between releases. Check the operator notes before you rely on a log line for an alert.

Plan backups

Appstrate has no built-in backup tool. Use your existing playbook, and test a restore.

  • PostgreSQL: a nightly logical dump (pg_dump -Fc), kept off the host. This holds your users, agents, runs and encrypted credentials.
  • Secrets: CONNECTION_ENCRYPTION_KEY and the other secrets, stored separately from the database dump.
  • Files: the storagedata volume on Tier 1 and 2, or the S3 bucket (versioning and replication) on Tier 3 and with your own S3. On Tier 3 the bundled MinIO volume is miniodata.
  • Redis: holds the queue behind scheduled runs, webhook deliveries and other background jobs, plus run-event buffers. The Compose files persist it on a volume. Keep that volume if losing queued work matters, or use a replicated Redis.
  • A one-off script, scripts/storage-orphans.ts, reconciles stored objects against database rows. Run it in dry-run mode first.

Set LEGAL_TERMS_URL and LEGAL_PRIVACY_URL to show your policies in the footer.

Plan upgrades

Migrations run at boot (set MIGRATIONS_ON_BOOT=verify when a separate step owns them: boot then applies nothing and refuses to start while one is pending), there is no built-in rollback, and some releases need operator steps before the deploy. Pin versions, rehearse in staging, take a database backup and read the operator notes of every release you skip. See Upgrading.

Sanity check before go-live

# 1. Health
curl https://appstrate.example.com/health

# 2. Auth is enforced (expect 401)
curl -i https://appstrate.example.com/api/agents

# 3. OpenAPI is served
curl https://appstrate.example.com/api/openapi.json | jq .info

Then, in the dashboard: sign in as the owner, add a model, run a trivial agent end to end, and confirm a signed-out visitor cannot create an account (in closed mode). If the three commands answer as expected and the agent run succeeds, you are production-ready.

On this page