Skip to content

Architecture

André Borchert edited this page Aug 23, 2026 · 20 revisions

Architecture

Design stage. Nothing here is implemented.

Operating model

All three servers run concurrently and stay up. Each binds its own Minecraft port directly:

Minecraft version Minecraft port Manager API
26.1 25565 127.0.0.1:8787
26.2 25566 127.0.0.1:8788
26.3 25567 127.0.0.1:8789

Players connect to whichever version they want, whenever they want. There is no wake-on-join, no sleeping state and no contention between versions — this host has already been shown to carry all three.

Conflict-test sessions are additional short-lived servers on scratch ports. They start when there is something to validate and are destroyed afterwards.

Components

Component Responsibility Scope
Manager Reconciles the sheet against reality: ingest, resolve, static-check, propose, validate, deploy, write back. Supervises its Minecraft server. Per version
Test runner Boots candidate sets in throwaway sessions, judges them, destroys the directories. Runs several concurrently. Shared
Mod store Content-addressed jar storage. All server and test mod directories are hardlinks into it. Shared
State database Modsets, verdicts, conflict graph, deployment history. Shared
Caddy Public HTTPS, static website, read-only API. Shared

Per-version state is isolated under /var/minecraftai/26.x. The store, state database and website are shared because the data they hold spans versions — the same jar often serves two Minecraft versions, and the conflict graph is most useful when it accumulates across all of them.

Request paths

A player joining. Client connects directly to the version's port. No proxy in the path.

A visitor browsing. Browser → Caddy (443) → manager API on loopback. The site is static; only the status and mod-list endpoints are dynamic.

A validation run. Manager → test runner → verdict recorded → sheet written back.

Managers bind to loopback only, behind Caddy. That boundary is worth keeping from v1: nothing but Caddy and the Minecraft servers themselves should listen on a public interface.

Server status

The website needs to show which servers are up. Rather than each manager reporting its own state — which fails exactly when the thing you want to detect has gone wrong — status is read by querying each Minecraft server directly over the Server List Ping protocol on loopback.

That single query returns liveness, player count, maximum players and the MOTD, and it exercises the same path a real client uses. A server that has hung in a way that still satisfies a manager's internal health check will fail this one.

Filesystem layout

/var/minecraftai/
├── shared/
│   ├── store/<sha256>.jar        content-addressed mod jars
│   └── state.db                  modsets, verdicts, conflict graph
├── 26.1/
│   ├── sets/<digest>/            materialized mod sets (hardlinks)
│   ├── current -> sets/<digest>  the deployed set
│   ├── world/
│   └── logs/
├── 26.2/  …
├── 26.3/  …
├── test/
│   └── <run-id>/                 throwaway session, deleted after
└── web/
    └── site/public/              served by Caddy

Materialized sets are hardlinks into the store, so keeping the last several validated sets on disk for instant rollback costs almost nothing.

Storage

Three versions of ~300 mods averaging 8 MB is about 7 GB naive. Deduplicated through the content store — many mods are byte-identical across versions — it is closer to 4–5 GB. A test scratch directory costs essentially zero bytes and materializes instantly.

Store blobs with no referencing modset are prunable, but pruning must keep anything referenced by a retained rollback target.

Test session isolation

Test servers are ordinary Minecraft servers with three constraints:

  • They may only write beneath /var/minecraftai/test/, validated by path before launch.
  • They bind loopback-only scratch ports and run offline-mode.
  • They run under systemd-run --scope with resource limits and a raised oom_score_adj, so a pathological test is reclaimed before anything a player is connected to.

The last point is not about rationing capacity. It is about a mod that leaks or spins never being able to take a live server down with it.

Deliberate non-goals

  • No containers per server. cgroup limits via systemd-run give the enforcement that matters without the overhead or the image management.
  • No client-side testing. v1 ran headless client soaks with a real Minecraft account. They caught real problems but made every bisection boot enormously expensive. Server-side boot validation is the scope here.
  • No proxy in front of the Minecraft ports. Nothing needs one now that servers stay up, and a proxy in the player path is a failure domain with no compensating benefit.

Clone this wiki locally