From ab7d506eeabf7d69a0527b603b4dc6e80f69c88c Mon Sep 17 00:00:00 2001 From: Pascal Scholz Date: Mon, 21 Sep 2026 21:46:54 +0200 Subject: [PATCH] Fix B2 in deploy guide: generate admin credentials via Docker, not host npm The deploy host only has Docker installed, not Node/npm directly, so the original `npm install` / `node hash-password.js` steps failed with "command not found". Both the bcrypt hash and session secret are now generated with a throwaway `node:22-alpine` container instead. --- DEPLOYMENT_ADMIN.md | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/DEPLOYMENT_ADMIN.md b/DEPLOYMENT_ADMIN.md index 94f43b0..9e1215a 100644 --- a/DEPLOYMENT_ADMIN.md +++ b/DEPLOYMENT_ADMIN.md @@ -73,17 +73,20 @@ git pull ``` ### B2. Login-Zugangsdaten erzeugen +Der Server selbst braucht dafür kein Node/npm installiert zu haben – das läuft in einem +kurzlebigen Docker-Container (Node steckt nur in den Containern, nicht auf dem Host): ```bash -cd ~/sites/larpaso-website/admin -npm install # einmalig, installiert die Admin-Abhängigkeiten -node hash-password.js "dein-neues-passwort" +docker run --rm -e PW='dein-neues-passwort' node:22-alpine sh -c \ + "npm install --no-save bcryptjs >/dev/null 2>&1 && \ + node -e \"console.log(require('bcryptjs').hashSync(process.env.PW, 12))\"" ``` Gibt einen bcrypt-Hash aus (beginnt mit `$2a$` oder `$2b$`) – merken/kopieren. Zufälliges Session-Secret erzeugen: ```bash -node -e "console.log(require('crypto').randomBytes(32).toString('hex'))" +docker run --rm node:22-alpine node -e "console.log(require('crypto').randomBytes(32).toString('hex'))" ``` -Auch kopieren. +Auch kopieren. (Beide Befehle laden einmalig das `node:22-alpine`-Image, das ohnehin für +den Website-Build gebraucht wird – geht beim zweiten Mal deutlich schneller.) ### B3. `~/stack/admin.env` anlegen (NICHT ins Git-Repo!) ```bash