RaiCentral

Docs / Self-hosting

Operations

Health checks, administrator commands, backup, restore and upgrades.

Health

bash
curl -fsS http://127.0.0.1:8001/health    # process is up
curl -fsS http://127.0.0.1:8001/ready     # check "status" in the body
curl -fsS http://127.0.0.1:8001/version
docker compose ps

/ready returns 200 either way. Read its status field.

Administrators

bash
docker compose exec rai-gateway rai-gateway admin list
docker compose exec rai-gateway rai-gateway admin reset-password --email [email protected]
docker compose exec rai-gateway rai-gateway admin deactivate --email [email protected]

Back up

Back up the database, the onboarding source files and .env together. Store .env encrypted and separately.

bash
stamp=$(date -u +%Y%m%dT%H%M%SZ)
docker compose stop rai-onboarding-worker
docker compose exec -T postgres pg_dump -U rai_user -d rai_gateway --format=custom > "rai-db-$stamp.dump"
docker compose exec -T rai-gateway tar -czf - -C /var/lib/rai/onboarding-sources . > "rai-sources-$stamp.tar.gz"
docker compose start rai-onboarding-worker

Restore

Restore replaces the current data.

bash
docker compose stop control-plane-ui rai-onboarding-worker rai-gateway
docker compose exec -T postgres pg_restore -U rai_user -d rai_gateway \
  --clean --if-exists --exit-on-error < rai-db-YYYYMMDDTHHMMSSZ.dump
docker compose run --rm --no-deps -T --entrypoint tar rai-gateway \
  -xzf - -C /var/lib/rai/onboarding-sources < rai-sources-YYYYMMDDTHHMMSSZ.tar.gz
docker compose up -d

Use the same EVIDENCE_ENCRYPTION_KEY as the backed-up instance. If you run the events worker, stop and start it with the others.

Upgrade

  1. Read the release notes and compare .env with the new template.
  2. Back up.
  3. Run git pull, then docker compose up -d --build. Migrations run at API startup.
  4. Check /ready and sign in.

To roll back, check out the previous version, rebuild and restore the backup.