feat(2.0): Phase 0 — Greenfield-Skeleton (FastAPI + React/shadcn)
Backend: FastAPI mit /api/health + /api/models (read-only aus llama-swap config, Logik aus v1 portiert). Frontend: Vite + React + Tailwind v4 + shadcn-Style App-Shell mit Cmd+K, Dark-default, PWA-Manifest; Modelle-View live aus /api/models. Deploy-Geruest (systemd-Unit :9001, build/deploy- Skripte, NOPASSWD-sudoers, kein Klartext-Passwort). Verifiziert: Backend-Endpunkte + Frontend-Build + gerenderte Shell. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
#!/usr/bin/env bash
|
||||
# Frontend bauen (vor jedem Deploy auf dem Entwickler-PC). Output → frontend/dist,
|
||||
# das committet wird (kein Node-Build auf der Box).
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/../frontend"
|
||||
npm ci
|
||||
npm run build
|
||||
echo "OK — frontend/dist gebaut."
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
# Deploy AUF DER BOX: git pull (Source) → venv-Sync → rsync nach /opt → Restart.
|
||||
# Läuft als User hitonabi. KEIN eingebettetes Passwort — der Restart nutzt die
|
||||
# NOPASSWD-sudoers-Whitelist (nur `systemctl restart mission-control-2`).
|
||||
#
|
||||
# Voraussetzungen (einmalig):
|
||||
# - Gitea-Repo angelegt + hier geklont nach ~/mission-control-2
|
||||
# - sudoers: hitonabi ALL=(root) NOPASSWD: /usr/bin/systemctl restart mission-control-2
|
||||
# - systemd-Unit installiert (siehe mission-control-2.service)
|
||||
set -euo pipefail
|
||||
|
||||
SRC="${MC2_SRC:-$HOME/mission-control-2}"
|
||||
PROD="${MC2_PROD:-/opt/mission-control-2}"
|
||||
|
||||
cd "$SRC"
|
||||
git fetch -q origin
|
||||
git reset -q --hard origin/main
|
||||
|
||||
# Backend-venv auf der Box sicherstellen + Abhängigkeiten aktuell halten.
|
||||
if [ ! -d "$SRC/backend/.venv" ]; then
|
||||
python3 -m venv "$SRC/backend/.venv"
|
||||
fi
|
||||
"$SRC/backend/.venv/bin/python" -m pip install -q -r "$SRC/backend/requirements.txt"
|
||||
|
||||
# Nach /opt spiegeln (Frontend-dist kommt aus dem Repo mit).
|
||||
sudo rsync -a --delete \
|
||||
--exclude '.git' --exclude 'node_modules' \
|
||||
"$SRC/" "$PROD/"
|
||||
|
||||
# venv separat syncen (rsync oben schließt sie nicht aus, aber Pfade im venv sind
|
||||
# absolut — daher venv direkt im PROD neu aufbauen, robust):
|
||||
if [ ! -d "$PROD/backend/.venv" ]; then
|
||||
sudo python3 -m venv "$PROD/backend/.venv"
|
||||
fi
|
||||
sudo "$PROD/backend/.venv/bin/python" -m pip install -q -r "$PROD/backend/requirements.txt"
|
||||
|
||||
sudo systemctl restart mission-control-2
|
||||
echo "OK — Mission Control 2.0 neu gestartet (:9001)."
|
||||
@@ -0,0 +1,23 @@
|
||||
# systemd-Unit für Mission Control 2.0 (läuft PARALLEL zu v1 auf eigenem Port 9001).
|
||||
# Ablage: ~/.config/systemd/user/ (user-Dienst) ODER /etc/systemd/system/ (system, User=hitonabi).
|
||||
# Aktivieren: systemctl --user enable --now mission-control-2 (bzw. system-weit)
|
||||
|
||||
[Unit]
|
||||
Description=Mission Control 2.0 (Cockpit)
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory=/opt/mission-control-2/backend
|
||||
ExecStart=/opt/mission-control-2/backend/.venv/bin/python -m uvicorn app:app --host 0.0.0.0 --port 9001
|
||||
Environment=MC_PORT=9001
|
||||
Environment=MC_LLAMA_SWAP_URL=http://127.0.0.1:8080
|
||||
Environment=MC_CONFIG_PATH=/etc/llama-swap/config.yaml
|
||||
Environment=MC_MODELS_DIR=/srv/models
|
||||
Environment=MC_GATEWAY_URL=http://127.0.0.1:4000
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
Reference in New Issue
Block a user