Wiki Operations
Deploying with Docker Compose
The shipped Compose stack — node, dashboard API and nginx proxy — what it publishes, the secrets it needs, volume ownership, and how cluster deployments differ.
The repository ships one deployment: a Docker Compose stack in deploy/ that runs a single
Mirexa node, the dashboard API in front of it, and an nginx proxy that serves the
dashboard's web application. Exactly one port is published, on loopback. Compose is the
whole of what the repository provides; there are no Kubernetes manifests, Helm charts or
install scripts, by decision.
The shape
flowchart TD
B[Browser] -->|"127.0.0.1:8080"| W["web: nginx + SPA<br/>(only published port)"]
W -->|"/api, compose network"| D["dashboard: mirexa-dashboard<br/>:8080 API, :9101 metrics"]
D -->|"wire protocol, compose network"| N["mirexa: mirexa-server<br/>:9200 wire, :9201 observability"]
N --- V[("volume mirexa-data<br/>/var/lib/mirexa")]
| Service | Image target | Listens (inside the network) | Published |
|---|---|---|---|
mirexa |
mirexa |
9200 wire protocol, 9201 / / / |
no |
dashboard |
dashboard |
8080 API, 9101 its own metrics | no |
web |
web |
80 | 127. |
mirexa and dashboard have no ports: entry; they are reachable only on the Compose
network. A test fails if either ever gains one.[1] The health checks chain the
startup: dashboard waits for mirexa's /health, and web waits for dashboard's.
Why a proxy
The dashboard's refresh cookie is named with the __Host- prefix and is SameSite=Strict,
so a browser sends it only when the page and the API share an origin. nginx gives them one:
it serves the built SPA and proxies /api/ to the dashboard. Serving the SPA from another
host or port silently loses the cookie, and a page reload then signs the user out.
See the web dashboard.
The nginx configuration also:
- resolves the dashboard's name per request (Docker's DNS at
127.0.0.11, 10-second validity), so the proxy starts while the dashboard is down and follows it when it is replaced; - sends a strict Content-Security-Policy,
X-Frame-Options: DENY,nosniffandno-referreron the document; - never caches
index.htmland caches content-hashed/assets/for a year; - passes the live chart's Server-Sent Events endpoint unbuffered with one-hour timeouts;
- forwards
X-Forwarded-ForandX-Real-IP(the dashboard does not currently read them: its login throttle keys on the proxy's address, so failed sign-ins from anyone count against everyone — see the web dashboard); - exposes the dashboard's
/healthbut not/ready.
What you must supply
The committed files are deliberately not a working deployment: four things are secrets or site-specific.
-
A signing keypair, kept off this host. Generate it with
mirexa-cli token keygenand paste the printed public key intodeploy/config/node.yamlaspublic_key:— an inline base64 value, not a path. The private key mints any permission and belongs elsewhere.bashmirexa-cli token keygen -dir /somewhere/safe -name ops -
The dashboard's token file,
deploy/secrets/upstream_token, issued from that key. Tokens live at most one hour, so something outside the stack must rewrite this file before it lapses; the dashboard re-reads it on every reconnect.bashmirexa-cli token issue -key /somewhere/safe/ops.key -perms READ_CANDLES,WRITE_CANDLES,LIST_STREAMS -validity 60m > deploy/secrets/upstream_token -
A session secret,
deploy/secrets/session_secret, at least 32 bytes. It signs browser sessions; replacing it signs everyone out at once.bashhead -c 32 /dev/urandom | base64 > deploy/secrets/session_secret -
A password hash in
deploy/config/dashboard.yamlin place ofREPLACE-ME:bashmirexa-dashboard -hash-password
Then build and start:
docker compose -f deploy/docker-compose.yml up --build
and open http://127.0.0.1:8080.
Secrets and volumes
| Mount | Into | Mode | Holds |
|---|---|---|---|
volume mirexa- |
mirexa: |
read-write | all node data |
. |
mirexa: |
read-only | node configuration (public key only) |
. |
dashboard: |
read-only | dashboard configuration and password hashes |
. |
dashboard: |
read-only | session_, upstream_ |
- No key material is baked into an image. Tests fail if the Dockerfile copies a secret, if key material is committed, or if the example configs carry a usable password hash or trusted key.[2]
- Volume ownership. The node runs as uid 10001. The image creates
/var/lib/mirexaowned by that uid, and Docker copies that ownership onto the named volume on first mount. If you replace the named volume with a bind mount, make the host directory writable by uid 10001 yourself; otherwise every write fails with "permission denied" and the node reports unhealthy. - Back up the volume, not the containers. A consistent copy needs the node stopped (a clean stop drains the hot caches into chunks); a copy of a running node's directory is a crash image, which recovery replays from the WAL (see startup, shutdown and recovery). There is no online backup tool.
What the example configures
deploy/config/node.yaml keeps authentication on (the default) with a trusted key of its
own, so the node generates no issuer of its own, binds the
wire protocol to 0.0.0.0:9200 and observability to 0.0.0.0:9201 inside the container —
privacy comes from not publishing those ports — and sets security.max_permissions to
READ_CANDLES, WRITE_CANDLES, LIST_STREAMS. deploy/config/dashboard.yaml points the
dashboard at mirexa:9200, sets session_cookie_secure: false because the example serves
plain HTTP, and leaves upstream_tls: false because the hop stays inside one Docker
network.
Before calling it production
- Terminate TLS in front of nginx, publish 443 instead of loopback 8080, and set
session_cookie_secure: true. That flag also turns on HSTS; setting it without TLS in front tells browsers to refuse plain HTTP to the host for a year. - Set
upstream_tls: true(and give the node a certificate) if the dashboard and node do not share a private network: the dashboard's token is a bearer credential anyone on the path could replay until it expires. - Narrow
security.max_permissionsto what the dashboard needs. It applies whether or not auth is on. - Automate the token refresh for
upstream_token. When it lapses every dashboard request answers 503; see troubleshooting. - Add monitoring. Prometheus, Alertmanager and Grafana are not in this stack; point
a scraper at
mirexa:9201anddashboard:9101on the Compose network. See monitoring.
Variations
- An existing node elsewhere. Point
upstream_addrat it and remove themirexaservice and volume from the Compose file by hand; the file always starts a node. - Without the dashboard. Run only the
mirexaservice and publish its wire port — ideally on a private address, with auth on. - A cluster. The Compose file runs one node. A cluster needs each node to have a unique
cluster.node_id, a Raft address its peers can dial, a control listener, and (for copies) a replication listener with its own mTLS certificate frommirexa-cli certs. Give each node its own volume. No cluster Compose file or orchestration manifest is provided; see operating a cluster for the per-node configuration and TLS for certificates.
Why no Kubernetes manifests
A single Mirexa node owns a local data directory, so a manifest for it is a StatefulSet of
one. A cluster's members join through cluster.seeds and coordinate through their own
control plane; an orchestrator adds restart and placement, which the Compose file and this
page already describe the inputs for (images, mounts, secrets, ports, probes). Nothing in
the repository writes or tests manifests, so none is shipped.
References
Source
- /deploy/docker-compose.yml — services, volumes, health checks.
- /deploy/nginx.conf — the proxy.
- /deploy/config/node.yaml, /deploy/config/dashboard.yaml.
- /deploy/README.md — the stack's own notes.
- /Dockerfile — image targets and uids.
Tests
TestDeploy_OnlyTheProxyPublishesAPort,TestDeploy_TheProxyBindsLoopbackByDefault,TestDeploy_SSEIsNotBuffered,TestDeploy_TheSPAFallbackExists,TestDeploy_IndexHTMLIsNotCached(/deploy/image_secrets_test.go).TestDeploy_NoKeyMaterialIsCommitted,TestDeploy_TheDockerfileCopiesNoSecrets,TestDeploy_TheDashboardConfigShipsNoUsablePassword,TestDeploy_TheExampleNodeConfigShipsNoRealTrustedKey,TestDeploy_AuthIsEnabledInTheExampleNodeConfig(same file).
Further reading
External
- Docker Compose file reference — https://docs.docker.com/reference/compose-file/
- nginx
resolverdirective — https://nginx.org/en/docs/http/ngx_http_core_module.html#resolver
TestDeploy_OnlyTheProxyPublishesAPortin /deploy/image_secrets_test.go. ↩︎The
TestDeploy_*secret tests in /deploy/image_secrets_test.go. ↩︎