feat: Sync/Clone-Modus, Rotation, --setup Deployment, Scheduler-Fix, Dashboard-Updates, README
This commit is contained in:
+62
-3
@@ -11,9 +11,8 @@ class AppRunner:
|
||||
self.paths = AppPaths(base_dir=base_dir)
|
||||
self.entry_script = entry_script
|
||||
|
||||
def run(self) -> None:
|
||||
ConsoleUI.headline("StFV Backup Bootstrap")
|
||||
|
||||
def _bootstrap(self) -> None:
|
||||
"""Ensure venv and dependencies are ready (re-execs into venv if needed)."""
|
||||
venv = VirtualEnvManager(self.paths.venv_dir, self.entry_script)
|
||||
if not venv.in_virtualenv():
|
||||
ConsoleUI.info("Virtuelle Umgebung wird vorbereitet...")
|
||||
@@ -26,6 +25,66 @@ class AppRunner:
|
||||
else:
|
||||
ConsoleUI.info("Alle Abhaengigkeiten sind bereits installiert.")
|
||||
|
||||
def setup(self) -> None:
|
||||
ConsoleUI.headline("StFV Backup Setup")
|
||||
self._bootstrap()
|
||||
ConsoleUI.success("System ist bereit.")
|
||||
self._install_systemd_service()
|
||||
|
||||
def _install_systemd_service(self) -> None:
|
||||
import shutil
|
||||
import subprocess
|
||||
|
||||
if not shutil.which("systemctl"):
|
||||
ConsoleUI.warn("systemctl nicht gefunden – kein systemd-System erkannt.")
|
||||
ConsoleUI.info("Manuelle Installation: bash scripts/service.sh install")
|
||||
return
|
||||
|
||||
service_name = "nextcloud-backup.service"
|
||||
user_systemd_dir = Path.home() / ".config" / "systemd" / "user"
|
||||
user_systemd_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if self.paths.venv_dir.name == "nt":
|
||||
venv_python = self.paths.venv_dir / "Scripts" / "python.exe"
|
||||
else:
|
||||
venv_python = self.paths.venv_dir / "bin" / "python"
|
||||
|
||||
service_content = f"""[Unit]
|
||||
Description=StFV Backup Flask Service
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
WorkingDirectory={self.paths.base_dir}
|
||||
ExecStart={venv_python} {self.entry_script.resolve()}
|
||||
Restart=on-failure
|
||||
RestartSec=3
|
||||
Environment=PYTHONUNBUFFERED=1
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
"""
|
||||
|
||||
target = user_systemd_dir / service_name
|
||||
target.write_text(service_content)
|
||||
ConsoleUI.success(f"Service-Datei geschrieben: {target}")
|
||||
|
||||
try:
|
||||
subprocess.run(["systemctl", "--user", "daemon-reload"], check=True)
|
||||
ConsoleUI.success("systemd daemon neu geladen.")
|
||||
except subprocess.CalledProcessError as exc:
|
||||
ConsoleUI.warn(f"daemon-reload fehlgeschlagen: {exc}")
|
||||
|
||||
ConsoleUI.info(f"Service aktivieren: systemctl --user enable {service_name}")
|
||||
ConsoleUI.info(f"Service starten: systemctl --user start {service_name}")
|
||||
ConsoleUI.info(f"Status pruefen: systemctl --user status {service_name}")
|
||||
ConsoleUI.info(f"Logs verfolgen: journalctl --user -u {service_name} -f")
|
||||
|
||||
def run(self) -> None:
|
||||
ConsoleUI.headline("StFV Backup Bootstrap")
|
||||
self._bootstrap()
|
||||
|
||||
from app.config_store import ConfigStore
|
||||
from app.setup_wizard import SetupWizard
|
||||
from app.web_server import FlaskServer
|
||||
|
||||
Reference in New Issue
Block a user