Cubeherd

Install Cubeherd

Cubeherd runs on the same host as your Minecraft servers. You need Docker with the Compose plugin.

With Docker Compose (recommended)

sudo mkdir -p /srv/cubeherd

Save this as compose.yml and start it with docker compose up -d:

services:
  cubeherd:
    image: ghcr.io/matserix/cubeherd:latest
    container_name: cubeherd
    restart: unless-stopped
    ports:
      - "8420:8420"          # only expose on the LAN/VPN
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /srv/cubeherd:/srv/cubeherd
    environment:
      CUBEHERD_DATA: /srv/cubeherd
      TZ: Europe/Berlin       # for backup schedules

Then open http://<host>:8420 and set the admin password on first visit.

The data directory must have the same path inside the container as on the host (/srv/cubeherd:/srv/cubeherd), because Docker resolves the Minecraft servers' bind mounts on the host.

As a binary

Build it with Go, or grab a build from the releases page:

CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o cubeherd ./cmd/cubeherd
sudo CUBEHERD_DATA=/srv/cubeherd ./cubeherd

Configuration

VariableDefaultMeaning
CUBEHERD_DATA/srv/cubeherd as root, otherwise ./cubeherd-dataData directory
CUBEHERD_LISTEN:8420Web server address
DOCKER_HOST/var/run/docker.sock, falling back to ~/.docker/run/docker.sockDocker socket
CUBEHERD_LOCALtrueSet to false for a dashboard that only manages remote agents (needs no Docker socket)
CUBEHERD_ACCOUNTSfalsetrue starts in multi-user mode, see below. It can also be switched on in the settings
CUBEHERD_METRICSfalseRecord statistics on this node, see below
CUBEHERD_AUDIT_STDOUTfalseAlso print every audit entry as one JSON line to stdout, for Docker log drivers
CUBEHERD_HARDENEDfalseContainer profile for hosting servers for other people, see Hosting for other people
CUBEHERD_AGENT_TOKEN, CUBEHERD_AGENT_LISTEN– / :8421Agent mode only, see below
TZUTCDefault time zone, unless one is chosen in the settings

Several hosts

One dashboard can manage Minecraft servers on any number of hosts. The same image runs in two roles: the dashboard (web UI, login, settings) and one agent per host (cubeherd agent: Docker access, server folders, backups and the scheduler). A dashboard that also has the Docker socket keeps managing its own host as the embedded local node, so a single-host setup works as before.

SetupCompose file
One host (dashboard and servers together)deploy/compose.yml
Dashboard that only manages agents (CUBEHERD_LOCAL=false)deploy/compose.dashboard.yml
Agent on a host that runs serversdeploy/compose.agent.yml
  1. On each host that runs servers, start an agent with a long random token: CUBEHERD_AGENT_TOKEN=$(openssl rand -base64 32 | tr -d '/+=') docker compose -f deploy/compose.agent.yml up -d. The data directory needs the same path inside the container as on that host.
  2. In the dashboard open Nodes → Add node. The dialog can generate a token and shows the compose snippet for the other host.
  3. Enter the agent's address (host:8421) and confirm the certificate fingerprint the agent printed at startup (docker logs).

The dashboard always opens the connection. It is HTTPS (TLS 1.3) with a certificate the agent makes up for itself, pinned by its SHA-256 fingerprint, and every request carries the bearer token. Whoever holds an agent's token controls Docker on that host, so keep port 8421 on a LAN or VPN.

Upgrading: existing single-host installs need nothing. Update the dashboard and its agents together; an agent with a different version is flagged "agent outdated". Going back to an older release loses the node list, so keep a copy of cubeherd.json if you may roll back.

Behind a reverse proxy

Terminate HTTPS in a reverse proxy and let it forward to port 8420. Cubeherd is meant for a LAN or a VPN; if people reach it from the internet, put an access layer in front as well (a VPN, Authelia, Cloudflare Access) and read the security notes below.

  1. The proxy must pass the original Host header (the CSRF check compares it with the browser's Origin), set X-Forwarded-For and X-Forwarded-Proto, switch off response buffering (the live console and charts stream), and allow large uploads (worlds, mods).
  2. In Settings → Reverse proxy list the address of the proxy under Trusted proxies. Only from those addresses are the forwarded headers believed, so a client cannot fake its address. Then sign-in limits and the audit log see real client addresses, and the session cookie gets the Secure flag over HTTPS.
  3. Optionally switch on HSTS once HTTPS is permanent, and set the public address under Access → Sign-in if you use single sign-on or e-mail links.
  4. Never put an agent (port 8421) behind the proxy or on the internet.
# nginx
location / {
    proxy_pass http://127.0.0.1:8420;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_http_version 1.1;
    proxy_buffering off;
    proxy_read_timeout 1h;
    client_max_body_size 4g;
}
# Caddy
cubeherd.example.com {
    reverse_proxy 127.0.0.1:8420 {
        flush_interval -1
    }
}

Users and roles

By default Cubeherd has one shared password. For teams and communities there is an optional multi-user mode with personal accounts, roles, an audit log and single sign-on. Switch it on under Settings → User accounts or start with CUBEHERD_ACCOUNTS=true. Your current password becomes the account admin with the Owner role, and nothing else changes until you add people. Accounts, roles, sessions and the audit log live in one SQLite file, cubeherd.db, in the data directory.

  • Rights and roles: fine-grained rights for servers, console, files, backups, settings, resources, network and more, grouped into roles. Owner, Admin, Operator, Moderator, Customer and Viewer are built in; you can create your own.
  • Scopes: a user or group gets a role on everything, on one node or on one server. Rights add up and there is no deny. Assignments can expire.
  • Audit log: sign-ins, changes to accounts and roles, and every action on servers, with who, when, from where and the outcome. File contents and secrets are never recorded. Entries are hash-chained, kept 365 days by default, and can be exported as CSV or JSON.
  • Single sign-on: Google or any OpenID Connect provider such as Keycloak, Authentik, Authelia, Zitadel, Entra ID or Okta, with PKCE, optional e-mail domain restriction and groups that follow a claim.
  • Account security (Access → Account security): two-factor sign-in with any authenticator app and recovery codes, optionally required for everyone or for accounts with administrative rights; password reset by e-mail with single-use links; sign-in notices with a "This wasn't me" link; and self-registration that is off, open, or open with approval by an admin. E-mail features need the SMTP settings under Access → E-Mail and stay off until they are configured.
  • Back up cubeherd.db, cubeherd.json and access.key. cubeherd db backup <file> writes a consistent copy. cubeherd user reset-owner repairs an owner and sets a new password.

Agents are not covered by user rights. An agent token still gives full control of its host, so do not hand it to people who should not have it. Access → Users → End multi-user mode returns to one shared password.

Hosting for other people

Cubeherd can run servers for customers, with limits that keep the risks small:

  • The Customer role runs and configures the game, files, add-ons and backups, but not memory, CPU, ports or raw environment.
  • A disk quota per server warns from 90 percent, blocks writes and starts at 100 percent and stops a running server at 120 percent. Data is never deleted.
  • A host can suspend a server: it is stopped and cannot be started until it is released.
  • CUBEHERD_HARDENED=true switches on the container profile: dropped capabilities, no-new-privileges, process, file and log limits, and an optional gVisor or Kata runtime.
  • White label: under Settings → Appearance set your own product name, logo, favicon and every color for the dark and the light theme. The licence notices stay in place.

The hosting guide covers the recommended layout (dashboard on its own VM without the Docker socket, one agent per Docker host), the profile settings and a checklist. It also says what remains: containers share the host's kernel, so for customers you do not know, use a sandboxed runtime or give each customer a virtual machine.

Statistics

An optional history of load, players and TPS, off by default. Switch it on per node under Nodes → Edit, or with CUBEHERD_METRICS=true on an agent. Nothing runs and no file exists while it is off.

  • Recorded on the node: each node samples once a minute into metrics/metrics.db in its data directory, so there are no holes when the dashboard is down. Charts are fetched only when you open them.
  • What: per node CPU, memory, disk, running servers and players; per server CPU, memory, players, TPS and MSPT, plus start, stop, restart, update and crash events and availability. Player names are not stored. Paused, stopped and starting servers are never queried.
  • How long: one-minute values for 48 hours, five-minute values for 30 days and hourly values for a year, capped at 256 MB by default. A full year is roughly 1.6 MB per server.
  • Prometheus: Settings → Prometheus creates a scrape token for GET /metrics with live values of all nodes and servers. It reads everything regardless of user rights, so treat it like a password.

Where your data lives

By default there is no database. Each server gets a folder in the data directory with a cubeherd.json definition, a generated compose.yml and its data/ directory with world, configs and mods. Servers keep working with docker compose without Cubeherd. Existing itzg containers can be adopted.

Security

Cubeherd has access to the Docker socket, so an administrator can in practice reach the entire host: treat that account like root. Only expose it on your LAN or via VPN, never directly to the internet. By default there is a single admin account (bcrypt), with signed session cookies (SameSite=Strict), login throttling and CSRF protection; in multi-user mode there are personal accounts with roles and an audit log.

Roles limit what a user may do per node and per server, so a viewer or moderator cannot reach the host, but anyone who may upload mods, edit files or send console commands can run code inside that server's container, so grant those rights with care. Agents add a second entry point with the same reach as an administrator, so protect their token like the admin password.