feat: users, roles and per-area permissions, production demo image
The controller checks every route against the signed-in user's role, with levels none, view, control and edit per area. Guests get the permissions of a built-in guest role. Auth stays off until the first user exists; LED_ADMIN_USER and LED_ADMIN_PASSWORD create the first admin. Sessions are cookies, passwords are PBKDF2-SHA256, and logins lock per username after five failures. The simulator's WebSocket checks the view permission at handshake and per frame; /ws needs devices control. The web UI gets a sign-in button, a sign-in prompt on refused changes, and a users and roles screen. Also: the device build gets the bridge include path and forward type it was missing, Dockerfile.sim runs non-root, and Dockerfile.prod with docker-compose.prod.yml runs the controller on an internal network behind Caddy for HTTPS. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
02440be55d
commit
f0615dc1b7
26 files changed
+2116
-23
No files matched your search
@@ -0,0 +1,59 @@
|
||||
# Demo deployment: the controller (no internet access) behind a Caddy proxy that serves HTTPS.
|
||||
# cp .env.prod.example .env and fill it in
|
||||
# docker compose -f docker-compose.prod.yml up -d --build
|
||||
name: led-demo
|
||||
|
||||
services:
|
||||
controller:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile.prod
|
||||
image: led-controller:prod
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
LED_ADMIN_USER: ${LED_ADMIN_USER:?required}
|
||||
LED_ADMIN_PASSWORD: ${LED_ADMIN_PASSWORD:?required}
|
||||
volumes:
|
||||
- controller-data:/data
|
||||
expose:
|
||||
- "8080"
|
||||
networks:
|
||||
- backend # internal only: the controller cannot reach the internet or the host's network
|
||||
read_only: true
|
||||
tmpfs:
|
||||
- /tmp
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
pids_limit: 256
|
||||
mem_limit: 512m
|
||||
|
||||
proxy:
|
||||
image: caddy:2-alpine
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
controller:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
DOMAIN: ${DOMAIN:?required}
|
||||
ports:
|
||||
- "${HTTP_PORT:-80}:80"
|
||||
- "${HTTPS_PORT:-443}:443"
|
||||
volumes:
|
||||
- ./deploy/Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
- caddy-data:/data
|
||||
- caddy-config:/config
|
||||
networks:
|
||||
- backend
|
||||
- public # Caddy needs the internet for public HTTPS certificates
|
||||
|
||||
networks:
|
||||
backend:
|
||||
internal: true
|
||||
public: {}
|
||||
|
||||
volumes:
|
||||
controller-data:
|
||||
caddy-data:
|
||||
caddy-config:
|
||||
Reference in new issue
Block a user