Repository navigation
feat: ship fabriq-admin as a runtime-configured container image - #1
Merged
Merged
Conversation
…sh workflow The npm job ran its own install, build, test, stamp and `pnpm -r publish` steps. It now gates on the shared node-ci workflow and publishes through npm-publish.yml@v1 with an explicit, dependency-ordered package list, `next` for pre-release tags, provenance, and skip-existing so a half-finished release can be resumed. The image job is unchanged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The console now ships as a container image you configure at start, not at build time. One image works on any host and under any URL prefix, which is what Loomplane needs to offer a hosted Fabriq with its admin console in one click.
What changed
readRuntimeConfig()in admin-sdk readswindow.__FABRIQ_ADMIN_CONFIG__from aconfig.jsthe container writes, then falls back to theVITE_*env and the old defaults. A relativeapiUrlis resolved against the page, so/console/adminworks behind a prefix. Adsnon the window object is ignored, so a key can't end up in a served file.<base href="/">,base: "./"in Vite and aconfig.jsplaceholder. The router mounts at the runtime base path, andFABRIQ_ADMIN_DEFAULT_TENANTpreselects a tenant when the browser has none.listTenantsreads the{ tenants }envelope the server actually returns. It was readingitemsand always coming back empty.nginxinc/nginx-unprivileged:1.27-alpine, port 8080, uid 101,/healthz. Only/tmphas to be writable, so a read-only root filesystem works. The entrypoint script validates every env value and exits 1 before nginx starts if anything is off (quotes, semicolons, spaces, newlines,.segments and so on).FABRIQ_ADMIN_UPSTREAMset,/admin/is proxied to the Fabriq server with buffering off, so SSE streams work. With a key set, the proxy addsAuthorization: Bearerand overrides whatever the browser sent. It also drops the browser'sCookieheader, lifts nginx's 1 MB body limit (file uploads are base64 JSON), and returns 403 to cross-site and same-site browser requests, since the injected key turns/admin/into an ambient credential.xraph/workflowsnode-ci.yml@v1(test, then build) and gets animagejob running the entrypoint tests and a Docker smoke test. The check names change toci / Check (node 24)andContainer image.release.ymlpublishes the npm packages throughnpm-publish.yml@v1after a CI gate: all 25 packages in dependency order,nextfor pre-release tags, provenance on. Itsimagejob pushesghcr.io/xraph/fabriq-admin:<version>for amd64 and arm64, plus:<major>.<minor>for stable versions. The README has a "Run the container" section.Things you should know
The upstream hostname is resolved once, when the container starts. If it doesn't resolve then, the container exits. If the Fabriq container is recreated with a new IP, restart the console. On Kubernetes, point it at a Service and this never comes up.
When a key is injected, the console doesn't ask for a login, so anyone who can reach it gets that key's rights. Keep it behind an authenticated proxy and never route it publicly.
How we checked it
pnpm test: 598 tests pass.pnpm -r buildis clean.sh deploy/docker/entrypoint_test.sh: 74 pass, including every injection character on the key, upstream and base path.sh deploy/docker/smoke.sh:smoke: ok. It runs the image read-only as uid 101 against an echo upstream and checks key injection, cookie stripping, the 403s, base path rewriting on deep links, cache headers and exit 1 on bad env.docker buildx build --platform linux/amd64,linux/arm64builds both.actionlinton both workflows: clean./console/prefix-stripping nginx. Every asset and federation chunk loads, and the upstream sees/admin/...with the injected key andX-Tenant-ID. That run is how we caught the relativeapiUrlbeing applied twice, which the fix commit covers with a test.