From 0d2e33f899f94e37fc5bba320c03879e91955305 Mon Sep 17 00:00:00 2001 From: Erik Thiele Date: Sun, 19 Jul 2026 20:33:14 +0200 Subject: [PATCH] Add update script for Proxmox LXC containers Adds scripts/proxmox/update-linkvault.sh to pull the latest git changes, refresh dependencies, and restart the systemd service on an existing container. Documents usage in the README. Co-Authored-By: Claude Sonnet 5 --- README.md | 20 +++++++++++++ scripts/proxmox/update-linkvault.sh | 46 +++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100755 scripts/proxmox/update-linkvault.sh diff --git a/README.md b/README.md index d10d755..d728bc6 100644 --- a/README.md +++ b/README.md @@ -153,6 +153,26 @@ pct exec -- systemctl status linkvault # Status prüfen pct exec -- journalctl -u linkvault -f # Logs verfolgen ``` +### Updaten + +Wenn sich im Git-Repo etwas geändert hat, den Container mit +`scripts/proxmox/update-linkvault.sh` auf den neuesten Stand bringen. Das +Script zieht per `git pull`, aktualisiert die Python-Abhängigkeiten und +startet den systemd-Service neu. Auf dem **Proxmox-Host** ausführen: + +```bash +CTID=113 bash <(curl -fsSL -H "Authorization: token ${GIT_TOKEN}" \ + https://gitea.teamthiele.de/ethiele/linkvault/raw/branch/main/scripts/proxmox/update-linkvault.sh) +``` + +(`GIT_TOKEN` nur nötig, falls das Repo privat ist – siehe oben.) + +Alternativ, falls das Repo bereits lokal ausgecheckt ist: + +```bash +CTID=113 bash scripts/proxmox/update-linkvault.sh +``` + ## Hinweise für den Produktivbetrieb - Einen zufälligen `SECRET_KEY` in `.env` setzen. diff --git a/scripts/proxmox/update-linkvault.sh b/scripts/proxmox/update-linkvault.sh new file mode 100755 index 0000000..243cefd --- /dev/null +++ b/scripts/proxmox/update-linkvault.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# +# LinkVault – Update-Script für einen bestehenden Proxmox-LXC-Container +# +# Muss als root auf dem Proxmox-VE-Host ausgeführt werden. Zieht den +# neuesten Stand aus Git, aktualisiert die Python-Abhängigkeiten und +# startet den systemd-Service neu. +# +# Verwendung (auf dem Proxmox-Host): +# CTID=113 bash update-linkvault.sh +# +# Bei privatem Repo zusätzlich das Gitea Access Token setzen: +# CTID=113 GIT_TOKEN= bash update-linkvault.sh +# +set -euo pipefail + +CTID="${CTID:-}" +GIT_TOKEN="${GIT_TOKEN:-}" + +if ! command -v pct &>/dev/null; then + echo "Fehler: 'pct' nicht gefunden – dieses Script muss auf einem Proxmox-VE-Host laufen." >&2 + exit 1 +fi + +if [ -z "$CTID" ]; then + echo "Fehler: CTID muss gesetzt sein, z.B. 'CTID=113 bash update-linkvault.sh'." >&2 + exit 1 +fi + +echo "==> Aktualisiere LinkVault in Container $CTID..." +pct exec "$CTID" -- bash -c " +set -euo pipefail +cd /opt/linkvault + +if [ -n '${GIT_TOKEN}' ]; then + git -c http.extraHeader=\"Authorization: token ${GIT_TOKEN}\" pull --ff-only +else + git pull --ff-only +fi + +.venv/bin/pip install -q -r requirements.txt +systemctl restart linkvault +" + +echo "==> Fertig. Status:" +pct exec "$CTID" -- systemctl --no-pager status linkvault