diff --git a/CLAUDE.md b/CLAUDE.md index 2052bc2..b20e5ba 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -54,15 +54,26 @@ User ist **`hitonabi`** (klein!). `sudo` braucht generell ein Passwort — **au **Self-Update statt manuellem Deploy:** Der Button „Mission Control aktualisieren" (`POST /api/self-update`) macht `git pull` (Source) → rsync → `systemctl restart` — der dokumentierte manuelle Weg unten ist nur noch Fallback/Erstinstallation. +**Frontend-Build (Vite + Svelte 5, ab Phase C):** +```bash +cd frontend && npm install # einmalig +npm run build # vor jedem git push — Output: static/dist/main.js +``` +Das Build-Ergebnis (`static/dist/`) wird committet → kein Build-Schritt auf dem Server. +Beim Entwickeln: `npm run dev` in `frontend/` startet den Vite Dev-Server (Port 5173) für HMR. +Neue Svelte-Panels kommen in `frontend/src/panels/`. Sobald ein Panel migriert ist, +wird es in `frontend/src/main.ts` importiert und das alte `static/js/panels/.js` nicht mehr gebraucht. + **Deploy-Kette (Windows → Gitea → Bosgame):** -1. Lokal bauen + Smoke-Test → `git push` (origin = Gitea `http://192.168.178.153:3000/Hitonabi/mission-control.git`). -2. Bosgame: `cd ~/mission-control && git pull --ff-only` (Source-Repo). -3. Nach `/opt` ausrollen — **ohne sudo** (`hitonabi` besitzt `/opt/mission-control`), `.venv` ausnehmen: +1. Frontend bauen: `cd frontend && npm run build` → `static/dist/main.js` aktualisiert. +2. Lokal Smoke-Test → `git push` (origin = Gitea `http://192.168.178.153:3000/Hitonabi/mission-control.git`). +3. Bosgame: `cd ~/mission-control && git pull --ff-only` (Source-Repo). +4. Nach `/opt` ausrollen — **ohne sudo**, `node_modules` ausnehmen: ```bash - rsync -a --exclude='.git' --exclude='.venv' --exclude='__pycache__' --exclude='*.pyc' ~/mission-control/ /opt/mission-control/ + rsync -a --exclude='.git' --exclude='.venv' --exclude='__pycache__' --exclude='*.pyc' --exclude='frontend/node_modules' ~/mission-control/ /opt/mission-control/ ``` -4. `sudo systemctl restart mission-control` (Passwort nötig). Prod = `:9000`, Dev-Spielwiese = `:9001`. -5. **Niemals direkt in `/opt` arbeiten.** Logs: `journalctl -u mission-control -f`. +5. `sudo systemctl restart mission-control` (Passwort nötig). Prod = `:9000`, Dev-Spielwiese = `:9001`. +6. **Niemals direkt in `/opt` arbeiten.** Logs: `journalctl -u mission-control -f`. Statische Dateien werden je Request frisch von Platte gelesen → UI-Änderungen wirken schon nach rsync; **Python-Code-Änderungen brauchen den Restart**. diff --git a/routers/maintenance.py b/routers/maintenance.py index f8b37e0..30fcdd8 100644 --- a/routers/maintenance.py +++ b/routers/maintenance.py @@ -38,6 +38,7 @@ def self_update(): cmd = ( f"cd {shlex.quote(SOURCE_DIR)} && git pull --ff-only && " f"rsync -a --exclude=.git --exclude=.venv --exclude=__pycache__ --exclude='*.pyc' " + f"--exclude='frontend/node_modules' " f"{shlex.quote(SOURCE_DIR)}/ {shlex.quote(PROD_DIR)}/ && " f"sudo systemctl restart mission-control" )