Skip to content

feat(ui): show the layers each earner got, and choose gVisor per earner from the Fleet page - #894

Closed
Amigadelasmigas wants to merge 10 commits into
GeiserX:mainfrom
Amigadelasmigas:feat/sec-l1-layers-ui
Closed

Amigadelasmigas wants to merge 10 commits into
GeiserX:mainfrom
Amigadelasmigas:feat/sec-l1-layers-ui

Conversation

@Amigadelasmigas

@Amigadelasmigas Amigadelasmigas commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

The owner should decide how many layers protect the computer, and see which layers each earner really got. Today the page shows neither. Turning gVisor on means editing env variables on the worker, with no way to tell from the UI whether it took.

This PR adds a Security layers row per worker on the Fleet page:

  • Chips for the socket proxy, the LAN fence, gVisor (installed, missing, unsupported or unknown) and the Secure VM. A host shows whether it has KVM. A worker inside a Secure VM shows its fence, and shows ok only for a fresh ok from the host's guard.
  • Per earner: fenced or not, Standard (runc) or gVisor, inside the Secure VM when it is, and a button that switches the runtime. A running earner is redeployed after a confirm that says so.
  • A worker default for earners deployed from now on. Setting it records the current runtime of the earners already there, so they do not move.
  • A locked choice with the reason when the catalog requires runc (Mysterium, the GPU miners, through the new runtime_reason field), when an env variable pins it, or when gVisor is not installed.
  • The pinned install and undo commands for cashpilot-gvisor. Each one downloads from the release tag and checks the sha256 before sudo. A dev build shows why it has no command.
  • Check gVisor, which runs the worker's red/green probe.

The dashboard row gets a small "fenced · gVisor" badge per copy. Every new string goes through t(), and the English keys are in en.json.

Stack: 3 of 4, on #885 (i18n plumbing) and #900. #892 is merged. Once #885 and #900 merge, a replacement PR rebased on main takes over from this one.

Desktop: the deploy route now sends runtime_choice, but never to a Desktop or Android worker, so the Desktop deploy form needs nothing. The catalog gains runtime_reason on three services, so Desktop must read the new field: GeiserX/CashPilot-Desktop#388.

Tests: tests/test_layers_ui.py has 35 tests. Mutations went red: dropping the body injection, faking the fence, lifting the bridge-only env lock, and treating a stale Secure VM fence as fresh. The fleet staleness check passes with 80 assertions. Full suite: 12744 passed. The 3 failures are local only, because they need .git in the test copy.

Real browser (dark, headless Chromium), against UI + worker + proxy built from this branch on a throwaway Ubuntu 24.04 box:

  • Check gVisor went green for both runtimes.
  • Run under gVisor showed both confirms. Honeygain was redeployed as runsc-hostnet on cashpilot-isolated, and the row and the dashboard badge said "fenced · gVisor".
  • Run under Standard took it back to runc.
  • The page threw no errors.

The Security layers row after Check gVisor went green, on a throwaway Ubuntu 24.04 box. Look at the per-earner lines and the check result:

sec-l1-fleet-layers

The dashboard badge per copy, after Honeygain moved to gVisor:

sec-l1-dashboard-badge

…cales

The web UI is English only. This adds what the 20 languages need and
changes nothing visible yet: only English ships, so the picker stays
hidden until a second locale file exists.

- app/i18n: one JSON file per locale; translations carry the hash of
  their English source and fall back to English when stale or missing.
- Language order: saved choice, cp-lang cookie, Accept-Language, English.
- t() in templates and the browser, one ICU subset on both sides; server
  plural rules checked against Node's Intl.
- Picker in the avatar menu and the sign-in bar; user_preferences.language
  with a migration; <html lang dir> on every page.
…ort what each host can give

The runtime choice was env-only, so an owner could not pick gVisor for one
earner from the UI, and the UI could not show which earners really got it.

- The heartbeat reports system_info.layers: the runtimes Docker registered and
  which are gVisor (judged by the binary, not the name), KVM from sysfs, and
  what CASHPILOT_CONTAINER_RUNTIME and its overrides pin. Unread values are
  null, so an older or blind worker reads as unknown, not absent.
- Each container entry carries its runtime and network.
- A deploy takes runtime_choice, runc or gvisor. gVisor becomes the
  --network=host variant Docker's DNS needs on our bridge, plus --net-raw for
  an earner whose catalog declares NET_RAW (Bitping).
- A choice that the catalog (Mysterium needs runc) or an env pin overrules is
  refused with the reason before the running container is touched. The env
  still wins over the UI; nothing is swapped silently.
- No choice means Docker's default, as before.
…h a red/green check

Installing gVisor needs root on the host, which the worker does not have and
must not get, and a runtime's name proves nothing: runsc-hostnet can point at
runc.

- scripts/cashpilot-gvisor (install, status, undo) pins gVisor release
  20261123.1 by sha512, installs it apart from any runsc the owner has, backs
  up daemon.json and registers runsc-hostnet and runsc-hostnet-raw with
  runsc's own installer. It reloads Docker, so running containers keep
  running; a restart is offered only if the reload is not enough, and always
  asked for, even with --yes. It refuses on Unraid (pointing to a VM), Docker
  Desktop, rootless and snap Docker.
- undo refuses while a container still uses our runtimes, restores daemon.json
  byte for byte (or removes only our runtimes after a later edit), deletes the
  binaries and its state, and checks that nothing is left.
- POST /api/layers/gvisor-check runs one probe per gVisor runtime an earner
  would get, on the earners' network: green needs gVisor's kernel and a
  working name lookup. The heartbeat carries the last answer.
…er from the Fleet page

The Fleet page gets a Security layers row per worker: the socket proxy, the
LAN fence, gVisor and KVM for the Secure VM, then per earner whether it is
fenced and whether it runs under Standard (runc) or gVisor. The owner picks
the runtime per earner or as the worker's default for new earners. A choice
the catalog, an env pin or the worker cannot honour is locked with the
reason. A running earner is redeployed after a confirm.

The row also shows the pinned install and undo commands for cashpilot-gvisor
and runs the worker's red/green gVisor check. The dashboard row carries a
compact fenced/runtime badge per copy.
@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 844f3ed and 24dc088.

Files selected for processing: 45

  • .dockerignore
  • .github/workflows/test.yml
  • Dockerfile
  • Dockerfile.worker
  • app/catalog.py
  • app/database.py
  • app/deps.py
  • app/gvisor_check.py
  • app/i18n/__init__.py
  • app/i18n/en.json
  • app/layer_scripts.py
  • app/layers.py
  • app/layers_ui.py
  • app/main.py
  • app/orchestrator.py
  • app/routers/layers.py
  • app/routers/pages.py
  • app/static/css/style.css
  • app/static/js/app.js
  • app/static/js/i18n.js
  • app/templates/_i18n_scripts.html
  • app/templates/_language_picker.html
  • app/templates/auth.html
  • app/templates/base.html
  • app/templates/fleet.html
  • app/templates/onboarding.html
  • app/worker_api.py
  • pyproject.toml
  • scripts/cashpilot-gvisor
  • scripts/dashboard_row_check.mjs
  • scripts/fleet_staleness_check.mjs
  • scripts/i18n_format_check.mjs
  • services/_schema.yml
  • services/bandwidth/mysterium.yml
  • services/mining/kryptex-pearl.yml
  • services/mining/srbminer-multi.yml
  • tests/conftest.py
  • tests/fixtures/i18n_format_cases.json
  • tests/fixtures/i18n_plural_cldr.json
  • tests/test_beads_batch_3.py
  • tests/test_gvisor_check.py
  • tests/test_i18n.py
  • tests/test_layers.py
  • tests/test_layers_ui.py
  • tests/test_route_at_deploy.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

…ntime choice that a named runtime or a routed copy cannot honour
…eep its runtime through a restore or a later env pin
@Amigadelasmigas

Copy link
Copy Markdown
Collaborator Author

Replaced by #916, the same work rebased on main after #885 and #900 merged.

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