Operations
Health checks, logs, offline commands, PostgreSQL outages, stopped processing and animated emoji.
Compose commands by hand
mvp-stack.py calls Docker Compose with the files in the state directory. For commands by hand, use
this shell function (PostgreSQL is included here; add -f compose.push.yaml,
compose.bridge.yaml or compose.transcriber.yaml if you turned those on):
cd .local/mvp
dc() { docker compose --project-name comon-mvp --project-directory . --env-file stack.env \
-f compose.yaml -f compose.sql.yaml "$@"; }
dc ps # what is running
dc logs -f federation # the server's log
dc restart federation # restart one serviceServices: gateway (Caddy), federation, migrate, postgres, identity (Keycloak), sfu,
turn, web, push-relay, bridge, transcriber.
Health checks
python3 tools/mvp-stack.py checkThe command checks /health, /ready, the federation document, Keycloak and, when push is on,
/push/healthz. You can also ask the server directly:
| Path | Answer |
|---|---|
/health | 200 while the process is alive. Does not touch the database. |
/ready | 200 and "status": "ready" when the database answers and the schema matches; otherwise 503 and "status": "unavailable". The reason is only in the server's log. |
The /ready answer works for monitoring:
{
"status": "ready",
"latency_ms": 1,
"sql": { "connections": { "open": 3, "budget": 3 } },
"sync_projections": { "pending": 0, "oldest_age_ms": 0, "poisoned": 0 },
"jobs": { "<job>": { "running": true, "failures": 0, "last_success_age_ms": 1200 } },
"outbound": "held"
}sql: counts and durations of this process's queries, never statements or rows.sync_projections: changes not yet delivered to people's feeds: how many wait, the age of the oldest and how many have stopped (poisoned). A lag does not make the server unready: accepted messages are already stored.jobs: background jobs. A failing job keeps retrying and shows here; the server keeps working.outbound: held: the server was restored from a backup and does not send held work yet (restoring).
Watch the /ready status code, growing poisoned and failures, and an oldest_age_ms that keeps
growing.
Logs
The server writes to standard output: dc logs federation. Lines with calls describe calls
(calls), restore_missing_media lines list missing files after a restore.
Message texts and tokens never get into the log.
Offline commands
federation_admin, reset_profile_password and install_system_stickers take the same writer
lock as the server, so stop it first:
dc stop federation
dc run --rm --no-deps --entrypoint /app/bin/federation_admin federation \
--data=/data --postgres-conninfo-file=/run/secrets/postgres-conninfo list
dc start federationfederation_admin is in the server image. reset_profile_password and install_system_stickers
run from the source with dart run and access to the database
(resetting the cloud password). All commands are in
the server options.
Outages
| What happened | What you see | What to do |
|---|---|---|
| PostgreSQL restarted or crashed | /ready answers 503 and does not recover by itself | Restart the server: mvp-stack.py stop, then up. Stored messages are safe; a send in flight at the moment of the outage is retried by the app. |
| The server restarted | Apps lose their connection for seconds | Nothing: they reconnect by themselves. Restart the server when there are few calls. |
| The SFU restarted | Group calls go quiet for seconds | Nothing: participants reconnect, spread over up to three seconds. |
| A second server on the same database | It does not start | As designed: there is only one writer. |
The server does not start with MediaVolumeMismatch | The database and the media volume come from different installations | Attach the volume taken together with the database (how the server works). |
Database queries are limited to 30 seconds, lock waits to 10 seconds. All parts of the server
share up to 3 connections to PostgreSQL, one of which holds the right to write; migrate_database
opens its own.
Stopped processing
Each change reaches a member's feed through processing that is retried with pauses. After its last
attempt it stops, and that member's feed waits behind it so the order is never broken. In /ready,
sync_projections.poisoned grows.
-
Find the error in the server's log and fix its cause (for example, upgrade to a build with the fix).
-
Stop the server.
-
List and restart the processing:
dc run --rm --no-deps --entrypoint /app/bin/federation_admin federation \ --data=/data --postgres-conninfo-file=/run/secrets/postgres-conninfo incidents dc run --rm --no-deps --entrypoint /app/bin/federation_admin federation \ --data=/data --postgres-conninfo-file=/run/secrets/postgres-conninfo \ redrive --target=<profile> --scope=<scope> --seq=<n> -
Start the server: the feed continues in order, skipping nothing.
Animated emoji
A message of a single emoji is animated when the server has the AnimatedEmoji system set. Install
it from Google's open Noto Animated Emoji (CC BY 4.0), with the server stopped, from
backend/comon_federation_server:
dart run bin/install_system_stickers.dart --data=<data directory> \
--postgres-conninfo-file=<file> --source=<directory> --fetch-notoRunning it again adds only new emoji. The same command installs your own system sticker sets
(--short-name, --title, --kind=stickers|emoji).
Error reports
The server can send error reports to your own Sentry: --sentry-dsn, --sentry-environment and
--sentry-traces-sample-rate (options). Without a DSN nothing
is sent.