Skip to content

Enhance central and gateway roles with auto-compose and UI updates - #65

Merged
iChristwin merged 18 commits into
M3tering:mainfrom
fluxion9:main
Nov 18, 2026
Merged

iChristwin merged 18 commits into
M3tering:mainfrom
fluxion9:main

Conversation

@fluxion9

Copy link
Copy Markdown
Contributor

No description provided.

Read CONSOLE_ROLE from .env: central uses compose.central.yaml, defaults to
ghcr.io/fluxion9/console:main, validates CENTRAL_DOMAIN and the first-start
admin password, and starts the TLS proxy after Console readiness. Gateway
role is refused because it needs the agent. Standalone is unchanged.
Gateway dialog: add-gateway card, guided enrollment panel with copyable
.env line and live token expiry, status-coloured gateway cards with
activity stats, collapsible remote updates and confirmation dialogs for
revoke and delete. Styles follow the active desktop theme.

Rename: POST /api/gateways/:id/rename with the same name rules, audited.
Delete: POST /api/gateways/:id/delete soft-deletes the gateway: its
credential and pending enrollments are destroyed, the live agent link is
terminated, device pins are released, and billing/audit history is kept.
Existing central databases gain the deleted column on startup.
CONSOLE_ROLE=gateway validates CENTRAL_URL, ChirpStack settings and
enrollment before touching Docker, creates owner-only agent secrets
without replacing existing ones, stops the standalone Console, starts
Console and agent together and waits for the agent to stay up with a
credential. A failed first switch restores standalone only if the agent
never created an operations journal, so two deciders never run at once.

Compose defaults for gateway, updater and browser images now use :main.
The central enrollment panel shows all .env lines (with this central's
wss URL) and points at ./auto-compose.sh.
auto-compose.sh now creates an owner-only .env from .env.example on a
fresh checkout and explains what to fill in, refuses template
placeholders and malformed ChirpStack application IDs before touching
Docker (central ignores the ChirpStack ones), and explains missing
Docker, Compose or permissions.

docs/deployment-guide.md covers standalone, central and managed gateway
setup, gateway management on central, updates, returning to standalone,
an .env reference and troubleshooting. README Quick Setup points to it.
The sign-in page is served before authentication, so it cannot load the
desktop's stylesheets. It now has its own inline design matching the
desktop (brand mark, green palette, 'A little more connected.' hero),
with dark mode and a single-card phone layout.

The strict policy stays: default-src 'none', no scripts, and the inline
stylesheet is allowed only by its exact SHA-256 hash. Failed sign-ins
and rate limiting re-show the page with an inline error and keep a
well-formed, escaped username; the password is never echoed. Signing
out returns to the page with a confirmation.
CI publishes images as ghcr.io/<owner>/<repo>, so auto-compose.sh now
derives the default image from the origin remote (SSH or HTTPS,
lower-cased) instead of hardcoding an owner. Image precedence: --image,
CONSOLE_IMAGE (shell or .env, which was previously ignored), the running
image when it comes from the same repository and role, then
<repo>:main. Without a GitHub remote the old defaults remain.
…itory

Images are no longer read from .env: a CONSOLE_IMAGE line there is
ignored with a note (use --image to pin). auto-compose.sh exports the
updater and browser image names and the updater's trusted image/source
repository from the git origin remote.

On gateways with REMOTE_UPDATES_ENABLED=true (or an existing updater),
auto-compose.sh now runs compose.updater.yaml itself, sets the project
and deployment directory, stops the updater while it replaces Console
and agent, then recreates it. Remote updates are refused without a
GitHub remote, and the updater no longer has a built-in trusted
repository: compose.updater.yaml and the updater both require it.
.env.example and the guides are updated accordingly.
Lower the central administrator password minimum from 16 to 7
characters in the password hasher and the auto-compose.sh pre-check;
update .env.example and the guides. The 1024-byte maximum is unchanged.
Sign-in remains scrypt-hashed and rate limited per address and globally.
An Account button in the central top bar opens a change-password dialog
(current, new, confirm). POST /api/account/password verifies the
current password, enforces the 7-character minimum, refuses reusing the
current password and is rate limited per account (5 per 15 minutes) so
a stolen session cannot guess it. On success the hash is replaced and
every other session of that user is ended; the current one stays signed
in. Changes and failed attempts are audited without recording secrets.
The deployment guide explains it.
A gateway deploy that failed its readiness check rolled Console and
agent back to the previous image. The previous role was read from the
container environment, where CONSOLE_ROLE=gateway leaks in from .env
through env_file, so a restored standalone Console looked like a
gateway and the pair was 'restored' onto the old standalone image. That
image has no dist/agent, so the agent crash-looped and central never
saw the gateway again.

The previous role now comes from the compose file that created the
container, a pair is only rolled back onto an image that contains the
agent, and each failed agent check states its reason (restarted, never
created, or never enrolled).
ChirpStack's Docker setup publishes port 3001 for the Basic Station
gateway bridge. The gateway Console's loopback fallback defaulted to the
same port, so it failed to start on such gateways, the deploy failed its
readiness check, and the agent was left without a working Console.

The default is now 3011, defined once and shared by the Console, the
agent and the Browser tunnel blocklist. A port clash is logged plainly
(managed logs otherwise withhold error details), and auto-compose.sh
checks the port after stopping its own Console: if another program holds
it, nothing is replaced and the previous containers are started again.
The guide's troubleshooting covers it.
Chromium's screencast only sends a frame when something repaints, so a
static page could finish loading without one: the title updated but the
remote Browser stayed blank. This is what intermittently failed the CI
Browser test (canvas never left its 300px default within 5 seconds).

After the session starts and after each load, the engine now sends a
still screenshot if no screencast frame followed within 400ms; real
frames always take priority and the timer is cleared on close. The test
also allows a slow runner 15 seconds for that first picture.
Top bar: the gateway <select> and loose Gateways/Account/Sign out links
are replaced by a gateway switcher pill (status dot, name, chevron),
centred on wide screens and filling the bar on phones, and a round
account button with the user's initial. Settings and the clock stay.

The floating status strip over the desktop is gone. The selected
gateway's status and activity now appear only in the gateway menu,
which also lists gateways to switch to and opens Manage gateways. On
phones it is a full-width sheet and the management dialog is full
screen. The account menu shows who is signed in, Change password and
Sign out. Menus close on Escape, outside clicks or each other, support
arrow keys, and keep focus across live refreshes.

All selects get a thin chevron in each theme's muted colour, inset 14px
from the edge with matching space before it.
With no gateway selected (the new Central server option), Terminal SSHes
into the central host, Browser reaches the internet and central's local
network directly, and ChirpStack proxies CENTRAL_CHIRPSTACK_URL.
On hosts where localhost resolves to ::1 first, IPv4-only services were
refused.
Central and standalone switch to the -browser image, hand .data and the
extension volumes to its UID 1000, apply a seccomp profile that lets
Chromium's sandbox create namespaces, and check the sandbox starts.
Removes the Browser window, the remote Chromium engine and proxy, the
browser tunnel purpose, the console-browser image and CI builds, and all
Browser handling in auto-compose. A container left on a -browser image
moves back to the normal image on the next ./auto-compose.sh.
@iChristwin
iChristwin merged commit f1cec65 into M3tering:main Nov 18, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants