Docs / Running yasp

Operations

Running yasp in production: backups, upgrades, keys, retention, health checks and the command line. For more than one instance, read high availability too.

# What to keep safe

Two things hold everything:

WhatWhereWithout it
The databaseThe SQLite file, or your Postgres databaseMonitors, history, incidents, subscribers, users, settings are gone
The encryption keysencryption.keys in yasp.toml or YASP_ENCRYPTION__KEYSStored secrets (SMTP password, channel tokens, webhook secrets, secret check headers, the VAPID key) can't be read, and yasp refuses to start on that database

Backups don't contain the keys. Store the keys separately, in a secrets manager or password vault, not next to the backups. Keep yasp.toml too, or whatever sets your environment.

# Backups

yasp backup writes a consistent copy while yasp keeps running:

yasp backup /var/backups/yasp/yasp-2026-11-30.db
DatabaseWhat it does
SQLiteAn online copy (VACUUM INTO): a complete database file. Copying the live file instead isn't safe
PostgresRuns pg_dump --format=custom --no-owner. Needs the PostgreSQL client tools on the machine

It refuses to overwrite an existing file, so put the date in the name. It reads the same configuration as yasp serve (the file or YASP_ variables), including the keys, so run it where yasp's settings are available.

In Docker, with SQLite, write the copy into the volume and take it out:

docker exec yasp yasp backup /data/yasp-2026-11-30.db
docker cp yasp:/data/yasp-2026-11-30.db .

The image has no pg_dump. With Postgres, run pg_dump -Fc --no-owner from another machine or container, or use your provider's snapshots and point-in-time recovery, which give the best recovery point. For continuous SQLite replication, Litestream works alongside yasp.

yasp config export is a useful extra: monitors, components and settings as reviewable JSON (see config export and import). It isn't a backup: it has no history, subscribers or users.

# Restoring

Stop every instance first, then:

yasp restore /var/backups/yasp/yasp-2026-11-30.db --yes
  • SQLite: it checks that the file is a yasp database, removes the old -wal and -shm files and copies the backup over the database file.
  • Postgres: it runs pg_restore --clean --if-exists --no-owner into the configured database.

Start yasp with the same encryption keys the backup was made with. If they don't match, startup stops with a key error.

# Upgrading

  1. Read the changelog for every release between yours and the new one.
  2. Back up.
  3. Replace the binary or image, and start it.

Migrations run when yasp serve starts, in one transaction under a database lock: an upgrade either applies completely or not at all, and two instances starting together don't both migrate. yasp migrate does the same without serving, if you'd rather migrate first.

Migrations are forward-only. An older yasp refuses to start on a database a newer one has migrated, so going back means restoring the backup you made before upgrading and running the old version.

Pin versions instead of following latest. Each release is tagged both ways, e.g. ghcr.io/yasp-dev/yasp:0.1.1 and :v0.1.1. For rolling upgrades with standbys, see high availability. To check a download, see verifying a release.

# Encryption keys

encryption.keys is a keyring. The first key is primary: new secrets are encrypted with it, and new subscriber links are signed with it. Every key in the list can still decrypt what it encrypted. Each key has an id, which is stored next to everything it encrypted.

To rotate to a new key:

  1. Generate one with a new id:

    yasp keys generate --id k2
  2. Put it first and keep the old one after it:

    [[encryption.keys]]
    id = "k2"
    key = "base64:…"
    
    [[encryption.keys]]
    id = "k1"
    key = "base64:…"
  3. Restart every instance with the same list. yasp check-config prints how many keys there are and which is primary.

From then on, new and edited secrets use k2.

  1. Re-encrypt everything that's still under k1. It's safe while yasp runs:

    yasp keys rotate
    # in Docker: docker exec yasp yasp keys rotate

    It re-encrypts every stored secret with the primary key and updates the startup check, then says how many secrets it changed.

  2. Remove k1 from the list and restart. Manage and unsubscribe links in emails sent before the rotation were signed with k1 and stop working once it's gone, so you may want to keep it a few weeks first.

Startup refuses a keyring that doesn't match the database: a key with the right id but different bytes, or a missing key. That protects you from starting with the wrong key and writing secrets nobody can read.

# Retention

Under Configuration → Data retention (admins):

SettingDefaultRangeWhat's deleted
Check results35 days7–3650Raw results. Response-time charts show up to 30 days, so keep at least that
Sent messages90 days7–3650The send log, and the queued events behind it once they've been sent
Audit log400 days30–3650Audit entries

Without settings, other data is pruned on fixed schedules:

  • used and expired sign-in links after a day,
  • Test now results after an hour,
  • page view counts and metric points after about 400 days,
  • unconfirmed email subscribers after 48 hours.

Status history (the daily bars and monthly reports) is kept forever; it's one row per status change. The leader prunes every 10 minutes, in small batches, so the database is never locked for long.

# Privacy requests

To answer a GDPR or CCPA request, go to Configuration → Privacy requests (admins) and enter the email address:

  • Download their data gives a JSON file with their subscriptions (kind, followed components, when they subscribed and confirmed, last delivery, suppression) and any dashboard account (name, role, last sign-in).
  • Erase subscriptions deletes every subscription of that address, for good.

Dashboard accounts are disabled on the Users page. Subscribers can also delete their own subscription from the link in every email; see notifications.

# Health checks

EndpointChecksUse it for
GET /healthzNothing beyond the process answering. Never touches the databaseLiveness: restart the process if it fails
GET /readyzThe database answers within 2 seconds. 200, or 503 when it doesn'tReadiness and load balancers

/readyz answers {"status": "ok", "database": "ok", "leader": true}. A standby says "leader": false and is still ready: it serves everything. The server only starts listening after migrations finish.

A slow database fails /readyz but not /healthz, so an orchestrator takes the instance out of rotation instead of restarting it. In Kubernetes:

livenessProbe:
  httpGet: { path: /healthz, port: 8080 }
readinessProbe:
  httpGet: { path: /readyz, port: 8080 }

The image is distroless (no shell or curl), so use HTTP probes from the orchestrator rather than a command inside the container.

To find out when yasp itself is down, set self_monitor.heartbeat_url to an external dead-man's switch (healthchecks.io, Cronitor, an Uptime Kuma push monitor). The leader pings it every 60 seconds.

# Metrics, traces and logs

Prometheus metrics are at /metrics and traces go to OpenTelemetry; see observability.

Logs go to stdout as JSON. For readable lines, use --log-format pretty or YASP_LOG_FORMAT=pretty. The level comes from RUST_LOG, default info:

RUST_LOG=info,yasp_notify=debug yasp serve

Secrets are never logged. Deliveries that fail for good or give up are logged as warnings with the delivery id and transport, so they're easy to alert on.

# The command line

The same binary has commands for setup and recovery. They read the same configuration as yasp serve, connect to the database directly, and apply migrations first.

CommandWhat it does
yasp check-configValidates the configuration and prints a summary, without secrets
yasp migrate [--database-url URL]Applies pending migrations
yasp keys generate [--id ID]Prints a new encryption key
yasp keys rotateRe-encrypts every stored secret with the primary key, so older keys can be removed
yasp admin invite --email E --role RLets someone sign in with emailed links (needs [email_login] enabled = true) and prints a one-time sign-in link, valid 15 minutes
yasp admin grant --email E --role RGives a signed-in user a local role (viewer, editor, admin). For lockouts
yasp admin revoke --email ERemoves the local role; a role from the identity provider still applies
yasp admin listUsers and their roles
yasp probe create --slug S --name N [--location L]Creates a probe and prints a one-time token, valid 24 hours
yasp probe token SLUGA fresh token for a probe that hasn't enrolled
yasp probe revoke SLUGRevokes a probe
yasp probe listProbes, versions, last seen and clock offset
yasp config export [--out FILE], yasp config import FILE [--dry-run]See config export and import
yasp backup FILE, yasp restore FILE --yesSee above
yasp demo-seedAdds sample data, for trying yasp
yasp theme-fixtures <dir>Adds sample pages for checking themes, from the themes repository's fixtures/
yasp versionPrints the version

admin grant needs the person to have signed in once. In Docker, prefix the command with docker exec yasp.

# Resources

Each instance keeps a database pool of up to 8 connections on SQLite and 16 on Postgres. With several instances on one Postgres server, leave room in its max_connections. SQLite runs one instance only; use Postgres for more (see high availability).

# Behind a reverse proxy

yasp listens on 127.0.0.1:8080 by default (0.0.0.0:8080 in the image), so a proxy on the same machine can reach it. Set base_url to the public address. When it starts with https://, cookies are marked Secure.

Tell yasp which proxies to believe, so it sees the visitor's address rather than the proxy's:

[server]
trusted_proxies = ["127.0.0.1/32", "10.0.0.0/8"]

When a request comes from a trusted proxy, yasp takes the right-most address in X-Forwarded-For that isn't itself a trusted proxy. Requests from anywhere else use the TCP peer address, and their X-Forwarded-For is ignored. Only X-Forwarded-For is read. The client address drives the per-address limits on the subscribe and sign-in forms, private pages' allowed networks, and the IP in the audit log. Without trusted_proxies, all of those see the proxy's address.

The proxy must:

  • pass the original Host header, so custom domains reach the right status page,
  • set X-Forwarded-For,
  • allow responses to take at least 30 seconds: probes long-poll for 25.

nginx:

location / {
    proxy_pass http://127.0.0.1:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_read_timeout 60s;
}

Caddy does all three by default:

status.example.com {
    reverse_proxy 127.0.0.1:8080
}

To have yasp serve HTTPS itself, with automatic certificates for custom domains, see HTTPS and custom domains.