From 6651d4331454b83d4d3968c00ae5c5575b3f2f4f Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Wed, 1 Jul 2026 00:53:09 +0200 Subject: [PATCH] feat: add systemd service unit and install script Co-Authored-By: Claude Sonnet 4.6 Claude-Session: https://claude.ai/code/session_01VsJfJngYUpB4dr77GvcEb8 --- deploy/brewpi.service | 14 ++++++++++++++ deploy/install.sh | 12 ++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 deploy/brewpi.service create mode 100755 deploy/install.sh diff --git a/deploy/brewpi.service b/deploy/brewpi.service new file mode 100644 index 0000000..4f866f8 --- /dev/null +++ b/deploy/brewpi.service @@ -0,0 +1,14 @@ +[Unit] +Description=BrewPi temperature controller server +After=network.target + +[Service] +Type=simple +User=jens +WorkingDirectory=/home/jens/work/repos/brewpi +ExecStart=/home/jens/work/repos/brewpi/.venv/bin/python3 /home/jens/work/repos/brewpi/server/brewpi.py +Restart=on-failure +RestartSec=5 + +[Install] +WantedBy=multi-user.target \ No newline at end of file diff --git a/deploy/install.sh b/deploy/install.sh new file mode 100755 index 0000000..6cc6ace --- /dev/null +++ b/deploy/install.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +set -euo pipefail + +SERVICE=brewpi +UNIT_FILE="$(dirname "$(realpath "$0")")/${SERVICE}.service" +TARGET=/etc/systemd/system/${SERVICE}.service + +sudo cp "$UNIT_FILE" "$TARGET" +sudo systemctl daemon-reload +sudo systemctl enable "$SERVICE" +echo "Installed. Start with: sudo systemctl start $SERVICE" +echo "View logs with: journalctl -u $SERVICE -f"