⚡ 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): warn when nginx configs still serve the old web root
Tin9e8e4e22ccf1
diff --git a/apps/web/env.sh b/apps/web/env.shindex 6185f327c..b778b993b 100644--- a/apps/web/env.sh+++ b/apps/web/env.sh@@ -18,6 +18,12 @@ if [ -z "${KANEO_API_URL:-}" ]; thenecho "WARNING: KANEO_API_URL is not set. API calls may fail." >&2fi+# Runs after nginx's template hook, so rendered templates are checked too.+# Server configs from older images serve the unconfigured build from there.+if grep -qsF /usr/share/nginx/html /var/lib/kaneo/nginx/conf.d/*.conf; then+ echo "WARNING: An nginx server config uses /usr/share/nginx/html, which serves the unconfigured build. Change it to root /var/lib/kaneo/html;" >&2+fi+# find -exec preserves spaces/newlines in filenames. Write each replacement# beside its source before atomically replacing the complete file.find "$asset_root" -type f -name '*.js' -exec sh -eu -c 'diff --git a/charts/kaneo/README.md b/charts/kaneo/README.mdindex 2240708fd..3bc12e73d 100644--- a/charts/kaneo/README.md+++ b/charts/kaneo/README.md@@ -470,7 +470,7 @@ docker run --read-only \```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.-nginx serves the web app from `/var/lib/kaneo/html`, where startup writes the runtime configuration, and reads server configuration copied from `/etc/nginx/conf.d` into `/var/lib/kaneo/nginx/conf.d`. If you mount your own server configuration, set `root /var/lib/kaneo/html;`; the previous `/usr/share/nginx/html` holds the unconfigured build. Templates in `/etc/nginx/templates` still render at startup, and `default.conf.template` replaces the bundled server configuration.+nginx serves the web app from `/var/lib/kaneo/html`, where startup writes the runtime configuration, and reads server configuration copied from `/etc/nginx/conf.d` into `/var/lib/kaneo/nginx/conf.d`. If you mount your own server configuration, set `root /var/lib/kaneo/html;`. The previous `/usr/share/nginx/html` still holds the unconfigured build, so a config that serves it breaks API calls and sign-in; startup logs a warning when a config still uses that path. Files you mount into `/usr/share/nginx/html`, such as a custom favicon, are still copied into `/var/lib/kaneo/html` and served, and startup never writes to them. Templates in `/etc/nginx/templates` still render at startup, and `default.conf.template` replaces the bundled server configuration.### Registration ControlBy default, user registration is enabled. To disable new user registration:diff --git a/scripts/security/web-runtime-env.test.mjs b/scripts/security/web-runtime-env.test.mjsindex bce54f2f6..f967d55f5 100644--- a/scripts/security/web-runtime-env.test.mjs+++ b/scripts/security/web-runtime-env.test.mjs@@ -66,6 +66,12 @@ test("production runtime serves configuration with default and restricted users"template,'server { listen 5174; return 200 "$KANEO_CLIENT_URL"; }\n',);+ // Server configs written for earlier images must trigger a startup warning.+ const legacy = resolve(fixture, "legacy.conf.template");+ writeFileSync(+ legacy,+ "server { listen 5175; root /usr/share/nginx/html; }\n",+ );for (const file of ["nginx.conf","nginx.main.conf",@@ -128,6 +134,8 @@ test("production runtime serves configuration with default and restricted users"`type=bind,source=${hook},target=/docker-entrypoint.d/00-test.envsh,readonly`,"--mount",`type=bind,source=${template},target=/etc/nginx/templates/runtime.conf.template,readonly`,+ "--mount",+ `type=bind,source=${legacy},target=/etc/nginx/templates/legacy.conf.template,readonly`,"--env","KANEO_API_URL=https://api.example.test/api",runtimeImage,@@ -138,7 +146,7 @@ test("production runtime serves configuration with default and restricted users"`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",+ "/docker-entrypoint.sh nginx -t 2>&1 | grep -F 'WARNING: An nginx server config uses /usr/share/nginx/html' >/dev/null","test -f /var/lib/kaneo/nginx/conf.d/default.conf","test -f /var/lib/kaneo/nginx/conf.d/runtime.conf",'test "$(cat /var/lib/kaneo/html/hook.js)" = \'"https://hook.example.test"\'',@@ -240,6 +248,7 @@ for (const scenario of scenarios) {},);assert.equal(result.status, 0, result.stderr);+ assert.ok(!result.stderr.includes("/usr/share/nginx/html"));assert.ok(readFileSync(asset, "utf8").includes('api:"KANEO_API_URL"'));const source = readFileSync(resolve(fixture, "runtime/html", assetName),