• Python 40.2%
  • JavaScript 32.1%
  • Go 9.7%
  • CSS 3.3%
  • Lua 2.9%
  • Other 11.8%
Find a file
2026-10-25 06:52:15 +00:00
.forgejo/workflows Add persistent GPU broadcaster and server spectator director 2026-10-23 03:56:20 +00:00
benchmarks Fan in perf/overnight-container, t3/9da00ebf, and t3/94d179bf performance work 2026-10-14 04:07:35 +00:00
cluster Promote the published Lua monitoring server image [skip ci] 2026-10-25 06:52:15 +00:00
config Add community Lua monitoring with native VictoriaMetrics push support [skip ci] 2026-10-25 06:51:03 +00:00
gateway Fix Envoy authentication and enforce Luanti player name limit 2026-10-18 19:43:52 +00:00
monitoring Retain upstream dashboard exports for reproducible imports [skip ci] 2026-10-25 06:51:48 +00:00
nix Add community Lua monitoring with native VictoriaMetrics push support [skip ci] 2026-10-25 06:51:03 +00:00
scripts Retain upstream dashboard exports for reproducible imports [skip ci] 2026-10-25 06:51:48 +00:00
site Preserve gateway routing in production site builds [skip ci] 2026-10-19 22:01:52 +00:00
streamer Use the main local PgBouncer and keep game queries in the home zone [skip ci] 2026-10-25 06:24:18 +00:00
tests Use the main local PgBouncer and keep game queries in the home zone [skip ci] 2026-10-25 06:24:18 +00:00
web Prevent mobile controls overlapping on short screens [skip ci] 2026-10-19 22:32:14 +00:00
.dockerignore Serve static Luanti with Authentik gateway and Nix Flux deployment 2026-10-10 16:58:21 -06:00
.env.example Serve static Luanti with Authentik gateway and Nix Flux deployment 2026-10-10 16:58:21 -06:00
.envrc Serve static Luanti with Authentik gateway and Nix Flux deployment 2026-10-10 16:58:21 -06:00
.gitattributes Persist readable Authentik names and warm the proxy media cache 2026-10-10 23:13:36 -06:00
.gitignore Fix browser launch and authentication, simplify packaging, and cache CI builds 2026-10-18 08:57:45 +00:00
.sops.yaml Keep broadcaster SOPS credentials in Luanti [skip ci] 2026-10-23 04:35:02 +00:00
compose.authentik.yaml Serve static Luanti with Authentik gateway and Nix Flux deployment 2026-10-10 16:58:21 -06:00
compose.bypass.yaml Add dev-only AUTH_MODE=bypass for gateway testing 2026-10-17 00:47:15 +00:00
compose.yaml Serve precompressed assets and add opt-in aggressive engine build 2026-10-13 22:47:30 +00:00
flake.lock Serve static Luanti with Authentik gateway and Nix Flux deployment 2026-10-10 16:58:21 -06:00
flake.nix Serve static Luanti with Authentik gateway and Nix Flux deployment 2026-10-10 16:58:21 -06:00
Makefile Add persistent GPU broadcaster and server spectator director 2026-10-23 03:56:20 +00:00
package-lock.json Config-driven auto quality, Pages site, direct gateway API 2026-10-15 03:26:55 +00:00
package.json Config-driven auto quality, Pages site, direct gateway API 2026-10-15 03:26:55 +00:00
README.md Add community Lua monitoring with native VictoriaMetrics push support [skip ci] 2026-10-25 06:51:03 +00:00

Luanti browser lab

VoxeLibre in the browser: a WebAssembly client, a Go WebSocket gateway, and a dedicated Luanti server. The gateway embeds mt-multiserver-proxy and adapts verified Authentik identities to short-lived Luanti SRP credentials.

Production serves the Astro site through Cloudflare Workers Static Assets. Kubernetes runs the gateway and game; Envoy handles gateway authentication. Caddy is used for local development only. Large media files are served through the Worker from Garage.

The gateway hostname routes through Envoy to the existing Go proxy service; it is not an additional deployment. The Go service is required because browsers cannot speak Luanti's UDP protocol. Routing those connections through the Worker would add another hop and require changes to Authentik's provider, cookies, and redirects, without removing that backend.

Development

Use direnv allow or nix develop on x86_64 Linux:

make test        # Node, Python, manifest, and Go checks
make build       # Compile the pinned WASM engine and package dist/ (expensive)
make refresh     # Repackage a local engine without recompiling
make refresh-web # Update UI/settings over an existing dist/ artifact
make up          # Build local images and start web, proxy, game
make down        # Stop services; persistent state remains in .runtime/

The Compose stack requires containerd with nix-snapshotter and nerdctl; ordinary Docker/Podman cannot run these images. Open http://localhost:8080. Local accounts register a player name on first join. The launcher does not save passwords.

When only browser UI or runtime settings change and an existing dist/ is available, use python3 scripts/update-web.py to refresh it without an upstream build tree. make refresh also repackages engine launcher patches and game media, so it needs the compiled upstream release.

For local testing without Authentik:

nerdctl --snapshotter nix compose -f compose.yaml -f compose.bypass.yaml up -d web proxy game

This explicitly enables AUTH_MODE=bypass, a fixed development identity. Production uses authentik; bypass is never enabled by a browser parameter. Rebuild images after gateway changes (make images) and refresh static files after browser changes.

For local SSO, set AUTHENTIK_OUTPOST in .env, then use compose.authentik.yaml instead of compose.bypass.yaml. Caddy strips browser identity headers and verifies /api/session and /proxy with the outpost. The provider must cover the local origin.

Configuration and embedding

The optional persistent broadcast camera has a native 1080p30 client, server camera director, graphics overlays and an Intel hardware encoding pipeline. Its stateless Kubernetes deployment starts at zero replicas until GPU allocation, credentials and a capture trial are ready.

  • config/client.json: initial native client settings. Saved game settings can override defaults.
  • web/graphics-config.mjs: commented startup effects, ordered automatic graphics milestones, and timing. Repackage web assets after editing; no engine compilation is needed.
  • config/server.conf: editable game configuration. Local Compose mounts it; CI copies it to the cluster ConfigMap source. See server operations for config-only changes, PostgreSQL migration, LuaJIT and monitoring.
  • web/mobile.mjs: touch layout and mobile graphics preset.
  • site/src/pages/play.astro: Astro composition of GameLayout and GameLauncher; see UI customization. Set PUBLIC_LUANTI_API_BASE when building to choose the gateway origin.
  • cluster/deployment.yaml: gateway environment, storage, resources, and probes.
  • monitoring/: pinned community Grafana dashboards and Lua metrics integration.
  • cluster/mapserver/mapserver.json: rendering settings for https://map.luanti.maio-tech.com.

The browser shell uses LUANTI_API_BASE for /api/* and WebSocket traffic, LUANTI_ASSET_BASE for static assets, and optional LUANTI_PROXY_URL for a separate WebSocket endpoint. Set these globals before loading app.mjs. See site/README.md for the existing Astro integration.

Serve the client with Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp. A cross-origin gateway must allow the exact site origin with credentials in both Envoy and the gateway's ALLOWED_ORIGINS. Browser game traffic uses WebSockets; browsers cannot connect directly to Luanti UDP. Cross-origin iframe embedding needs additional isolation and permissions configuration; the supplied integration embeds the client directly in the page.

Production and CI

  • https://luanti.maio-tech.com/: public home page with a Play link.
  • https://luanti.maio-tech.com/play/: game loading, sign-in, and the browser client.
  • /luanti/: engine assets, media, and installation files on the site origin.
  • https://luanti-gateway.maio-tech.com: API, WebSocket, and Authentik outpost routes.
  • Garage: versioned media origin, proxied by the Worker to keep browser asset requests same-origin.

Flux reconciles cluster/. The Servers repository registers this repository's Flux source/Kustomization and owns the shared HTTPS Gateway and cross-namespace ReferenceGrants. The shared CNPG cluster stores game blocks, players, auth and mod state after migration; Longhorn volumes preserve remaining world files and gateway identity state. NetworkPolicies restrict game UDP to the proxy and gateway HTTP to Envoy. There is no production Caddy deployment.

The Forgejo workflow runs tests, builds gateway/game Nix images in parallel with the browser job, and packages the Astro site. Job and step names describe their work directly. npm downloads and Go modules/test objects are cached separately; the patched SDK has one explicit restore/save pair. Compiled browser artifacts are cached by their source/options fingerprint before deployment, so a failed site deployment can retry without another engine compile. On main, ATTIC_TOKEN permits publishing closures; Flux image references are committed only after the website build passes; CLOUDFLARE_API_TOKEN and CLOUDFLARE_ACCOUNT_ID permit the Worker deployment. Garage upload uses GARAGE_ACCESS_KEY_ID and GARAGE_SECRET_ACCESS_KEY. Pull requests build and test without publishing.

Engine inputs are listed once in scripts/engine-inputs.mjs, including JavaScript readers injected into WASM. A web-only push first tries the compiled-engine cache, then artifacts from recent completed main runs, including runs whose later deployment failed. Every reused engine-build.json must match the current build inputs and options; current web assets are then refreshed over it. Missing, legacy, or mismatched artifacts require a full build. Packaging errors fail promptly instead of silently triggering another compile. Runtime JSON changes do not require a compile. A stale run cannot overwrite a site deployment after newer application changes reach main. /deployment.json exposes the deployed source revision, and /api/config exposes the promoted gateway revision for rollout verification.

SDK preparation is cached before compilation. CI keeps verbose preparation/compiler logs in the engine-build-logs artifact and streams a short progress line while the build runs.

Default CI engine builds use -O2, two compiler workers, SIMD, and embedded builtins. Manual workflow dispatch always rebuilds and can enable -O3, aggressive -O3 -flto, or the scalar fallback variant. Aggressive optimization and dual builds increase time and memory. For local builds, use the corresponding LUANTI_WASM_OPT_LEVEL, LUANTI_AGGRESSIVE_OPT, LUANTI_WASM_SIMD, LUANTI_WASM_SIMD_FALLBACK, and LUANTI_EMBED_BUILTIN environment variables. Switching features in an incremental upstream tree requires RECONFIGURE=true INCREMENTAL=true.

To publish gateway/game images manually:

nix build .#image-proxy .#image-game --no-link --print-out-paths > images.paths
xargs -r attic push main < images.paths
python3 scripts/update-images.py images.paths
# Review and commit cluster changes; Flux reconciles them after push.

The local image-web package still exists for Compose and requires --override-input web-dist path:./dist. It is not part of production CI.

Authentication and backups

The page is public. Envoy checks /api/session and /proxy with Authentik’s native /auth/envoy endpoint and replaces browser identity headers with the verified UID/name headers. Route-level header removal must not follow this check: Envoy applies it afterward, which would erase the verified identity before the private gateway sees it. The outpost's login/logout routes and /api/config remain public so sign-in can start. Sign-in returns through the gateway root to SITE_URL.

The gateway assigns a readable player name owned by the Authentik UID and persists that assignment across restarts and username changes. Allowed names contain ASCII letters, digits, underscores, and hyphens, up to 19 characters (the engine reserves the twentieth byte for a terminator); collisions get stable suffixes. SSO accounts remain separate from local gateway accounts. Previously assigned 20-character names, which the browser could not launch, are shortened on their next session request with the same collision protection. Existing legacy ak_ player data is not automatically migrated.

Launching mints a random five-minute SRP credential held in gateway and browser memory. Minting replaces the previous unconsumed credential for that player. Expiry limits new logins, not an established game connection. The Authentik password never reaches Luanti.

Back up the PostgreSQL database, remaining world files, identity.key, and identity-names.json together after migration (or the whole SQLite world before migration). The public deployment's world is separate from .runtime/world.

Browser behavior

The home page loads no engine or game media. On /play/, authentication runs independently of engine initialization and media caching. Play opens sign-in in a separate window when needed; a blocked popup falls back to the current tab. The original game tab checks for the verified session for up to two minutes and enters the world once both sign-in and loading finish. Auth return pages avoid starting another game client. Graphics/control settings stay collapsed by default. Advanced information defaults on for verified Sammy and off for everyone else; the saved launcher setting overrides either default. With it off, players get a small fullscreen button. This is a display preference, not a server permission.

Use a browser with WebAssembly JSPI, threads, OffscreenCanvas, and WebGL2 over HTTPS or localhost. Recent Chromium is the validated target; installing the PWA does not add missing browser features. Safari support depends on its version and has not been validated on an iOS device.

Automatic graphics begins at full clarity, 64 nodes / 30 FPS, expands to 160 nodes, then tries 60 FPS. Clarity takes priority over 60 FPS and long distance. Failed promotions wait two minutes before retrying; sustained low FPS steps down, while healthy FPS restores clarity before extending distance. Hidden tabs do not drive adaptation. Manual mode preserves native settings; changing native distance or FPS while Automatic is active switches the browser to Manual. Effects requiring an engine restart still require relaunching.

Media downloads into an indexed OPFS binary and survives engine-only rebuilds. Only complete downloads publish a ready index. Failed or unavailable OPFS storage falls back to the archive installer. Engine readers verify server SHA-1 hashes and use bounded read-ahead; large bundles avoid whole-file buffering. Base packs are versioned by content. The proxy warms its persistent media cache before /api/ready reports readiness.

Touch mode uses native Luanti touch controls, an editable layout, and a browser input bridge for the mobile keyboard. Presets apply once or through the explicit launcher button; saved settings remain available. Launch requests landscape fullscreen where supported, and an in-game button restores fullscreen. The PWA caches a small offline message and installation assets; sign-in and gameplay require a server connection.

The browser build pins paradust7/luanti-wasm commit 3d6796615a8f42ddee7b169589025d167d3181d6; VoxeLibre is 0.92.3. Retest client/server/proxy compatibility whenever updating pins. Startup timings are exposed through luantiStartup, and live performance through luantiMetrics.

Repository

  • web/, site/: client UI/modules and Astro/Worker integration.
  • gateway/: Go authentication and WebSocket transport, tests, upstream proxy patch.
  • scripts/: pinned build, engine patches, packaging, compression, CI helpers.
  • config/, cluster/: runtime defaults, local Caddy, Flux manifests.
  • nix/, flake.nix, compose*.yaml: development tools and snapshotter images.
  • tests/, benchmarks/: automated checks and performance probes.
  • upstream/, .runtime/, dist/, dist-site/: ignored build output and local state.

For a real backend regression, build gateway.test and run LUANTI_TEST_BACKEND=game:30000 ./gateway.test -test.run TestBackendLogin -test.v from an isolated directory. The test uses a separate loopback UDP port and checks a readable SSO account receives complete game definitions.