Skip to content

IT operations

Status: design, 2026-12-06. Not built. Decisions below are the owner's, from 2026-12-05.

One screen, Admin → IT (/admin/it), for the people who run the server. It extends what System Health, the job queue, the SDE importer, Discord sync, and the tunnel supervisor already do. It does not replace Admin → Tunnel, Admin → Audit Log, or Admin → Access Control.

Production is a Linux host running Docker Compose (nexus + postgres + cloudflared, optional caddy profile). The nexus image is one binary. cloudflared is its own container and does not see the vault key. Postgres is 17. A Windows Docker Desktop machine is for development. Design the Linux stack first.

Goals

  • See whether the install is healthy, and act on it, from one page: queue, logs, backups, updates, maintenance, a redacted config, and triggers for the SDE import and Discord sync.
  • Split seeing from doing. CEO and IT are ordinary States or hidden Groups with different it.* permissions. A view permission has no button.
  • Backups that are encrypted, scheduled, kept for a set count, downloadable, and restorable. A restore takes a fresh backup first.
  • Updates that can run themselves later: a tagged release, a changelog, then backup, pull, recreate only nexus, migrate, health-check, and roll back to the previous image and the pre-update dump if the new process is unhealthy. v1 documents the host command and does not run it.
  • Every action is in the audit log. A long action shows its output on the page while it runs.
  • Discord notices when a backup fails or goes stale, when an update is available, applied, or rolled back, and when maintenance mode goes on or off.

What to keep from the Alliance Auth admin tools already in use (the toolkit plugin and the host updater), without copying their internals:

  • A view permission and an execute permission are different codes.
  • Restore and update ask for a typed phrase. Superadmin types it too.
  • Actions are audited, and a long run shows its output as it happens.
  • An update checks that this version can move to that release, can dry-run, snapshots first, and rolls back if the new process is unhealthy. A failed build or pull leaves the running stack as it is.
  • The Docker socket stays out of the app container. So do package installs into a running container, a browser editor for .env, and docker compose down from inside the stack.
  • A backup feature includes restore, a schedule, and retention. An allowlist that treats an unknown value as allowed is a bug.

Non-goals

  • Mounting the Docker socket into nexus. That container holds VAULT_MASTER_KEYS and the tunnel token.
  • A shell, a compose passthrough, or any endpoint that runs a caller-supplied command.
  • Editing .env in the browser, or showing a secret's value.
  • Taking the whole stack down as part of an update. Postgres, Caddy, and the tunnel stay up while only nexus is recreated.
  • Multi-host orchestration, incremental backups, and a second copy of System Health under a new name.
  • Windows as a production target. NSSM and a systemd binary install stay in the wiki; this screen is the Compose path.

Where it runs

Compose today builds eve-nexus:0.1.0, pins postgres:17.12-alpine, publishes Nexus on loopback, and puts cloudflared in the nexus image. Migrations run as nexus_owner (DATABASE_MIGRATE_URL) before the process listens, then the API connects as nexus_app, which does not own the tables. GET /api/v1/health stays a database liveness probe and gains no new fields.

v1 backups run inside nexus. The image build copies pg_dump and pg_restore from a Debian-based Postgres 17 image of the same major (the Alpine server image is musl; the runtime image is glibc). That copy happens in the Dockerfile. The running container does not install packages. The client major must match the server. The database password is passed in a PGPASSFILE the process creates with mode 0600, never on the command line, so it cannot land in the log ring or the live output.

Dev on Docker Desktop can run v1 (the backup volume and the in-process dump both work inside the Linux VM). It is a poor place to prove v2: the Docker socket lives in that VM, line endings must stay LF (migration checksums already require it), and the host command below is a Linux shell. Do not treat a Desktop auto-update as production.

Roles and permissions

Permissions are rows in permissions, attached on Admin → Access Control to a State (state_permissions) or to a hidden Group (group_permissions). Open and requestable groups cannot carry them. The person attaching a code must already hold it (must_hold); a superadmin holds all. The session loads the union of the State and the account's groups. has_permission is true for a superadmin or for a code in that set. Each IT route checks the codes named for it and answers 403 otherwise. A code that is not seeded cannot be attached. Nothing in the handlers looks for a role named CEO or IT.

Superadmin still bypasses every it.* check. Restore, apply, rollback, and turning on patch auto-apply also require the typed phrase below, including for a superadmin. A wrong phrase does not start the work. The attempt is audited as rejected, and the typed text is not stored (someone may have pasted a password).

Reads accept the view code or the matching action code, the same way admin.users.view / admin.users.manage works. Writes accept only the action code, and they use the existing same-origin check. The sidebar shows IT when the account holds any it.* code. Hiding a button is not the check.

Suggested attachments, for a hidden CEO group and a hidden IT group. They are a recommendation a superadmin applies. Shipping the codes does not grant them.

Code Allows CEO IT
it.view_health The overview: health, versions, queue depth, last backup, backup disk, SDE, tunnel summary, "an update is available" yes yes
it.view_jobs The queue: waiting, running, failed, last_error yes yes
it.retry_job Put one failed job back on the queue yes
it.view_logs Recent in-app log lines yes yes
it.view_backups Backup list (time, size, key version, reason, status) yes yes
it.run_backup Take a backup now. Includes the list yes
it.restore_backup Restore one backup. Typed phrase. Includes the list yes
it.export_backup Download one encrypted backup file. Includes the list yes
it.manage_updates Changelog, host command, and (v2) dry-run, apply, rollback, patch auto-apply yes
it.maintenance_mode Turn maintenance mode on or off yes yes
it.manage_settings Retention count, backup schedule, which Discord notices fire, auto-apply window yes
it.trigger_discord_sync Queue a Discord sync now yes
it.trigger_sde_import Run the SDE import now yes

it.view_logs shows character IDs and client IPs, which the process already logs. Give it only to people who should see that. it.export_backup is the exfiltration path: the file holds tokens and personal data. It is not on the CEO suggestion.

Tunnel changes stay superadmin-only on Admin → Tunnel. it.view_health may show connected / edge connections / restarts / cloudflared version. It does not show or accept either tunnel token. admin.system.view keeps today's System Health page and does not open IT.

Phrases, compared on the server, outer whitespace trimmed, no other normalisation:

Action Phrase
Restore restore and the backup id
Apply an update update and the version
Roll back an update rollback and the version being restored
Enable patch auto-apply auto-apply patches

Screens

One page, sections stacked. Each section is absent without its permission, and its API returns 403. Long actions stream redacted lines (SSE) to anyone who holds the action code. The audit row stores the outcome (ok or fail, id, duration, error class), not the transcript. The transcript is kept in memory for that run and replaced by the next one.

Overview (it.view_health). Everything System Health shows today (database, SDE release, public URL, callback, affiliation interval and worst case, edge warnings), plus:

Field Source
App version CARGO_PKG_VERSION
Image tag NEXUS_IMAGE_TAG when Compose sets it; otherwise "local build"
Schema Newest successful row in _sqlx_migrations
Queue Count waiting, count failed (failed_at set)
Last backup Time, status, size. "Never" until one succeeds
Backup disk Free space on the backup volume, warn when free space is under twice the last backup
SDE sde_meta release, build, updated_at, and the last import error (stored on purpose; the page does not scrape logs)
Tunnel Status summary only
Update Running version, and whether a newer tag exists

Jobs (it.view_jobs, retry needs it.retry_job). The background_jobs table: queue, priority, attempts, run_at, locked_at, failed_at, last_error. Grouped by the queues the worker already has (affiliation, tokens, contacts, states, org, Discord, character sweep, corporation wallets, background checks). Retry is allowed only when failed_at is set. It clears failed_at, sets attempts back to 0 and run_at to now, and does not change the payload or the queue name. One click is one more try; a job that fails again dead-letters again. The janitor already deletes dead letters after 7 days, and the page says so. During maintenance the row is reset and does not run until maintenance is off.

Logs (it.view_logs). A ring buffer in the process (a few hundred lines) filled by a tracing layer. This is Nexus's own log, not docker logs. Lines that look like a secret (a vault key, a Bearer token, a webhook URL, a database password) are masked before they enter the ring. Opening the section is audited at most once every 10 minutes.

Backups. The list, Back up now, Restore, and Download. Details in Backups below.

Updates (it.manage_updates for the commands and the buttons; the overview's "update available" line is it.view_health). v1 shows the changelog and the host command and does not run it. v2 adds dry-run, apply, and rollback. Details in Updates below.

Maintenance (it.maintenance_mode). A flag in the database, read by Nexus on each request. While it is on:

  • Pilot pages and APIs, including sign-in (/sso/*), respond with a short maintenance message.
  • State-changing routes for everyone else do the same.
  • An account with it.maintenance_mode (and a superadmin) can still open IT and turn the flag off, including from loopback while the public URL is down.
  • GET /api/v1/health is unchanged, so a planned window does not look like a database outage to a monitor.
  • The job worker claims nothing. Rows already queued wait. The scheduler may keep inserting them.

If the flag cannot be read, a restore or an update refuses to start. Turning the flag on or off is audited in the same transaction, then a Discord notice is sent.

Config (it.view_health to read, it.manage_settings to change the IT settings). Two lists. The environment list shows non-secret values Nexus already exposes (public URL, bind address, trusted proxies, affiliation interval, consent policy version, log filter, whether HTTPS is on). Every secret is set or not set: database URLs, the EVE secret, the Discord secret and bot token, the tunnel token, the ops webhook. Vault keys show version numbers only (1, 2, active 2), never the hex. Discord's guild id is set or not set. There is no editor for any of these; changing them is still an edit of .env on the host and a restart. The settings list is the retention count, the backup schedule, which notices fire, and the auto-apply window. Those live in the database.

Discord sync (it.trigger_discord_sync). Enqueues the existing account sweep if one is not already waiting, and runs it even during maintenance so the click is not stuck behind a paused worker. Output is queued / already running / the sweep's synced and failed counts. The bot token stays sealed.

SDE (it.trigger_sde_import). Calls the existing importer (sync_if_outdated). A current release finishes with "already up to date" and does not rewrite the tables. The result, including the error, is stored for the overview.

Backups

A Compose named volume backups, mounted only into nexus at /var/lib/eve-nexus/backups, mode 0700, owned by the nexus user. It is not a bind mount of the git checkout, and it is not mounted into postgres or the sidecar. Files are named by id. A caller never supplies a path.

pg_dump -Fc as nexus_owner writes to the encryptor. The custom-format stream is sealed in chunks with AES-256-GCM. The header, in the clear, holds a format id, the backup id, the time, the reason (scheduled, manual, pre-update, pre-restore), the schema version, the byte size, and the vault key version. Each chunk's associated data binds it to the backup id and the chunk index, so a reordered or swapped chunk does not decrypt. No plaintext dump is left on disk.

The key is a subkey derived the way TokenVault::derive_subkey derives the cookie key (label backup-v1), from a chosen key version. Today's helper always uses the active version; backup code needs the version in the header, including after rotation. New backups use the highest version in VAULT_MASTER_KEYS. Older files still open while their version remains in that list. The overview lists retained files whose version is not active, and Re-seal (needs it.run_backup) rewrites them with the active version before an operator removes the old one from .env. A version removed before that is done makes those files unreadable. Retention will still delete them once they age out.

Losing the vault key means those files cannot be opened. The tokens inside a dump would be unreadable without it anyway. The wiki's "set a new key and have pilots sign in again" recovers live accounts and does not recover these files. There is no second password and no copy of the key on the volume. The key stays in the password manager, off the server. A stolen file without the key is ciphertext. A stolen key with the file is the database.

Schedule: a time of day, stored with the IT settings, checked from the existing scheduler. Retention count is an IT setting, default 14, minimum 2 (so a pre-action backup and one previous file can both exist), maximum 90. After a successful backup, delete the oldest files past the count. A failed attempt does not delete a good file. A file marked kept (the pre-update dump, until that update is confirmed) is skipped by retention.

Restore (it.restore_backup, phrase restore <id>):

  1. Refuse if the header's schema version is newer than this binary, if the id is unknown, or if free space is under the size of this file plus a fresh dump.
  2. Turn maintenance on.
  3. Take a pre-restore backup. If that fails, stop. Maintenance stays on until someone turns it off.
  4. Pause claims, close the API pool, pg_restore --clean --if-exists from the decrypted stream into database nexus.
  5. Exit. Compose's restart: unless-stopped starts the same image, which runs migrations forward from the restored schema before it listens. Maintenance stays on.

The list never renders dump contents, SQL, or decrypted bytes. Download (it.export_backup) streams the ciphertext, one download at a time, and audits the id and the size. Files from this volume are never committed and never attached to a Discord message.

Updates

Releases are git tags and matching image tags eve-nexus:<major>.<minor>.<patch>. The string latest is not a release. Nexus checks the forge that hosts this repository's tags, over HTTPS, against a host compiled into the binary. An admin cannot point the check at another URL. The changelog is untrusted text and is escaped.

Version policy: a patch (x.y.Z) may be auto-applied when that switch is on. A minor or a major is shown and applied only when someone runs it and types the phrase. Auto-apply stays off until one manual update has finished on this install. The switch itself needs the phrase auto-apply patches, it.manage_settings to set the window, and it.manage_updates to arm it. Each automatic run is audited.

Order, once v2 can run it:

  1. Compat check. The target parses as a release tag, is newer than the running version, and obeys the patch / minor / major rule. The manifest names the schema version that release applies. A downgrade is refused here; the way back is rollback, which restores the dump.
  2. Dry run. Report the tag, the schema jump, the disk check, and whether the sidecar can see the manifest. Do not pull and do not recreate.
  3. Backup, reason pre-update, marked kept. A failed backup stops the update.
  4. Pull the tag. A failed pull leaves the running container untouched.
  5. Recreate only the nexus service with that tag. Do not compose down. Do not recreate postgres, caddy, or the sidecar.
  6. Wait until GET /api/v1/health returns 200. Listening means migrations have already run.
  7. On failure, roll back: previous image, then the pre-update dump (below). On success, drop the kept mark so retention can see the file again.

v1 host command, shown on the page and not executed. Run it on the Linux host, in the Compose directory. A failed docker compose build stops the script; the running containers are left as they are. There is no compose down.

# <version> is the tag from the IT page, for example 1.2.3
git fetch origin tag <version>
git checkout <version>
docker compose build nexus
docker compose up -d --no-deps nexus
curl -fsS "http://127.0.0.1:${NEXUS_PORT:-8080}/api/v1/health"

The database backup for that command is Back up now on this page, or docker compose exec -T postgres pg_dump -U nexus_owner -d nexus written somewhere off the checkout. The wiki's docker exec nexus-pg / user nexus does not match this Compose file (postgres, nexus_owner). Prefer the in-app backup: it is encrypted. A raw pg_dump on the host is not, so it should not sit in the git tree or in a home directory that gets copied around.

Rollback. sqlx will not start an older binary against a schema that already has newer migrations, so image rollback and dump restore have to move together. The sidecar does not hold the vault key and cannot decrypt the dump. The allowlisted path is: run the current image once as core-api restore <backup-id> (that argv is fixed, the id is the kept backup's id, not a free string), which decrypts, restores, and exits 0; then recreate nexus with the previous image tag. One attempt. If that restore does not exit 0, do not loop. Leave Postgres up, Discord "rollback needs a person", and keep the dump. The first release that introduces restore cannot be rolled back onto a binary that lacks it; that hop stays a manual host command.

Automatic rollback is covered by the phrase typed for the update. It does not ask again.

Sidecar API

v2 adds a container nexus-ops. It is a small static binary with a fixed command list, its own image (not the Nexus image), a read-only root filesystem, and no copy of VAULT_MASTER_KEYS, the tunnel token, the database URL, or the Discord bot token. The Docker socket is mounted there, and only there.

The API listens on an internal Compose network that has two members: nexus-ops and nexus. There is no ports: entry, so it is not on the host's LAN, not on Caddy, and not on the tunnel. That is the loopback constraint that Compose can actually enforce. Sharing nexus's network namespace so the port is literally 127.0.0.1 would put the socket-holding process in the same namespace as cloudflared and the vault key. Keep them apart.

Authentication is a bearer token (NEXUS_OPS_TOKEN in .env, compared in constant time). It is not the vault key. Nexus is the only caller.

Call Body What it does
GET /v1/health — Sidecar up, socket reachable, running image tag of nexus
POST /v1/update { "tag", "dry_run" } Dry run: check the tag and that the manifest exists. Otherwise pull, then recreate nexus only
POST /v1/rollback { "tag", "backup_id" } Recreate nexus from a tag already pulled, after the restore command above has exited 0

Rejected, and these are the whole of the allowlist: any other path, any unknown JSON field, a tag that is not eve-nexus: plus semver (or the same tag by sha256 digest), the service name postgres, caddy, or nexus-ops, latest, a shell metacharacter, and any command that is not one of the three calls. Unknown means denied.

Trade-offs, in the order they were considered:

Approach What it costs
Sidecar with the socket (this design) The HTTP API is narrow, and a bug in Nexus does not get the socket. A bug in the sidecar is still host root, and root on the socket can read nexus's environment, including the vault key and the tunnel token. The sidecar's own config never contains those values. The narrow API is what keeps a caller from reaching that point.
Host service, no socket in any container Nexus writes a request file (tag, backup id) on a volume; a root unit on the host performs the same allowlist. Nothing in Compose can recreate containers. It is a second thing to install, and it matches the v1 host command more closely. Prefer this if a container must not hold the socket at all. The request file has the same fields as the API.
Socket inside nexus One compromise yields the vault key, the tunnel token, and host root. Rejected.
Build or apt inside the running container A failed build can take the live process with it, and the image grows a compiler. Rejected. Pull a tag that was built elsewhere. Until a registry exists, v1's host command builds on the host and only then recreates.
compose down then up Stops Postgres and the tunnel and can fail to come back. Rejected.

Discord notices

A second webhook, sealed like the reporter one (AES-256-GCM, associated data of its own, never returned by the API). The page shows set / not set and the id suffix. Only a superadmin can set or clear it. it.manage_settings chooses which events post, and cannot paste a URL. The URL must pass the same host check as the reporter webhook. The client does not follow redirects, and allowed_mentions is empty.

Events: backup failed, backup stale (no success within two intervals; one notice per stale stretch, not one per tick), update available, update applied, update rolled back, maintenance on, maintenance off. The message names the event, the time, a version or a backup id, and the path /admin/it. It does not contain log lines, dump bytes, tokens, or player data. Markdown in those fields is escaped.

"Update available" can fire in v1, because the check is an HTTPS fetch. "Applied" and "rolled back" wait for v2.

Security

Shipping this adds a trust boundary and two assets. The same change updates docs/security/threat-model.md.

  • Backup files are a copy of the database: sealed refresh tokens, the tunnel token's ciphertext, character data, sessions' hashes. They are worth as much as the live database once the vault key is present. Export is its own permission, audited, ciphertext only.
  • nexus-ops is a new boundary. Its config does not include the vault key, the tunnel token, or the database password, and its API has no field for them. Nexus does not receive the socket. A caller who gets code execution in the sidecar still has the socket, and the socket can read those values back out of the running nexus container. That is the reason the API is an allowlist with no exec.
  • The ops webhook is a secret with the same rules as the reporter webhook: superadmin writes it, the audit row stores the id suffix, the log stores that it could not be decrypted when that happens.
  • Maintenance mode is an availability switch. Failing to read the flag refuses restore and update. It does not lock out the account that can clear it.
  • Logs and live output are readable by it.view_logs and by the action's holders. Mask secrets before they are stored in the ring. Do not write the transcript into audit_logs.
  • Audit. Append-only, actor and client IP, in the same transaction as the flag or the settings row. For backup, restore, and update, write a start row before the work and a finish row after. Actions: it.backup_started, it.backup_finished, it.backup_failed, it.backup_exported, it.restore_rejected, it.restore_started, it.restore_finished, it.restore_failed, it.update_applied, it.update_rolled_back, it.update_failed, it.maintenance_on, it.maintenance_off, it.settings_changed (names of settings, never values of secrets), it.job_retried, it.discord_sync_queued, it.sde_import_queued, it.logs_viewed.
  • CSRF, cookies, sessions. Unchanged. IT writes use the same same-origin rule as other admin writes.
  • Fail closed. Unseeded permission, missing permission, bad phrase, bad tag, unknown sidecar field, webhook host outside the list, schema newer than the binary, backup too big for the disk: each one denies the action.

Build slices

v1, in process. No socket and no sidecar. Seed the it.* codes. Ship the page: overview, jobs and retry, log ring, redacted config, maintenance mode, SDE trigger, Discord sync trigger. Ship encrypted backups (schedule, retention, export, restore with the phrase and the pre-restore backup) and the backup / maintenance Discord notices. The updates section checks for a tag, shows the changelog, and shows the host command. "Update available" may ping. Apply does not call Docker.

v2, sidecar and automated updates. nexus-ops as specified above, image tags from a registry, dry-run, apply, rollback (previous image and the pre-update dump), patch auto-apply, and the applied / rolled back notices. Arm auto-apply only after one manual update has succeeded.

v1 is useful on its own if v2 never happens. The host command remains the way to upgrade.

Open questions

  1. Where images are published. v2's pull needs a registry named in Compose. This design does not pick one. Until a tag can be pulled, updates stay the v1 host command (build on the host, recreate only after the build exits 0).
  2. Socket in nexus-ops, or a host unit with no socket in Compose. The design uses the sidecar. If a container must not hold the socket, the host-unit row in the trade-off table is the alternative; the request it reads has the same fields as POST /v1/update and POST /v1/rollback.