Skip to content

Self-hosting overview

You can run SREInsights on your own infrastructure instead of using https://console.sreinsights.com. This page compares the three ways to do it and lists what every instance needs, whichever you choose.

Docker Compose with your Postgres One EC2 instance Serverless on AWS
What runs migrate, app and worker containers on a host with Docker, against a Postgres server you already have Postgres, migrate, app, worker and Caddy (TLS) in Docker Compose on one instance Three AWS Lambda functions (API, tick, migrate), an API Gateway HTTP API, an EventBridge schedule, and Postgres on RDS
What stays up The app and worker containers, and your database The whole instance Only the database. Nothing else runs between requests
Cost floor Your host and your database One instance. A t3.medium or t4g.medium (4 GB) can build the images itself; a smaller one should pull published images The database: the smallest RDS instance with 20 GB of storage is roughly $15 a month (check AWS pricing)
Shortest schedule 30 s 30 s 60 s (one tick a minute)
Best for Teams that already run Docker hosts and Postgres A complete instance on one box, with backups to S3 An instance of your own in your own AWS account, with Lambda runner groups for the runs

The server process is the same in the first two: the image deploy/Dockerfile run in different roles. The serverless option runs the same code as functions, with the limits that brings.

  • PostgreSQL 14 or newer. One database, sreinsights by default.

  • Three database roles. deploy/postgres/setup.sql creates them and the database. Run it once as a superuser or, on RDS, as the master user. The role names are fixed, because migrations refer to them.

    Role Used by Row-level security
    sreinsights_owner Migrations only (DATABASE_OWNER_URL) Owns the schema
    sreinsights_app Every API request (DATABASE_URL) Enforced. Queries see only the organization of the request
    sreinsights_system Sign-in before an organization is chosen, scheduler claims, retention, seeds and operator commands (SYSTEM_DATABASE_URL) Bypassed
  • A master key, backed up. SREINSIGHTS_MASTER_KEY (openssl rand -base64 32) wraps each organization’s data key, which encrypts every stored connection secret. Keep a copy somewhere other than the server. Losing or changing it makes those secrets unreadable.

  • A session secret. SREINSIGHTS_SESSION_SECRET, at least 32 characters.

  • A URL with TLS. SREINSIGHTS_BASE_URL, for example https://sreinsights.example.com. The web app, /api and /runner/v1 share this one origin; the sign-in refresh cookie needs that.

The full list of settings is in Environment variables.

Runners are not part of the instance. Every check runs on a runner, and the control plane never executes one itself. Runners run inside the networks they monitor and connect out to your SREInsights URL: they need no inbound port and no domain. See Runners.

  • Point each runner’s SREINSIGHTS_URL at your instance. If runners reach it at another address than people do, set SREINSIGHTS_API_URL on the instance, and the Runners page shows that address in its install commands.
  • Set SREINSIGHTS_RUNNER_IMAGE if you publish your own runner image, so the Runners page tells people to run it.
  • Lambda runner groups are off unless you set SREINSIGHTS_LAMBDA_RUNNERS=true. Turn it on only when you trust every organization on the instance with the server’s AWS credentials. The serverless option turns it on by default.
  • Behind a proxy, allow requests of at least 25 seconds: polling runners hold their lease requests open that long when there is no work.

The server image runs as one of these roles. Its first argument picks the role (and sets SREINSIGHTS_ROLE):

Role What it does
api HTTP only: the API, the runner protocol, and the web app (the image sets SREINSIGHTS_WEB_DIR=/app/web)
scheduler Run queue maintenance, and the dispatcher that invokes the functions of Lambda runner groups (only with SREINSIGHTS_LAMBDA_RUNNERS=true or SREINSIGHTS_HOSTED_LAMBDA_RUNNERS=true)
processor Alert evaluation and notification delivery
worker scheduler and processor together, as one background service
all Every role. The default, for local development
migrate Applies migrations as the schema owner and seeds built-in roles and plans, then exits. Run it before the others on every deploy

The Compose deployments run migrate, then app (role api) and worker. You can run more than one app and more than one worker: every claim uses FOR UPDATE SKIP LOCKED or a lock, so several schedulers and processors can run at once, and containers that overlap during a redeploy are safe.

On a serverless instance there are no roles: the http function is the api role, and the tick function does the work of scheduler and processor, one round per invocation.

The same image also runs the operator commands: runners, connections, clients and syncs.