From be756e33bfd807b0d3d2e9f0bd67d2d41b68c92f Mon Sep 17 00:00:00 2001 From: Claus Lohmar Date: Tue, 21 Jul 2026 15:01:02 +0000 Subject: [PATCH] chore: add install.sh for backend systemd setup --- backend/install.sh | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 backend/install.sh diff --git a/backend/install.sh b/backend/install.sh new file mode 100755 index 0000000..d3ea400 --- /dev/null +++ b/backend/install.sh @@ -0,0 +1,56 @@ +#!/bin/bash +set -e + +# VM Bench Backend — Installer for Proxmox host (srv2) +# Run: bash /mnt/converter/backend/install.sh + +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +SERVICE_NAME="vm-bench-backend" +SERVICE_FILE="${SCRIPT_DIR}/${SERVICE_NAME}.service" +SYSTEMD_DIR="/etc/systemd/system" + +echo "=== VM Bench Backend Installer ===" +echo "" + +# 1. Install Python dependencies +echo "[1/4] Installing Python dependencies..." +cd "$SCRIPT_DIR" +python3 -m pip install --break-system-packages -r requirements.txt -q +echo " Dependencies installed." + +# 2. Copy systemd service file +echo "[2/4] Installing systemd service..." +if [ ! -f "$SERVICE_FILE" ]; then + echo " ERROR: ${SERVICE_FILE} not found." + exit 1 +fi +cp "$SERVICE_FILE" "$SYSTEMD_DIR/${SERVICE_NAME}.service" +echo " Service file copied to ${SYSTEMD_DIR}/" + +# 3. Reload systemd and enable +echo "[3/4] Enabling service..." +systemctl daemon-reload +systemctl enable "$SERVICE_NAME" +echo " Service enabled (auto-start on boot)." + +# 4. Start the service +echo "[4/4] Starting service..." +systemctl restart "$SERVICE_NAME" +sleep 2 + +# Verify +if systemctl is-active --quiet "$SERVICE_NAME"; then + echo "" + echo " Backend is RUNNING on port 9000" + echo "" + echo " Check: curl http://127.0.0.1:9000/health" + echo " Logs: journalctl -u ${SERVICE_NAME} -f" +else + echo "" + echo " WARNING: Service did not start. Check logs:" + echo " journalctl -u ${SERVICE_NAME} -n 30" + exit 1 +fi + +echo "" +echo "=== Done ==="