#!/usr/bin/env bash # Deploy AUF DER BOX als systemd-USER-Dienst — KEIN sudo, KEIN /opt, KEIN Passwort. # Erstinstallation + Updates in einem. Läuft als User hitonabi. # # Erstinstallation (einmalig): # git clone https://git.tobisniceshomelab.ddnsfree.com/Hitonabi/mission-control-v2 ~/mission-control-v2 # bash ~/mission-control-v2/deploy/deploy.sh set -euo pipefail SRC="${MC2_SRC:-$HOME/mission-control-v2}" cd "$SRC" git fetch -q origin && git reset -q --hard origin/main # venv + Abhängigkeiten if [ ! -d "$SRC/backend/.venv" ]; then python3 -m venv "$SRC/backend/.venv" fi "$SRC/backend/.venv/bin/python" -m pip install -q --upgrade pip "$SRC/backend/.venv/bin/python" -m pip install -q -r "$SRC/backend/requirements.txt" # systemd-USER-Units installieren/aktualisieren mkdir -p "$HOME/.config/systemd/user" cp "$SRC/deploy/mission-control-2.service" "$HOME/.config/systemd/user/mission-control-2.service" # Hermes-Terminal (ttyd -> `hermes chat`), in MC2 als Terminal-Seite eingebettet. # Einmalig manuell noetig: `sudo apt install -y ttyd` + `sudo systemctl disable --now ttyd` (apt-Default-Dienst). cp "$SRC/deploy/hermes-terminal.service" "$HOME/.config/systemd/user/hermes-terminal.service" systemctl --user daemon-reload systemctl --user enable mission-control-2 >/dev/null 2>&1 || true systemctl --user enable hermes-terminal >/dev/null 2>&1 || true loginctl enable-linger "$USER" >/dev/null 2>&1 || true systemctl --user restart mission-control-2 command -v ttyd >/dev/null 2>&1 && systemctl --user restart hermes-terminal 2>/dev/null || true sleep 2 echo "--- Health ---" curl -sf http://127.0.0.1:9001/api/health && echo echo "OK — Mission Control 2.0 läuft auf :9001 (User-Dienst, sudo-frei)."