⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.
TypeScript honoissue-managementissue-trackerjira-alternativekanbanlinear-alternativemcpproject-managementreactself-hostedtypescript
fix(docker): support OpenShift runtime storage
Tin44c0b423f5e4
diff --git a/.github/workflows/helm-validate.yml b/.github/workflows/helm-validate.ymlindex 214906a0b..b4e638aec 100644--- a/.github/workflows/helm-validate.yml+++ b/.github/workflows/helm-validate.yml@@ -47,6 +47,18 @@ jobs:args: >---set postgresql.auth.existingSecret=kaneo-secrets--set kaneo.env.authSecret=secure-auth-secret-at-least-32-characters+ - name: openshift-read-only+ args: >-+ --set postgresql.enabled=false+ --set kaneo.env.database.external.enabled=true+ --set kaneo.env.database.external.host=db.example.com+ --set kaneo.env.database.external.password=secure-db-password+ --set kaneo.env.authSecret=secure-auth-secret-at-least-32-characters+ --set podSecurityContext.runAsNonRoot=true+ --set podSecurityContext.seccompProfile.type=RuntimeDefault+ --set kaneo.securityContext.readOnlyRootFilesystem=true+ --set kaneo.securityContext.allowPrivilegeEscalation=false+ --set kaneo.securityContext.capabilities.drop[0]=ALLsteps:- name: Checkout repositorydiff --git a/Dockerfile.kaneo b/Dockerfile.kaneoindex 78b6b89e9..64746f306 100644--- a/Dockerfile.kaneo+++ b/Dockerfile.kaneo@@ -90,11 +90,10 @@ FROM node:24.19.0-alpine AS runtimeRUN apk add --no-cache nginx=~1.30.4 && \addgroup -g 1001 appuser && \adduser -u 1001 -G appuser -D appuser && \- mkdir -p /app /app/apps/api/data /var/cache/nginx /var/run/nginx /var/log/nginx /var/lib/nginx/logs /var/lib/nginx/tmp /usr/share/nginx/html /docker-entrypoint.d && \- chown -R appuser:appuser /app /app/apps/api/data /var/cache/nginx /var/run/nginx /var/log/nginx /var/lib/nginx /usr/share/nginx/html /docker-entrypoint.d && \- touch /var/run/nginx.pid && \- chown appuser:appuser /var/run/nginx.pid && \- printf 'worker_processes auto;\nerror_log /var/log/nginx/error.log warn;\npid /var/run/nginx.pid;\nevents { worker_connections 1024; }\nhttp {\n include /etc/nginx/mime.types;\n default_type application/octet-stream;\n include /etc/nginx/conf.d/*.conf;\n}\n' > /etc/nginx/nginx.conf+ mkdir -p /app /app/apps/api/data /var/lib/kaneo /docker-entrypoint.d && \+ chown -R appuser:appuser /app && \+ chown appuser:root /var/lib/kaneo && \+ chmod 2775 /var/lib/kaneoWORKDIR /app@@ -105,8 +104,8 @@ RUN cd /app/apps/api && node -e "const fs=require('fs');for(const m of ['bcryptjnode --input-type=module -e "import { registerTools } from '@kaneo/mcp/tools'; if (typeof registerTools !== 'function') process.exit(1)"COPY --from=web-builder --chown=appuser:appuser /app/apps/web/dist /usr/share/nginx/html+COPY apps/web/nginx.main.conf /etc/nginx/nginx.confCOPY --chown=appuser:appuser apps/web/nginx.kaneo.conf /etc/nginx/conf.d/default.conf-RUN chown -R appuser:appuser /etc/nginx/conf.dCOPY --chown=appuser:appuser apps/web/env.sh /docker-entrypoint.d/env.shCOPY --chown=appuser:appuser apps/web/env.awk /docker-entrypoint.d/env.awkCOPY --chown=appuser:appuser deploy/kaneo-entrypoint.sh /usr/local/bin/kaneo-entrypoint.sh@@ -114,8 +113,9 @@ COPY --chown=appuser:appuser deploy/kaneo-entrypoint.sh /usr/local/bin/kaneo-entRUN chmod +x /docker-entrypoint.d/env.sh /usr/local/bin/kaneo-entrypoint.shENV NODE_ENV=production+ENV TMPDIR=/var/lib/kaneo/tmp-USER appuser+USER 1001:0EXPOSE 5173HEALTHCHECK --interval=30s --timeout=5s --start-period=60s --retries=3 \diff --git a/apps/web/Dockerfile b/apps/web/Dockerfileindex 8a6eff2e2..c6ef7b045 100644--- a/apps/web/Dockerfile+++ b/apps/web/Dockerfile@@ -50,31 +50,18 @@ RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN,required=false \# Production stage with specific versionFROM nginx:1.29.5-alpine AS runtime-# Create non-root user and configure nginx in a single layer+# Only runtime storage needs write access, including for an arbitrary UID.RUN addgroup -g 1001 appuser && \adduser -u 1001 -G appuser -D appuser && \- # Set permissions for nginx directories- chown -R appuser:appuser /var/cache/nginx && \- chmod -R 755 /var/cache/nginx && \- # Create directory for pid file- mkdir -p /var/run/nginx && \- chown -R appuser:appuser /var/run/nginx && \- chmod -R 755 /var/run/nginx && \- # Set permissions for nginx pid file- touch /var/run/nginx.pid && \- chown appuser:appuser /var/run/nginx.pid && \- chmod 644 /var/run/nginx.pid && \- # Update nginx configuration to run as non-root- sed -i 's/user nginx;/user appuser;/' /etc/nginx/nginx.conf && \- # Remove the user directive completely to avoid warnings- sed -i 's/user appuser;//' /etc/nginx/nginx.conf+ mkdir -p /var/lib/kaneo && \+ chown appuser:root /var/lib/kaneo && \+ chmod 2775 /var/lib/kaneo# Copy built files from builder stageCOPY --from=builder --chown=appuser:appuser /app/apps/web/dist /usr/share/nginx/html-# The inherited web root must be writable for atomic runtime configuration updates.-RUN chown appuser:appuser /usr/share/nginx/html# Copy nginx configuration and public runtime configuration renderer+COPY apps/web/nginx.main.conf /etc/nginx/nginx.confCOPY --chown=appuser:appuser apps/web/nginx.conf /etc/nginx/conf.d/default.confRUN chown -R appuser:appuser /etc/nginx/conf.d@@ -84,7 +71,8 @@ COPY --chown=appuser:appuser apps/web/env.awk /docker-entrypoint.d/env.awkRUN chmod +x /docker-entrypoint.d/env.sh# Switch to non-root user-USER appuser+ENV TMPDIR=/var/lib/kaneo/tmp+USER 1001:0EXPOSE 5173# Use exec form of CMD for proper signal handlingdiff --git a/apps/web/env.sh b/apps/web/env.shindex 163154ace..6185f327c 100644--- a/apps/web/env.sh+++ b/apps/web/env.sh@@ -4,9 +4,16 @@ set -eu# Values are read through awk's ENVIRON, never interpolated into shell, sed,# JavaScript, or nginx source. Do not print public or private environment values.script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)-asset_root=/usr/share/nginx/html+asset_source=/usr/share/nginx/html+asset_root=/var/lib/kaneo/htmlexport KANEO_ENV_RENDERER="$script_dir/env.awk"+# The image's assets stay immutable. A volume at /var/lib/kaneo also supports+# read-only root filesystems and OpenShift's arbitrary runtime UID.+mkdir -p "$asset_root" /var/lib/kaneo/nginx /var/lib/kaneo/tmp+cp -R "$asset_source/." "$asset_root/"+chmod -R u+rwX "$asset_root"+if [ -z "${KANEO_API_URL:-}" ]; thenecho "WARNING: KANEO_API_URL is not set. API calls may fail." >&2fidiff --git a/apps/web/nginx.conf b/apps/web/nginx.confindex 188dc5e9c..96d1046cd 100644--- a/apps/web/nginx.conf+++ b/apps/web/nginx.conf@@ -22,12 +22,12 @@ server {location = /.well-known/oauth-protected-resource/api/mcp {default_type application/json;- alias /usr/share/nginx/html/mcp-oauth-resource.json;+ alias /var/lib/kaneo/html/mcp-oauth-resource.json;}location = /.well-known/oauth-authorization-server/api {default_type application/json;- alias /usr/share/nginx/html/mcp-oauth-authorization.json;+ alias /var/lib/kaneo/html/mcp-oauth-authorization.json;}location /.well-known/ {@@ -41,14 +41,14 @@ server {}location / {- root /usr/share/nginx/html;+ root /var/lib/kaneo/html;index index.html;try_files $uri $uri/ /index.html;}# Cache static assets# location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {- # root /usr/share/nginx/html;+ # root /var/lib/kaneo/html;# expires 30d;# add_header Cache-Control "public, max-age=2592000";# access_log off;diff --git a/apps/web/nginx.kaneo.conf b/apps/web/nginx.kaneo.confindex 2311ccd4b..03165feba 100644--- a/apps/web/nginx.kaneo.conf+++ b/apps/web/nginx.kaneo.conf@@ -68,7 +68,7 @@ server {}location / {- root /usr/share/nginx/html;+ root /var/lib/kaneo/html;index index.html;try_files $uri $uri/ /index.html;}diff --git a/apps/web/nginx.main.conf b/apps/web/nginx.main.confnew file mode 100644index 000000000..d58b95876--- /dev/null+++ b/apps/web/nginx.main.conf@@ -0,0 +1,21 @@+worker_processes auto;+error_log /dev/stderr warn;+pid /var/lib/kaneo/nginx/nginx.pid;++events {+ worker_connections 1024;+}++http {+ include /etc/nginx/mime.types;+ default_type application/octet-stream;+ access_log /dev/stdout;++ client_body_temp_path /var/lib/kaneo/nginx/client_body;+ proxy_temp_path /var/lib/kaneo/nginx/proxy;+ fastcgi_temp_path /var/lib/kaneo/nginx/fastcgi;+ uwsgi_temp_path /var/lib/kaneo/nginx/uwsgi;+ scgi_temp_path /var/lib/kaneo/nginx/scgi;++ include /etc/nginx/conf.d/*.conf;+}diff --git a/charts/kaneo/README.md b/charts/kaneo/README.mdindex 69f88acdc..e9e745bf8 100644--- a/charts/kaneo/README.md+++ b/charts/kaneo/README.md@@ -121,7 +121,7 @@ When CPU autoscaling is enabled, set `kaneo.resources.requests.cpu`; Kubernetes| `kaneo.extraEnvFrom` | Additional Kubernetes EnvFromSource entries appended to the Kaneo container | `[]` || `kaneo.resources` | Resource requests and limits for the Kaneo container (optional, disabled by default) | `{}` || `podSecurityContext` | Security context applied at the Pod level | `{}` |-| `securityContext` | Security context applied at the container level | `{}` |+| `kaneo.securityContext` | Security context applied at the Kaneo container level | `{}` |### Ingress parameters| Name | Description | Value || ----------------------------------- | ------------------------------------------------------------------------------------------------------------------ | ------------------------------- |@@ -372,7 +372,7 @@ Common causes:- Incorrect host, port, or database name in the URI### PodSecurity warnings on install/upgrade-On clusters with Pod Security Admission enabled, you may see warnings like `would violate PodSecurity "restricted:latest"`. The chart exposes `podSecurityContext` and `securityContext` to address these. See the [Security](#security) section for recommended values.+On clusters with Pod Security Admission enabled, you may see warnings like `would violate PodSecurity "restricted:latest"`. The chart exposes `podSecurityContext` and `kaneo.securityContext` to address these. See the [Security](#security) section for recommended values.## ArchitectureThis chart deploys the following components:1. **Kaneo application**: Serves the web UI and API from the combined Kaneo image@@ -443,6 +443,33 @@ kaneo:capabilities:drop: ["ALL"]```+### OpenShift and read-only containers+Kaneo supports OpenShift's assigned UID. The chart mounts an `emptyDir` at `/var/lib/kaneo` for generated frontend assets, nginx state, and temporary files. These files are recreated at startup; application data remains in PostgreSQL and the configured object storage.++Leave `runAsUser`, `runAsGroup`, and `fsGroup` unset on OpenShift so its security policy can assign permitted IDs. With an external PostgreSQL database, the Kaneo container can use:+```yaml+podSecurityContext:+ runAsNonRoot: true+ seccompProfile:+ type: RuntimeDefault++kaneo:+ securityContext:+ readOnlyRootFilesystem: true+ allowPrivilegeEscalation: false+ capabilities:+ drop: ["ALL"]+```+The bundled PostgreSQL image has its own platform requirements; use an OpenShift-compatible database deployment or an external database on OpenShift.++When running the combined or standalone web image outside Helm with a read-only root filesystem, mount writable storage at `/var/lib/kaneo`. For example:+```bash+docker run --read-only \+ --tmpfs /var/lib/kaneo:rw,mode=0770,uid=1001,gid=0 \+ --env-file .env -p 5173:5173 ghcr.io/usekaneo/kaneo:latest+```+For a bind mount, grant write access to the container's UID or a group it belongs to. The image's default user is UID 1001 with GID 0; arbitrary UIDs can write its runtime directory through GID 0 when the root filesystem is writable.+### Registration ControlBy default, user registration is enabled. To disable new user registration:```yamldiff --git a/charts/kaneo/templates/deployment.yaml b/charts/kaneo/templates/deployment.yamlindex 0bb128d92..3f429cd86 100644--- a/charts/kaneo/templates/deployment.yaml+++ b/charts/kaneo/templates/deployment.yaml@@ -108,6 +108,12 @@ spec:{{- toYaml .Values.kaneo.readinessProbe | nindent 12 }}resources:{{- toYaml .Values.kaneo.resources | nindent 12 }}+ volumeMounts:+ - name: runtime+ mountPath: /var/lib/kaneo+ volumes:+ - name: runtime+ emptyDir: {}{{- with .Values.nodeSelector }}nodeSelector:diff --git a/deploy/kaneo-entrypoint.sh b/deploy/kaneo-entrypoint.shindex 2c9c90932..6bc71bfd4 100644--- a/deploy/kaneo-entrypoint.sh+++ b/deploy/kaneo-entrypoint.sh@@ -90,7 +90,7 @@ until wget -Y off --spider --quiet http://127.0.0.1:1337/api/health 2>/dev/null;doneecho "API is ready"-nginx -g "daemon off;" &+nginx -e /dev/stderr -g "daemon off;" &nginx_pid=$!while kill -0 "$api_pid" 2>/dev/null && kill -0 "$nginx_pid" 2>/dev/null; dodiff --git a/scripts/ci/compose.yml b/scripts/ci/compose.ymlindex 5c1eb9cd3..01c6cf695 100644--- a/scripts/ci/compose.yml+++ b/scripts/ci/compose.yml@@ -39,6 +39,13 @@ services:retries: 30app:image: ${KANEO_CI_IMAGE:-kaneo:ci}+ # Exercise the bundled image under OpenShift-style filesystem restrictions.+ user: "1001230000:1001230000"+ read_only: true+ cap_drop: [ALL]+ security_opt: ["no-new-privileges:true"]+ tmpfs:+ - /var/lib/kaneo:rw,mode=0770,gid=1001230000environment: &app-envNODE_ENV: productionDATABASE_URL: postgresql://postgres:ci-only-password@postgres:5432/kaneo_ci_testdiff --git a/scripts/security/check-helm-secrets.rb b/scripts/security/check-helm-secrets.rbindex da5042709..b4bd01503 100644--- a/scripts/security/check-helm-secrets.rb+++ b/scripts/security/check-helm-secrets.rb@@ -42,6 +42,10 @@ secured = render(*args, '--set', 'podSecurityContext.runAsNonRoot=true', '--set'deployment = secured.find { |d| d['kind'] == 'Deployment' && !d['metadata']['name'].end_with?('-postgresql') }context = deployment['spec']['template']['spec']['securityContext']verify(context['runAsNonRoot'] && context.dig('seccompProfile', 'type') == 'RuntimeDefault', 'Documented pod security settings are not applied')+runtime_mount = deployment['spec']['template']['spec']['containers'].first.fetch('volumeMounts').find { |mount| mount['mountPath'] == '/var/lib/kaneo' }+verify(runtime_mount && !runtime_mount['readOnly'], 'Kaneo runtime storage must be writable')+runtime_volume = deployment['spec']['template']['spec'].fetch('volumes').find { |volume| volume['name'] == runtime_mount['name'] }+verify(runtime_volume && runtime_volume['emptyDir'] == {}, 'Kaneo runtime storage must use emptyDir')puts 'Helm secret, upgrade, external-secret validation and pod security checks passed'['', ' ', 'ftp://example.com', 'https://user:[email protected]', 'https://example.com/path', 'https://example.com?x=1', 'https://example.com#fragment'].each do |url|diff --git a/scripts/security/source-maps.test.mjs b/scripts/security/source-maps.test.mjsindex 94622d59c..80ecaea4d 100644--- a/scripts/security/source-maps.test.mjs+++ b/scripts/security/source-maps.test.mjs@@ -51,6 +51,8 @@ for (const config of ["nginx.conf", "nginx.kaneo.conf"]) {"--user=1001:1001","--mount",`type=bind,source=${fixture},target=/usr/share/nginx/html`,+ "--mount",+ `type=bind,source=${fixture},target=/var/lib/kaneo/html`,"--entrypoint","sh","nginx:1.29.5-alpine",diff --git a/scripts/security/web-runtime-env.test.mjs b/scripts/security/web-runtime-env.test.mjsindex afbd02d6d..e902f2210 100644--- a/scripts/security/web-runtime-env.test.mjs+++ b/scripts/security/web-runtime-env.test.mjs@@ -36,7 +36,7 @@ const scenarios = [{ name: "unset public values", api: "", client: "", key: "" },];-test("production runtime starts and serves configuration as its default non-root user", () => {+test("production runtime serves configuration with default and restricted users", async (t) => {const fixture = mkdtempSync(resolve(tmpdir(), "kaneo-web-runtime-"));const runtimeImage = `kaneo-web-runtime-test:${process.pid}`;const container = `kaneo-web-runtime-test-${process.pid}`;@@ -52,7 +52,21 @@ test("production runtime starts and serves configuration as its default non-rootfor (const asset of ["root.js", "assets/app.js"]) {writeFileSync(resolve(fixture, "dist", asset), '"KANEO_API_URL"');}- for (const file of ["nginx.conf", "env.sh", "env.awk"]) {+ writeFileSync(resolve(fixture, "dist/hook.js"), '"KANEO_CLIENT_URL"');+ const hook = resolve(fixture, "00-test.envsh");+ writeFileSync(+ hook,+ 'export KANEO_CLIENT_URL="https://hook.example.test"\n',+ {+ mode: 0o755,+ },+ );+ const template = resolve(fixture, "runtime.conf.template");+ writeFileSync(+ template,+ 'server { listen 5174; return 200 "$KANEO_CLIENT_URL"; }\n',+ );+ for (const file of ["nginx.conf", "nginx.main.conf", "env.sh", "env.awk"]) {copyFileSync(resolve(root, "apps/web", file),resolve(fixture, "apps/web", file),@@ -72,40 +86,81 @@ test("production runtime starts and serves configuration as its default non-root);docker(["image", "inspect", image]);docker(["build", "--network=none", "-t", runtimeImage, fixture], 120_000);- const output = docker([- "run",- "--rm",- "--name",- container,- "--pull=never",- "--network=none",- "--env",- "KANEO_API_URL=https://api.example.test/api",- runtimeImage,- "sh",- "-eu",- "-c",- [- 'test "$(id -u)" = 1001',- "/docker-entrypoint.sh nginx -t",- "nginx > /tmp/nginx-output.log 2>&1",- 'test "$(wget -qO- http://127.0.0.1:5173/)" = "runtime fixture"',- "wget -qO- http://127.0.0.1:5173/root.js",- "wget -qO- http://127.0.0.1:5173/assets/app.js",- "wget -qO- http://127.0.0.1:5173/.well-known/oauth-protected-resource/api/mcp",- "wget -qO- http://127.0.0.1:5173/.well-known/oauth-authorization-server/api",- "nginx -s quit",- ].join("; "),- ]);- const responses = output- .trim()- .split("\n")- .slice(-4)- .map((line) => JSON.parse(line));- assert.equal(responses[0], "https://api.example.test/api");- assert.equal(responses[1], "https://api.example.test/api");- assert.equal(responses[2].resource, "https://api.example.test/api/mcp");- assert.equal(responses[3].issuer, "https://api.example.test/api");+ for (const scenario of [+ {+ name: "default non-root user with nginx template",+ uid: "1001",+ args: [+ "--mount",+ `type=bind,source=${template},target=/etc/nginx/templates/runtime.conf.template,readonly`,+ ],+ },+ {+ name: "arbitrary OpenShift UID",+ uid: "1001230000",+ args: ["--user=1001230000:0"],+ },+ {+ name: "arbitrary UID and read-only root with writable volume",+ uid: "1001230000",+ args: [+ "--user=1001230000:1001230000",+ "--read-only",+ "--tmpfs=/var/lib/kaneo:rw,mode=0770,gid=1001230000",+ "--cap-drop=ALL",+ "--security-opt=no-new-privileges",+ ],+ },+ ]) {+ await t.test(scenario.name, () => {+ const output = docker([+ "run",+ "--rm",+ "--name",+ container,+ "--pull=never",+ "--network=none",+ ...scenario.args,+ "--mount",+ `type=bind,source=${hook},target=/docker-entrypoint.d/00-test.envsh,readonly`,+ "--env",+ "KANEO_API_URL=https://api.example.test/api",+ runtimeImage,+ "sh",+ "-eu",+ "-c",+ [+ `test "$(id -u)" = ${scenario.uid}`,+ "test ! -d /var/lib/kaneo/html",+ 'test "$(cat /usr/share/nginx/html/root.js)" = \'"KANEO_API_URL"\'',+ "/docker-entrypoint.sh nginx -t",+ 'test "$(cat /var/lib/kaneo/html/hook.js)" = \'"https://hook.example.test"\'',+ 'test "$(cat /var/lib/kaneo/html/mcp-oauth-resource.json)" != "{}"',+ "KANEO_API_URL=https://changed.example.test/api /docker-entrypoint.d/env.sh",+ 'test "$(cat /var/lib/kaneo/html/root.js)" = \'"https://changed.example.test/api"\'',+ "/docker-entrypoint.d/env.sh",+ "nginx -t",+ "nginx > /var/lib/kaneo/tmp/nginx-output.log 2>&1",+ 'test "$(wget -qO- http://127.0.0.1:5173/)" = "runtime fixture"',+ 'if [ "$(id -u)" = 1001 ]; then test "$(wget -qO- http://127.0.0.1:5174/)" = "https://hook.example.test"; fi',+ "wget -qO- http://127.0.0.1:5173/root.js",+ "wget -qO- http://127.0.0.1:5173/assets/app.js",+ "wget -qO- http://127.0.0.1:5173/.well-known/oauth-protected-resource/api/mcp",+ "wget -qO- http://127.0.0.1:5173/.well-known/oauth-authorization-server/api",+ "nginx -s quit",+ ].join("; "),+ ]);+ const responses = output+ .trim()+ .split("\n")+ .slice(-4)+ .map((line) => JSON.parse(line));+ assert.equal(responses[0], "https://api.example.test/api");+ assert.equal(responses[1], "https://api.example.test/api");+ assert.equal(responses[2].resource, "https://api.example.test/api/mcp");+ assert.equal(responses[3].issuer, "https://api.example.test/api");+ });+ }} finally {spawnSync("docker", ["rm", "-f", container], { timeout: 30_000 });spawnSync("docker", ["image", "rm", runtimeImage], { timeout: 30_000 });@@ -118,7 +173,11 @@ for (const scenario of scenarios) {const fixture = mkdtempSync(resolve(tmpdir(), "kaneo-web-env-"));try {chmodSync(fixture, 0o777);- const asset = resolve(fixture, "app with spaces\nand newline.js");+ mkdirSync(resolve(fixture, "dist"));+ mkdirSync(resolve(fixture, "runtime"), { mode: 0o777 });+ chmodSync(resolve(fixture, "runtime"), 0o777);+ const assetName = "app with spaces\nand newline.js";+ const asset = resolve(fixture, "dist", assetName);writeFileSync(asset,'globalThis.config = {api:"KANEO_API_URL",client:\'KANEO_CLIENT_URL\',callback:`KANEO_CLIENT_URL/auth/sign-in`,key:`KANEO_TURNSTILE_SITE_KEY`,private:"KANEO_SERVER_SECRET"};\n',@@ -127,10 +186,6 @@ for (const scenario of scenarios) {resolve(root, "apps/web/nginx.conf"),resolve(fixture, "server.conf"),);- writeFileSync(- resolve(fixture, "nginx.conf"),- "pid /tmp/nginx.pid;\nerror_log /tmp/nginx-error.log;\nevents {}\nhttp { access_log off; client_body_temp_path /tmp/client; proxy_temp_path /tmp/proxy; fastcgi_temp_path /tmp/fastcgi; uwsgi_temp_path /tmp/uwsgi; scgi_temp_path /tmp/scgi; include /usr/share/nginx/html/server.conf; }\n",- );const result = spawnSync("docker",[@@ -139,8 +194,15 @@ for (const scenario of scenarios) {"--pull=never","--network=none","--user=1001:1001",+ "--read-only",+ "--mount",+ `type=bind,source=${resolve(fixture, "dist")},target=/usr/share/nginx/html,readonly`,+ "--mount",+ `type=bind,source=${resolve(fixture, "runtime")},target=/var/lib/kaneo`,"--mount",- `type=bind,source=${fixture},target=/usr/share/nginx/html`,+ `type=bind,source=${resolve(root, "apps/web/nginx.main.conf")},target=/etc/nginx/nginx.conf,readonly`,+ "--mount",+ `type=bind,source=${resolve(fixture, "server.conf")},target=/etc/nginx/conf.d/default.conf,readonly`,"--mount",`type=bind,source=${resolve(root, "apps/web")},target=/renderer,readonly`,"--env",@@ -156,7 +218,7 @@ for (const scenario of scenarios) {image,"-eu","-c",- "sh /renderer/env.sh; nginx -t -c /usr/share/nginx/html/nginx.conf; nginx -c /usr/share/nginx/html/nginx.conf; wget -qO /usr/share/nginx/html/resource-response.json http://127.0.0.1:5173/.well-known/oauth-protected-resource/api/mcp; wget -qO /usr/share/nginx/html/authorization-response.json http://127.0.0.1:5173/.well-known/oauth-authorization-server/api; nginx -s quit -c /usr/share/nginx/html/nginx.conf",+ "sh /renderer/env.sh; nginx -t; nginx; wget -qO /var/lib/kaneo/resource-response.json http://127.0.0.1:5173/.well-known/oauth-protected-resource/api/mcp; wget -qO /var/lib/kaneo/authorization-response.json http://127.0.0.1:5173/.well-known/oauth-authorization-server/api; nginx -s quit",],{encoding: "utf8",@@ -171,7 +233,11 @@ for (const scenario of scenarios) {},);assert.equal(result.status, 0, result.stderr);- const source = readFileSync(asset, "utf8");+ assert.ok(readFileSync(asset, "utf8").includes('api:"KANEO_API_URL"'));+ const source = readFileSync(+ resolve(fixture, "runtime/html", assetName),+ "utf8",+ );const context = {};runInNewContext(source, context);assert.equal(context.config.api, scenario.api);@@ -183,10 +249,16 @@ for (const scenario of scenarios) {assert.ok(!source.includes("must-not-be-published"));assert.ok(!result.stdout.includes("site-key"));const resource = JSON.parse(- readFileSync(resolve(fixture, "resource-response.json"), "utf8"),+ readFileSync(+ resolve(fixture, "runtime/resource-response.json"),+ "utf8",+ ),);const authorization = JSON.parse(- readFileSync(resolve(fixture, "authorization-response.json"), "utf8"),+ readFileSync(+ resolve(fixture, "runtime/authorization-response.json"),+ "utf8",+ ),);if (!scenario.api) {assert.deepEqual(resource, {});