Skip to content

Web Console

Mohammad Rasoul Kazemi edited this page Dec 1, 2026 · 6 revisions

Web Console

The web console (the "panel") is a single-page application written with Vue 3, TypeScript and Vite. It is a client of the REST API in kingres/api/openapi.yaml (REST API Reference) and of nothing else (ADR 0017 chose Vue; the Go backend and the OpenAPI-first contract are unchanged from ADR 0016). kingresd embeds the production build and serves it on every node, so every server has a console (ADR 0014). See Control Plane and REST API.

Status: the console is part of the first release, 0.1.0, published on 2026-11-28. It follows the REST contract 0.34.0 (178 operations): the generated types and the operation table are checked against the contract by npm run api:check. Phase 3 (panel) was independently reviewed twice; the pages added later (failover, ledger, configuration, analytics, transfers) were checked against the server code by their authors. The end-to-end script that drives a real kingresd has not been run against a current cluster; the README says so.

Signing in and roles

The first run of a node (state uninitialized) shows the setup wizard; after that every server shows the sign-in page. You sign in with a PostgreSQL role that has LOGIN and belongs to a cluster role. A session belongs to the server that created it: a client signs in once per server, and a restart of that server ends the session. The sign-in page says so. If the system database is stopped, the console explains how to start the instance (for example with pg_ctl start) or to restart kingresd.

Navigation and buttons follow the cluster role (kingres_admin, kingres_ops, kingres_readonly, kingres_stats; admin includes ops, ops includes readonly, readonly includes stats). A page whose operation the role may not call is not offered; a button the role may not use is disabled with its reason. The dashboard needs only the stats role, so a metrics-only account has a landing page. Values the server does not know are shown as "n/a", never as 0.

Pages

The navigation has a Cluster scope and a This server scope. The routes and page files are in kingres/web/src/router and kingres/web/src/pages.

Page Route What it does
Setup wizard /setup Create a new cluster or join an existing one. Shows the fingerprint of this server, lets you pin the fingerprint of the other server, and follows the setup task through GET /setup/state. See Cluster Setup
Sign in /login Role name and password
Dashboard /dashboard Counts of servers and databases, servers that need attention or whose data is unreachable, charts of the last hour, open alerts and recent tasks
Servers, Server /servers, /servers/:id List with status; add a server; server groups; the weight of a server; drain a server with a preview (and return it to service); per server: group, placement, certificate and first contact, leases of the primaries on it, instances, buckets by database; failover and other actions
Databases, Database /databases, /databases/:name Create a database (sharding mode for rows, schemas or both, bucket count, ledger, durability), edit mutable settings, drop with type-the-name confirmation; per database the tables, the distributed schemas (distribute, move, make local), distributing a table, turning on the ledger, approximate aggregates, and the export and import of a database. A transfers panel lists the staged exports and uploads and has the dialogs for the CSV export and import of a table. Transfers are off until the cluster setting dataTransfer.enabled is on
Table /databases/:name/tables/:schema/:table The table lifecycle: distribute (also with the related tables that foreign keys link, in one task), change the distribution, make the table ordinary again, partitions (create, attach, detach, drop), the storage (row or columnar) with a preview, the time-partitioning policy with its plan and runs, and a badge for the long operation that runs on the table
Shards /shards Bucket map of a sharded database, moving and orphan buckets, splitting a bucket (with a preview), and the distributed schemas per shard group
Replication /replication Last failover; per shard group the primary, standbys, whether a commit waits for a standby, the lease of the primary; failover dialog with plan, progress and report (the dialog of the map group can declare the candidate server lost, lostServerId); switchover of a group and of the map group; restore of preferred primaries; the replica count; the settings of automatic failover with its counter and banner. See High Availability
Rebalance /rebalance Status, options (strategy by bucket count or disk size, threshold, moves per server), preview of the plan with the reason for each move, start, stop, end a stopped run, the automatic mode (off by default) and past reports. Adding a server and rebalancing are two steps. See Rebalancing
Security /security Tabs: Roles, Access (grants), Network access (the ordered rules, with a dry-run check before saving), Certificate authority (the escrow of the CA key: show, switch on or off, rotate) and Audit log (merged across the servers). See Servers Databases and Roles
Ledger /ledger Tabs: Overview (status per database, one hash chain per shard group, what is published), Digests, Anchoring, Client keys, Signing, Publication (since 0.2.1: "Scheduled audit" with its settings, state, "Audit now" and the acknowledgement of an altered finding, and the reports of the ledger checks); dialogs for a bundle and for acknowledging a diverged chain. See Ledger, Ledger Signing and Publication, Ledger Anchoring
Query workbench /workbench Runs one SQL statement as the signed-in role in a chosen database, with a row limit and a time limit; cancel while running; shows the plan summary of a distributed statement
Tasks /tasks Long-running operations with steps, details and cancel. They continue if you close the page
Alerts /alerts Conditions that need attention, with acknowledge; says when only some servers answered. See Monitoring and Alerts
Logs /logs Log lines of all servers, newest first; /this-server/logs shows the local ones only
Settings /settings Cluster settings: default replica count, default durability, automatic failover (timeout, maximum count), concurrent moves, turning on sharding or the ledger for the whole cluster (permanent, confirmed), the analytics setting that lets owners who are not superusers convert tables, and the data transfer settings (on or off, retention, largest file, staging quota)
Configuration /configuration PostgreSQL parameters from the console (phase 13): tabs Parameters, Changes (history and revert), Time (clocks and time zones) and Extensions (whether kingres_columnar and pg_stat_statements are preloaded on every server; the install state of an extension in a database is not shown). Changing is for administrators. See Configuration
This server /this-server Fingerprint of this server, services, instances (start, stop, restart), resources (CPU, memory, disks), leave cluster
Not allowed, Not found Shown when a route is refused or unknown

A configuration change is previewed, then applied as a task with a step per server; a parameter that needs a restart is shown as pending. A failover dialog first shows the plan (a dry run), the blockers and what could be lost, and asks for an explicit decision before data could be lost.

Try it without a server

cd kingres/web
npm ci
npm run dev        # http://localhost:5173 with an in-memory mock API

Sign in with admin, ops, viewer or metrics and the password demo-password. The mock cluster has three servers, a map group, three shard groups and two databases. npm run dev:backend uses a proxy to a real kingresd at 127.0.0.1:8091. URL switches such as ?mock=uninitialized, ?mock=hostile and ?unsupported=listAlerts show the first-run wizard, hostile names and the "not available on this server version" state. Further switches (?rebalance=..., ?failover=...) exercise refusals, failed runs and blockers.

Tests

  • npm test (Vitest and Testing Library against the mock, about 15 seconds): problem messages, task polling, roles, wizard, pages, accessibility with axe, hostile names, session reset, a contract check that the mock covers every operation, and the contrast of the colour tokens.
  • npm run test:browser: a real Chrome or Edge for layout at 1366, 683 and 320 px, keyboard use, axe, and the production build under the content security policy.
  • npm run typecheck, npm run lint, npm run api:check (generated types match the contract), npm run brand:check.
  • An end-to-end run against a real kingresd is described in the README.

The panel has been independently reviewed (web panel, 0.5). See Testing Strategy.

Known limits

From the README: the SQL editor is a plain textarea, the replication page is a table, not a graph, and charts are simple SVG lines without zoom or tooltips. The workbench has no read-only mode because the API has none; it says "Mode: read-write". A statement cannot be cancelled after a reload because its id is not kept, and a cancel goes to the server that started the statement. Database or table names . and .. cannot be opened by address. The ledger summary of a database says "Last check passed", never "verified". A lease is shown as the answering server knows it; the console never says a primary is safe because a lease is held. GET /databases, /servers, /server-groups and the instance list are not paginated. The ledger check anchors is not built, so the console cannot start it (see Ledger Anchoring and Limitations and Known Issues).

What the server must send

The server must serve index.html for every path that is not a file and does not start with /api/, send the security headers and a content security policy (no inline script or style), and set the session cookie with the attributes in Security Model. These rules are tested on the server side.

Sources

Clone this wiki locally