v3: Mission Control Self-Update + Guides-Copy + Button-Audit
- Neuer Self-Update-Button ("Mission Control aktualisieren"): POST /api/self-update
macht git pull (Quelle) -> rsync nach Prod -> systemctl restart (NOPASSWD).
Pfade aus config.py (SOURCE_DIR/PROD_DIR), nicht user-hartkodiert.
- "LLM-Engine aktualisieren" ehrlich (war MC, ist llama.cpp via MC_UPDATE_CMD).
- Guides: Kopier-Buttons fuer alle Configs + Codeblock (Copy-Paste-tauglich).
- Button-Audit: Funktionen/Labels in allen Panels geprueft, stimmig.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+18
-2
@@ -14,7 +14,7 @@ from fastapi import APIRouter, Depends, HTTPException, WebSocket, WebSocketDisco
|
||||
from pydantic import BaseModel
|
||||
|
||||
from auth import auth
|
||||
from config import UPDATE_CMD
|
||||
from config import UPDATE_CMD, SOURCE_DIR, PROD_DIR
|
||||
from jobengine import start_job
|
||||
|
||||
router = APIRouter(prefix="/api", dependencies=[Depends(auth)])
|
||||
@@ -24,9 +24,25 @@ class PwdReq(BaseModel):
|
||||
|
||||
@router.post("/update")
|
||||
def update():
|
||||
"""LLM-Engine (llama.cpp) aktualisieren — Befehl aus MC_UPDATE_CMD."""
|
||||
if not UPDATE_CMD:
|
||||
raise HTTPException(400, "Kein Update-Befehl gesetzt (MC_UPDATE_CMD).")
|
||||
job_id = start_job(shlex.split(UPDATE_CMD), "update containers")
|
||||
job_id = start_job(shlex.split(UPDATE_CMD), "llama.cpp-Update")
|
||||
return {"job_id": job_id}
|
||||
|
||||
@router.post("/self-update")
|
||||
def self_update():
|
||||
"""Mission Control selbst aktualisieren: Quelle pullen -> nach Prod rsyncen -> Dienst neu starten.
|
||||
git pull liest aus Gitea; der Restart laeuft ueber die NOPASSWD-sudoers-Whitelist. Die einzelnen
|
||||
Schritte sind mit && verkettet -> bei einem Fehler (z.B. Gitea offline) bricht es sauber ab."""
|
||||
cmd = (
|
||||
f"cd {shlex.quote(SOURCE_DIR)} && git pull --ff-only && "
|
||||
f"rsync -a --exclude=.git --exclude=.venv --exclude=__pycache__ --exclude='*.pyc' "
|
||||
f"{shlex.quote(SOURCE_DIR)}/ {shlex.quote(PROD_DIR)}/ && "
|
||||
f"sudo systemctl restart mission-control"
|
||||
)
|
||||
job_id = start_job(["bash", "-c", cmd], "Mission Control Update",
|
||||
log_cmd="$ git pull && rsync -> /opt && systemctl restart mission-control")
|
||||
return {"job_id": job_id}
|
||||
|
||||
@router.post("/os-update")
|
||||
|
||||
Reference in New Issue
Block a user