docs: Deployment mit persistentem Volume und Basic-Auth

Update-Prozedur in CLAUDE.md auf volume-aware docker run umgestellt
(-v dienstplan-data:/data, -e DATA_DIR=/data) und Dockerfile-Snippet
auf den neuen Express/SQLite-Server aktualisiert. Hinweis ergaenzt,
dass DB und Backups auf dem Volume liegen und die Domain hinter Caddy
Basic-Auth steht.

Zusaetzlich .dockerignore ergaenzt: node_modules aus dem Host-Kontext
wurde sonst per COPY . . ins Image kopiert und ueberschrieb das im
Image gebaute better-sqlite3-Binary (invalid ELF header beim Start).
Ohne diesen Fix startet der Container nicht.
This commit is contained in:
Kenearos 2026-07-07 16:10:51 +02:00
parent 67a3f4b546
commit 49a3803aa7
2 changed files with 26 additions and 6 deletions

5
.dockerignore Normal file
View file

@ -0,0 +1,5 @@
node_modules
.git
.planning
.superpowers
docs/superpowers

View file

@ -194,22 +194,36 @@ docker run -p 3000:3000 -e PORT=3000 dienstplan-pro
**Container:** `dienstplan-pro` on the `matrix_default` Docker network so the
`matrix-caddy-1` reverse proxy can resolve it by hostname.
The Dockerfile uses `serve` from npm to serve static files:
The Dockerfile runs an Express server (`server/index.js`) that serves the
static frontend **and** the `/api/state` persistence API, backed by SQLite:
```dockerfile
FROM node:20-alpine
RUN npm install -g serve
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm install --omit=dev
COPY . .
CMD serve -s . -l tcp://0.0.0.0:${PORT:-3000}
ENV PORT=3000
ENV DATA_DIR=/data
EXPOSE 3000
CMD ["node", "server/index.js"]
```
Caddy block in `/opt/matrix/Caddyfile`:
Caddy block in `/opt/matrix/Caddyfile` (app + `/api/*` behind Basic-Auth):
```
bonus.pixel-by-design.de {
basic_auth {
benad <BCRYPT_HASH>
}
reverse_proxy dienstplan-pro:3000
}
```
> **Wichtig:** Die SQLite-DB und die täglichen Backups liegen auf dem
> benannten Docker-Volume `dienstplan-data` (`/data` im Container, Backups
> unter `/data/backups/`). Niemals ohne dieses Volume deployen — sonst
> löscht `docker rm` beim nächsten Update alle Daten unwiderruflich. Die
> Domain ist komplett hinter Caddy Basic-Auth (gilt auch für `/api/*`).
**Update procedure** (when pushing new code):
```bash
ssh root@65.21.60.83
@ -218,7 +232,8 @@ git pull
docker build -t dienstplan-pro:latest .
docker stop dienstplan-pro && docker rm dienstplan-pro
docker run -d --name dienstplan-pro --network matrix_default \
--restart unless-stopped -e PORT=3000 dienstplan-pro:latest
--restart unless-stopped -e PORT=3000 -e DATA_DIR=/data \
-v dienstplan-data:/data dienstplan-pro:latest
```
Caddy reloads not needed unless the Caddyfile changes.