fix(demo): SBOM-ingest workspace perms, small-box worker CPU cap, sandbox login hint - #522
Merged
Merged
Conversation
…dbox login hint
Three follow-ups found while standing up and demoing the Hetzner read-only
demo (BomLens -> TRUSCA SBOM upload):
- SBOM ingest 500 on fresh deploy. Backend runs non-root (uid 1000), worker
runs root; they share the /workspace volume, whose fresh mount root is
root:root 0755. The backend could not create sbom-ingest/<project_id> so
POST /v1/projects/{id}/sbom-ingest failed with PermissionError. Add a
worker_ready hook (tasks.workspace_prep) that makes the shared workspace
writable (1777) once at boot — the root worker is the natural owner of
shared-volume perms, and a signal hook survives the demo overlay's worker
command override. Source scans were unaffected (root worker did the writing).
- install.sh fails on <4-CPU hosts. Base compose capped the worker at
cpus: "4.0"; Compose V2 hard-errors when a cpus limit exceeds the host's
online CPU count, breaking up -d on a 2-vCPU box (the CAX11/CX23 runbook
default). Make it ${WORKER_CPU_LIMIT:-4.0} and have install.sh clamp it to
the host CPU count; hosts with >=4 CPUs keep 4.0.
- Login demo hint. The Demo Sandbox is team-scoped and invisible to the
browse-oriented frontend-admin account the login helper advertises. Add a
note directing live-scan / SBOM-upload users to dev@demo.trustedoss.dev.
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.
Three follow-ups found while standing up and demoing the Hetzner read-only demo (the BomLens → TRUSCA SBOM-upload path). None affects the currently-running demo (all worked around live); this makes the fixes durable in the repo.
Fixes
1. SBOM ingest 500 on a fresh deployment (bug #6)
Backend runs non-root (uid 1000,
Dockerfile.prod); worker runs root (Dockerfile.worker). They share the/workspacenamed volume, whose fresh mount root isroot:root 0755. The backend can't createsbom-ingest/<project_id>, soPOST /v1/projects/{id}/sbom-ingest→PermissionError→ HTTP 500. Source scans were unaffected (the root worker does that writing), which is why only SBOM upload broke.Fix: new worker-boot hook
tasks.workspace_prep— aworker_readyhandler (mirrorstasks.trivy_db_bootstrap) that makes the shared workspace writable (mode1777, the/tmpmodel) once at boot. The root worker is the natural owner of shared-volume perms, and a signal hook survivesdocker-compose.demo.yml's workercommandoverride (an init-container/commandfix would not). Idempotent, best-effort (logs on failure, never fatal).2.
install.shfails on a host with < 4 CPUs (bug #1)Base compose capped the worker at
cpus: "4.0". Under Compose V2 adeploy.resources.limits.cpusgreater than the host's online CPU count is a hard error atup(range of CPUs is from 0.01 to N), soinstall.sh's bring-up dies on a 2-vCPU box (the CAX11 / CX23 runbook default; the demo overlay caps to 2.0, so only the standalone install path hit this).Fix: cap is now
${WORKER_CPU_LIMIT:-4.0};install.shclampsWORKER_CPU_LIMITto the host CPU count (hosts with ≥ 4 CPUs keep the full 4.0). Documented in.env.example.3. Login demo hint points sandbox users to the right account (UX)
The Demo Sandbox is team-scoped (Backend team) and not visible to the browse-oriented
frontend-adminaccount the login helper advertises. A visitor following the hint can't find the scan/upload surface.Fix: the demo login hint now notes that running a live scan or uploading a BomLens SBOM requires signing in as
dev@demo.trustedoss.dev. EN + KO locales.Tests
tests/unit/tasks/test_workspace_prep.py— mode 1777, idempotency, OSError best-effort, worker_ready delegation, include-list registration. (Core logic validated locally; the pytest run needs CI's redis, same as the existing task tests.)install.shclamp verified (2→2,4→4,8→4),bash -nclean.Release
Target v0.19.1 after merge (server:
git reset --hard v0.19.1+IMAGE_TAG=0.19.1+ overlayup -d; the workspace-perm fix ships in the worker image, the CPU-cap in compose/install.sh, the hint in the frontend image).