Wiki Operations
The web dashboard
What the Mirexa web dashboard shows, how mirexa-dashboard is configured, how sessions and the refresh cookie work, how permissions combine, and why it needs a reverse proxy.
The dashboard is a browser interface for looking at what a Mirexa node or cluster holds:
streams, their charts, their gaps, storage totals and the state of cluster nodes. It is also
where an operator fills a gap by hand. It consists of two parts: mirexa-dashboard, a
small HTTP API that holds a token for the node and its own user logins, and a single-page
application (web/) served as static files by a reverse proxy. The dashboard stores no
market data of its own; every view is a read through the node's wire protocol.
What it shows
| Page | Contents |
|---|---|
| Streams | the catalog, with filters, sorting and key-set paging (Next/Previous; no page numbers, because the cursor means "everything after this" and stays correct while streams are created) |
| Stream detail | one continuous candlestick chart (scroll to zoom, drag to pan, older bars load as you approach them, a live feed appends new bars) and the stream's statistics. Missing data takes width in proportion to its duration; a market closure is a thin dashed seam; the right edge is now, so a stopped feed is visibly short of it |
| Gaps | fleet triage, worst first by missing time (not gap count, since a market open 32 hours a week has a large total that is not a problem) |
| Stream gaps | one stream's gaps with their kind, status and actions |
| System | totals across the node and the largest streams by bytes stored |
| Cluster | per-node figures from every node of a cluster — holdings, rates and latency percentiles computed from two samples — with nodes that did not answer named |
The live chart is fed by Server-Sent Events from the dashboard API, which subscribes to the node and resumes from the newest bar the chart already has.
Gap actions
| Action | What happens | Needs |
|---|---|---|
| Fill | paste CSV (timestamp_); every row is checked in the browser, then the node writes the batch whole or refuses it whole |
WRITE_ |
| Auto-fill | the node makes the bars from the real ones either side — linear, forward (previous close) or backward (next open) — every made-up bar with zero volume |
WRITE_ |
| Accept | marks a derived stream's incomplete bar as accepted (known incomplete, keep it), or undoes that | WRITE_ |
Only gaps the node reports as fillable offer a fill; a market closure never does, and the node refuses one regardless. A filled gap becomes CLOSED, not deleted, and stays OPEN in the UI until the node confirms the write. If a fill fails mid-request its outcome is unknown: read the range back before retrying. Every gap action is written to the dashboard's log as an audit entry naming the user. See finding and filling gaps.
Running it
mirexa-dashboard -config /etc/mirexa/dashboard.yaml
The dashboard reads only the dashboard: and logging: sections, so it does not need
storage.data_dir and may share a file with a node. It refuses to start without a session
secret or without at least one user. Its configuration keys are listed with defaults in the
configuration reference; the essentials:
dashboard:
addr: 127.0.0.1:8080 # the API; put the proxy in front
metrics_addr: 127.0.0.1:9101 # its own Prometheus metrics; never equal to addr
session_secret_file: /etc/mirexa/secrets/session_secret
users:
- name: ops
password_hash: "pbkdf2-sha256$..."
permissions: [READ_CANDLES, WRITE_CANDLES, LIST_STREAMS]
upstream_addr: node1.internal:8080
upstream_addrs: [node2.internal:8080, node3.internal:8080] # cluster: more contact points
upstream_token_file: /etc/mirexa/secrets/upstream_token
upstream_permissions: [READ_CANDLES, LIST_STREAMS]
upstream_tls: true
upstream_ca_file: /etc/mirexa/tls/ca.pem
Users
Logins live in the configuration file: there is no user database, sign-up or password reset. A password is stored only as a PBKDF2-SHA256 verifier (600,000 iterations, 16-byte salt). Generate one:
mirexa-dashboard -hash-password
It reads a password from stdin and prints the password_hash line. A user's permissions
use the node's permission names (permissions); an unknown name
or a user granted nothing stops the dashboard at startup.
The upstream
The dashboard talks to the node as an ordinary wire-protocol client, through the same
routing client the Go SDK uses, so with several upstream_addrs any node of a cluster will
do and each request follows its partition to the node that serves it.
upstream_token_fileholds the dashboard's own token, re-read on every connect. Tokens last at most an hour, so something outside the dashboard (holding the signing key) must keep rewriting the file. Without a token file the dashboard dials unauthenticated, which only works against a node with auth off, and logs a warning saying so.upstream_permissionsis what the dashboard requires the node to grant. If the node grants less, the dashboard refuses to start (or, if it connected later, reports not ready) rather than serving actions the node will reject. Empty means "whatever the node grants".- If the node is unreachable at startup, the dashboard still starts, logs a warning, and connects when it can.
Sessions
POST /api/v1/auth/loginwith a name and password returns a session token (lifetimesession_ttl, 15 minutes) in the response body. The browser keeps it in memory only, never inlocalStorage, and sends it as a bearer token on every API call.- If
refresh_ttlis non-zero (12 hours by default), login also sets an HttpOnly refresh cookie,__Host-mirexa_refresh,SameSite=Strict,Path=/,Secureunlesssession_cookie_secure: false. After a page reload the application callsPOST /api/v1/auth/refresh, which uses only that cookie, to obtain a new session token. - The refresh window does not slide: refreshing never extends it, so after
refresh_ttlthe user types the password again. A refresh token carries no permissions, so a narrowed role takes effect at the next refresh; it cannot be used as a session token. - Session and refresh tokens are stateless and signed with the secret in
session_secret_file(at least 32 bytes, base64 or raw). Replacing that secret signs every user out at once; there is no per-session revocation.
Sign-in is throttled: ten failed attempts from one client address within fifteen minutes
answer 429, and a successful login clears the count.[1]
The throttle keys on the TCP peer's address (
RemoteAddr) and does not readX-Forwarded-For. Behind a reverse proxy every sign-in arrives from the proxy's address, so ten failed attempts by anyone lock every user out of signing in for up to fifteen minutes. The shipped nginx configuration forwardsX-Forwarded-For, but the dashboard ignores it (read frominternal/dashboard/http.goandlogin_throttle.go, 2026-10-30).
The API sets security headers on every response (a default-src 'none' content security
policy, since it serves no documents) and HSTS only when session_cookie_secure is on.
allowed_origins lists origins allowed to call it cross-origin; empty means none, and *
is refused.
Permissions: what a user can actually do
A user's effective capability is the intersection of three things:
effective = user's role (dashboard.users[].permissions)
∩ the dashboard's grant from the node (its token ∩ the node's security.max_permissions)
GET /api/v1/auth/capabilities returns role, upstream_grant and effective; the
interface enables controls by effective, and when one is unavailable it says which side
lacks the permission — the user's role (an administrator edits the user) or the dashboard's
grant (reissue the dashboard's token, or the node's ceiling narrows it). The node is the
enforcement point: the dashboard's own check is a convenience, and anything the node's grant
does not cover is refused there.
What each status code means is the most useful thing to know during an incident:
| Status | Means | Fix |
|---|---|---|
401 |
the user's session is missing, expired or invalid | sign in again (the only case where that helps) |
403 |
the session is valid and lacks a permission | change the user's role or the dashboard's grant |
503 |
the dashboard's own connection to the node failed — most often its token file expired | rewrite upstream_; it recovers on the next reconnect (up to about 30 s, the client's circuit-breaker cooldown), no restart needed |
429 |
too many failed sign-ins from this address — behind a proxy, from anyone | wait up to fifteen minutes |
The reverse proxy is required
The application must be served from the same origin as /api: the refresh cookie's
__Host- prefix and SameSite=Strict mean a browser sends it only then. Served from
another host or port, it is silently dropped and every reload signs the user out, with no
error anywhere. The repository's answer is nginx serving web/dist and proxying /api/ to
mirexa-dashboard; the configuration is deploy/nginx.conf and the whole stack is in
deploying with Docker Compose. The proxy must also pass the live-feed path
(/api/v1/streams/{id}/events) without buffering and with a long read timeout, and should
terminate TLS. mirexa-dashboard deliberately serves no static files.
Probes and metrics
| Endpoint | Meaning |
|---|---|
GET / |
the process is up (always 200) |
GET / |
200 only when connected to the node with at least the required grant; 503 with "upstream": or the granted and required permissions otherwise |
metrics_ / |
the dashboard's own mirexa_ families: connection state, auth and transport failures, reconnects, the granted permissions |
The full API is in the dashboard HTTP API reference.
Limitations
- Users live in a file; changing them needs a restart (the dashboard does not watch its configuration).
- Sessions cannot be revoked individually; rotate the session secret to end all of them.
- There is no offline write queue and no optimistic display of a write: a write the browser could not confirm must be re-made deliberately by a person.
- Rates and latencies in the Cluster view are computed from the last two samples
(
cluster_sample_interval, 2 s) and are null across a node restart.
References
Source
- /cmd/dashboard/main.go — startup,
-hash-password, required settings. configureUpstream— the node connection and its warnings.Server.routes— every route.handleReady, capabilities;allows.- /internal/dashboard/refresh.go, /internal/dashboard/session.go, /internal/dashboard/password.go, /internal/dashboard/login_throttle.go.
- /internal/dashboard/gap_fill.go, /internal/dashboard/gap_autofill.go, /internal/dashboard/gap_accept.go.
- /web/src/pages — the application's pages.
Tests
TestDashboard_EveryRouteIsExercisedByATest(/internal/dashboard/route_coverage_test.go).TestRefreshCookie_Flags,TestRefreshToken_IsNotAcceptedAsASessionToken,TestRefreshToken_CarriesNoPermissions,TestRefreshFlow_ReloadKeepsTheSession(/internal/dashboard/refresh_test.go).TestLoginThrottle_StopsOnlineGuessing,TestLoginThrottle_SuccessClearsThePenalty(/internal/dashboard/login_throttle_test.go).TestSecurityHeaders_HSTSOnlyWhenTheDeploymentIsHTTPS(/internal/dashboard/security_headers_test.go).TestHTTP_CapabilitiesAppliesTheCeiling(/internal/dashboard/http_test.go).
Further reading
External
- MDN, cookie prefixes (
__Host-) — https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#cookie_prefixes - OWASP Password Storage Cheat Sheet (PBKDF2 work factors) — https://cheatsheetseries.owasp.org/cheatsheets/Password_Storage_Cheat_Sheet.html
maxLoginFailuresandloginFailureWindowin /internal/dashboard/login_throttle.go;TestLoginThrottle_KeysOnHostNotPort. ↩︎