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:
| What | Where | Without it |
|---|---|---|
| The database | The SQLite file, or your Postgres database | Monitors, history, incidents, subscribers, users, settings are gone |
| The encryption keys | encryption.keys in yasp.toml or YASP_ENCRYPTION__KEYS | Stored 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| Database | What it does |
|---|---|
| SQLite | An online copy (VACUUM INTO): a complete database file. Copying the live file instead isn't safe |
| Postgres | Runs 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
-waland-shmfiles and copies the backup over the database file. - Postgres: it runs
pg_restore --clean --if-exists --no-ownerinto 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
- Read the changelog for every release between yours and the new one.
- Back up.
- 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:
-
Generate one with a new id:
yasp keys generate --id k2 -
Put it first and keep the old one after it:
[[encryption.keys]] id = "k2" key = "base64:…" [[encryption.keys]] id = "k1" key = "base64:…" -
Restart every instance with the same list.
yasp check-configprints how many keys there are and which is primary.
From then on, new and edited secrets use k2.
-
Re-encrypt everything that's still under
k1. It's safe while yasp runs:yasp keys rotate # in Docker: docker exec yasp yasp keys rotateIt re-encrypts every stored secret with the primary key and updates the startup check, then says how many secrets it changed.
-
Remove
k1from the list and restart. Manage and unsubscribe links in emails sent before the rotation were signed withk1and 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):
| Setting | Default | Range | What's deleted |
|---|---|---|---|
| Check results | 35 days | 7–3650 | Raw results. Response-time charts show up to 30 days, so keep at least that |
| Sent messages | 90 days | 7–3650 | The send log, and the queued events behind it once they've been sent |
| Audit log | 400 days | 30–3650 | Audit 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
| Endpoint | Checks | Use it for |
|---|---|---|
GET /healthz | Nothing beyond the process answering. Never touches the database | Liveness: restart the process if it fails |
GET /readyz | The database answers within 2 seconds. 200, or 503 when it doesn't | Readiness 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.
| Command | What it does |
|---|---|
yasp check-config | Validates 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 rotate | Re-encrypts every stored secret with the primary key, so older keys can be removed |
yasp admin invite --email E --role R | Lets 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 R | Gives a signed-in user a local role (viewer, editor, admin). For lockouts |
yasp admin revoke --email E | Removes the local role; a role from the identity provider still applies |
yasp admin list | Users 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 SLUG | A fresh token for a probe that hasn't enrolled |
yasp probe revoke SLUG | Revokes a probe |
yasp probe list | Probes, 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 --yes | See above |
yasp demo-seed | Adds sample data, for trying yasp |
yasp theme-fixtures <dir> | Adds sample pages for checking themes, from the themes repository's fixtures/ |
yasp version | Prints 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
Hostheader, 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.