Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

Revert "fix(docker): keep legacy nginx web root serving rendered assets"

Tin1167da9fca3a
diff --git a/Dockerfile.kaneo b/Dockerfile.kaneo
index 4c8a518b4..ba92fc40e 100644
--- a/Dockerfile.kaneo
+++ b/Dockerfile.kaneo
@@ -100,10 +100,7 @@ RUN apk add --no-cache nginx=~1.30.4 && \
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/kaneo && \
- rm -rf /usr/share/nginx/html && \
- mkdir -p /usr/share/nginx && \
- ln -s /var/lib/kaneo/html /usr/share/nginx/html
+ chmod 2775 /var/lib/kaneo
WORKDIR /app
@@ -113,7 +110,7 @@ COPY --from=api-runtime --chown=appuser:appuser /app /app
RUN cd /app/apps/api && node -e "const fs=require('fs');for(const m of ['bcryptjs','hono','pg','drizzle-orm','better-auth','ioredis','valibot','octokit','@modelcontextprotocol/sdk']){fs.accessSync('node_modules/'+m+'/package.json')}for(const m of ['email','permissions','importers']){fs.accessSync('node_modules/@kaneo/'+m+'/dist/index.js')}" && \
node --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/kaneo/html
+COPY --from=web-builder --chown=appuser:appuser /app/apps/web/dist /usr/share/nginx/html
COPY apps/web/nginx.main.conf /etc/nginx/nginx.conf
COPY --chown=appuser:appuser apps/web/nginx.kaneo.conf /etc/nginx/conf.d/default.conf
COPY --chown=appuser:appuser apps/web/runtime-storage.sh /docker-entrypoint.d/05-kaneo-runtime-storage.sh
diff --git a/apps/web/Dockerfile b/apps/web/Dockerfile
index 84bef02fd..b22514e5d 100644
--- a/apps/web/Dockerfile
+++ b/apps/web/Dockerfile
@@ -51,18 +51,14 @@ RUN --mount=type=secret,id=SENTRY_AUTH_TOKEN,required=false \
FROM nginx:1.29.5-alpine AS runtime
# Only runtime storage needs write access, including for an arbitrary UID.
-# The legacy web root links to the rendered assets so mounted server configs
-# with `root /usr/share/nginx/html` keep serving the configured app.
RUN addgroup -g 1001 appuser && \
adduser -u 1001 -G appuser -D appuser && \
mkdir -p /var/lib/kaneo && \
chown appuser:root /var/lib/kaneo && \
- chmod 2775 /var/lib/kaneo && \
- rm -rf /usr/share/nginx/html && \
- ln -s /var/lib/kaneo/html /usr/share/nginx/html
+ chmod 2775 /var/lib/kaneo
# Copy built files from builder stage
-COPY --from=builder --chown=appuser:appuser /app/apps/web/dist /usr/share/kaneo/html
+COPY --from=builder --chown=appuser:appuser /app/apps/web/dist /usr/share/nginx/html
# Copy nginx configuration and public runtime configuration renderer
COPY apps/web/nginx.main.conf /etc/nginx/nginx.conf
diff --git a/apps/web/env.sh b/apps/web/env.sh
index d4db7dc33..6185f327c 100644
--- a/apps/web/env.sh
+++ b/apps/web/env.sh
@@ -4,7 +4,7 @@ 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_source=/usr/share/kaneo/html
+asset_source=/usr/share/nginx/html
asset_root=/var/lib/kaneo/html
export KANEO_ENV_RENDERER="$script_dir/env.awk"
diff --git a/charts/kaneo/README.md b/charts/kaneo/README.md
index 2feade689..2240708fd 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, `root /usr/share/nginx/html;` keeps working because that path now links to `/var/lib/kaneo/html`, but `root /var/lib/kaneo/html;` is recommended. The unconfigured build lives in `/usr/share/kaneo/html`; do not serve it directly. 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` holds the unconfigured build. Templates in `/etc/nginx/templates` still render at startup, and `default.conf.template` replaces the bundled server configuration.
### Registration Control
By default, user registration is enabled. To disable new user registration:
diff --git a/scripts/security/source-maps.test.mjs b/scripts/security/source-maps.test.mjs
index 164ea5670..80ecaea4d 100644
--- a/scripts/security/source-maps.test.mjs
+++ b/scripts/security/source-maps.test.mjs
@@ -39,7 +39,7 @@ for (const config of ["nginx.conf", "nginx.kaneo.conf"]) {
);
writeFileSync(
resolve(fixture, "nginx.conf"),
- "pid /tmp/nginx.pid; error_log /tmp/nginx-error.log; events {} http { 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/kaneo/html/server.conf; }",
+ "pid /tmp/nginx.pid; error_log /tmp/nginx-error.log; events {} http { 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; }",
);
const result = spawnSync(
"docker",
@@ -50,7 +50,7 @@ for (const config of ["nginx.conf", "nginx.kaneo.conf"]) {
"--network=none",
"--user=1001:1001",
"--mount",
- `type=bind,source=${fixture},target=/usr/share/kaneo/html`,
+ `type=bind,source=${fixture},target=/usr/share/nginx/html`,
"--mount",
`type=bind,source=${fixture},target=/var/lib/kaneo/html`,
"--entrypoint",
@@ -59,16 +59,16 @@ for (const config of ["nginx.conf", "nginx.kaneo.conf"]) {
"-eu",
"-c",
`
-nginx -t -c /usr/share/kaneo/html/nginx.conf
-nginx -c /usr/share/kaneo/html/nginx.conf
-trap 'nginx -s quit -c /usr/share/kaneo/html/nginx.conf' EXIT
+nginx -t -c /usr/share/nginx/html/nginx.conf
+nginx -c /usr/share/nginx/html/nginx.conf
+trap 'nginx -s quit -c /usr/share/nginx/html/nginx.conf' EXIT
for path in assets/app.js.map assets/app.JS.MAP assets/app.js%2emap; do
if wget -S -O /tmp/map-body "http://127.0.0.1:5173/$path" 2>/tmp/map-headers; then exit 1; fi
grep -q '404 Not Found' /tmp/map-headers
if grep -q private-source-marker /tmp/map-body; then exit 1; fi
done
-wget -qO /usr/share/kaneo/html/js-response http://127.0.0.1:5173/assets/app.js
-wget -qO /usr/share/kaneo/html/page-response http://127.0.0.1:5173/dashboard
+wget -qO /usr/share/nginx/html/js-response http://127.0.0.1:5173/assets/app.js
+wget -qO /usr/share/nginx/html/page-response http://127.0.0.1:5173/dashboard
`,
],
{ encoding: "utf8", timeout: 30_000 },
diff --git a/scripts/security/web-runtime-env.test.mjs b/scripts/security/web-runtime-env.test.mjs
index 4cd895937..bce54f2f6 100644
--- a/scripts/security/web-runtime-env.test.mjs
+++ b/scripts/security/web-runtime-env.test.mjs
@@ -66,12 +66,6 @@ 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 still use the old web root.
- const legacy = resolve(fixture, "legacy.conf");
- writeFileSync(
- legacy,
- "server { listen 5175; root /usr/share/nginx/html; }\n",
- );
for (const file of [
"nginx.conf",
"nginx.main.conf",
@@ -134,8 +128,6 @@ 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/conf.d/legacy.conf,readonly`,
"--env",
"KANEO_API_URL=https://api.example.test/api",
runtimeImage,
@@ -145,8 +137,7 @@ test("production runtime serves configuration with default and restricted users"
[
`test "$(id -u)" = ${scenario.uid}`,
"test ! -d /var/lib/kaneo/html",
- "test -L /usr/share/nginx/html",
- 'test "$(cat /usr/share/kaneo/html/root.js)" = \'"KANEO_API_URL"\'',
+ 'test "$(cat /usr/share/nginx/html/root.js)" = \'"KANEO_API_URL"\'',
"/docker-entrypoint.sh nginx -t",
"test -f /var/lib/kaneo/nginx/conf.d/default.conf",
"test -f /var/lib/kaneo/nginx/conf.d/runtime.conf",
@@ -159,7 +150,6 @@ test("production runtime serves configuration with default and restricted users"
"nginx > /var/lib/kaneo/tmp/nginx-output.log 2>&1",
'test "$(wget -qO- http://127.0.0.1:5173/)" = "runtime fixture"',
'test "$(wget -qO- http://127.0.0.1:5174/)" = "https://hook.example.test"',
- 'test "$(wget -qO- http://127.0.0.1:5175/root.js)" = \'"https://api.example.test/api"\'',
"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",
@@ -213,7 +203,7 @@ for (const scenario of scenarios) {
"--user=1001:1001",
"--read-only",
"--mount",
- `type=bind,source=${resolve(fixture, "dist")},target=/usr/share/kaneo/html,readonly`,
+ `type=bind,source=${resolve(fixture, "dist")},target=/usr/share/nginx/html,readonly`,
"--mount",
`type=bind,source=${resolve(fixture, "runtime")},target=/var/lib/kaneo`,
"--mount",