Document non-root container, shared login, and data folder permission fix
- PORTAINER_DEPLOY.md: add the chown step needed after the container switched to a non-root user, and note EACCES as the symptom if skipped. - Update CHANGELOG for the shared login, non-root Dockerfile, and cap_drop/no-new-privileges hardening.
This commit is contained in:
@@ -2,6 +2,13 @@
|
||||
|
||||
All notable changes to this project are logged here, newest first. This file starts from the point the toolkit was handed off and set up in this repo.
|
||||
|
||||
## 2026-09-29 (2)
|
||||
|
||||
- Added: shared login turned on now that the toolkit is reachable at `MVP.controls.dev`. Username `PrimeMVP`, password generated and set in `.env`/Portainer (not committed; `.env` is gitignored). This is a stopgap ahead of real per-user `APP_USERS` accounts.
|
||||
- Hardened: `Dockerfile` now runs the container as the built-in non-root `node` user instead of root, since the app is reachable from the public internet.
|
||||
- Hardened: `docker-compose.yml` drops all Linux capabilities (`cap_drop: [ALL]`) and disables privilege escalation (`security_opt: no-new-privileges:true`) on the container.
|
||||
- Known follow-up: the `./data` folder on the Docker host was created while the container ran as root. After redeploying, it needs `chown -R 1000:1000 ./data` (or similarly permissive) on the host, or the token quota file and sign-in audit log will silently fail to write under the new non-root user.
|
||||
|
||||
## 2026-09-29
|
||||
|
||||
- Fixed: the AI draft button returned a 502 ("Could not reach the Anthropic API") once the container moved onto the `proxy` network. Cause: Compose only attaches a container to networks explicitly listed for it, so joining `proxy` alone dropped the container from the network that had internet access. `proxy` reaches other containers but not the public internet. `docker-compose.yml` now lists both `proxy` and `default`, so the container keeps its internet route for the outbound call to `api.anthropic.com` while staying reachable from Nginx Proxy Manager by name.
|
||||
|
||||
@@ -7,6 +7,13 @@ COPY server.js ./
|
||||
COPY tools ./tools
|
||||
COPY skills ./skills
|
||||
|
||||
# Run as the "node" user baked into this image, not root. /app/data is
|
||||
# where the token quota file and sign-in audit log get written (mounted
|
||||
# as a volume in docker-compose.yml), so it needs to be writable by that
|
||||
# user before the switch.
|
||||
RUN mkdir -p /app/data && chown -R node:node /app
|
||||
USER node
|
||||
|
||||
ENV PORT=5173
|
||||
EXPOSE 5173
|
||||
|
||||
|
||||
@@ -40,16 +40,22 @@ Portainer passes these to Compose as substitution values for the `${VARIABLE_NAM
|
||||
|
||||
1. Click **Deploy the stack**.
|
||||
2. Wait for the build to finish. The image is small; the app has no external dependencies to install.
|
||||
3. The container now runs as a non-root user (`node`, uid 1000) inside the image, not root. If the `./data` folder on this host already exists from an earlier deploy, it may still be owned by root from when the container ran as root. Fix it once with:
|
||||
```
|
||||
sudo chown -R 1000:1000 ./data
|
||||
```
|
||||
Run this in the stack's folder on the Docker host (wherever Portainer keeps it for this stack). Skip this if `./data` doesn't exist yet; the container creates it correctly on first run.
|
||||
|
||||
## Step 4: Verify
|
||||
|
||||
1. Go to **Containers**, find `sde-meeting-toolkit`, and open **Logs**.
|
||||
2. Confirm the log reports:
|
||||
- `ANTHROPIC_API_KEY loaded: AI draft button is live.`
|
||||
- Either `Login required: N named user(s) configured.` or `No login required: ...`, matching what you set in `APP_USERS`.
|
||||
- Either `Login required: N named user(s) configured.` or `No login required: ...`, matching what you set in `APP_USERS` or `APP_USERNAME`/`APP_PASSWORD`.
|
||||
- `No per-user token quota: TOKEN_LIMIT_PER_USER is unset or 0 (unlimited, feature on the back burner).`
|
||||
- No `EACCES` or `permission denied` lines. If you see these, the `chown` step above was skipped or didn't take.
|
||||
3. Open the container's mapped address in a browser (port `5173` by default, per `docker-compose.yml`). Confirm the toolkit's landing page loads.
|
||||
4. If you set `APP_USERS`, confirm the browser asks for a login before the page loads.
|
||||
4. If you set `APP_USERS` or `APP_USERNAME`/`APP_PASSWORD`, confirm the browser asks for a login before the page loads.
|
||||
5. Try the AI draft button on the Field Problem Workshop tool and confirm it returns a real draft.
|
||||
|
||||
## Redeploying after a code change
|
||||
|
||||
@@ -41,6 +41,14 @@ services:
|
||||
networks:
|
||||
- proxy
|
||||
- default
|
||||
# Hardening for a container that's reachable from the public internet
|
||||
# (through Nginx Proxy Manager) and can itself reach the public internet
|
||||
# (api.anthropic.com). Neither of these needs any Linux capability the
|
||||
# app doesn't already have, and the app never needs to escalate privilege.
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
|
||||
networks:
|
||||
proxy:
|
||||
|
||||
Reference in New Issue
Block a user