Support private repo access via Gitea token in Proxmox script

The repo is private, so unauthenticated curl/git clone returns 404.
Add GIT_TOKEN support for both the raw-file download and the git
clone inside the container, and document it in the README.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Erik Thiele
2026-07-19 19:29:42 +02:00
parent 620f275595
commit a7c5866a24
2 changed files with 23 additions and 3 deletions

View File

@@ -69,12 +69,24 @@ Debian-12-Container an und richtet LinkVault darin als systemd-Service ein.
### Installation ### Installation
Das Repo ist **privat** für den Download des Scripts und für den `git clone`
innerhalb des Containers wird ein Gitea Access Token benötigt:
1. In Gitea: **Einstellungen → Anwendungen → Neuen Token erzeugen** (Scope
`read:repository` genügt).
2. Token als Umgebungsvariable `GIT_TOKEN` bereitstellen.
Auf dem **Proxmox-Host** (als root) ausführen: Auf dem **Proxmox-Host** (als root) ausführen:
```bash ```bash
bash <(curl -fsSL https://gitea.teamthiele.de/ethiele/linkvault/raw/branch/main/scripts/proxmox/install-linkvault.sh) export GIT_TOKEN=<dein-token>
bash <(curl -fsSL -H "Authorization: token ${GIT_TOKEN}" \
https://gitea.teamthiele.de/ethiele/linkvault/raw/branch/main/scripts/proxmox/install-linkvault.sh)
``` ```
`GIT_TOKEN` wird automatisch an das Script weitergereicht und auch beim
`git clone` innerhalb des LXC-Containers verwendet.
Alternativ, falls das Repo bereits lokal ausgecheckt ist: Alternativ, falls das Repo bereits lokal ausgecheckt ist:
```bash ```bash
@@ -113,12 +125,15 @@ Alle Einstellungen lassen sich per Umgebungsvariable vor dem Aufruf setzen
| `CT_PASSWORD` | root-Passwort des Containers | zufällig generiert | | `CT_PASSWORD` | root-Passwort des Containers | zufällig generiert |
| `REPO_URL` | Git-Repo, das geklont wird | `.../ethiele/linkvault.git` | | `REPO_URL` | Git-Repo, das geklont wird | `.../ethiele/linkvault.git` |
| `APP_PORT` | Port, auf dem uvicorn lauscht | `8000` | | `APP_PORT` | Port, auf dem uvicorn lauscht | `8000` |
| `GIT_TOKEN` | Gitea Access Token (privates Repo) | |
Beispiel mit statischer IP und fester Container-ID: Beispiel mit statischer IP und fester Container-ID:
```bash ```bash
export GIT_TOKEN=<dein-token>
CTID=150 CT_HOSTNAME=linkvault CT_IP=192.168.1.50/24 CT_GW=192.168.1.1 \ CTID=150 CT_HOSTNAME=linkvault CT_IP=192.168.1.50/24 CT_GW=192.168.1.1 \
bash <(curl -fsSL https://gitea.teamthiele.de/ethiele/linkvault/raw/branch/main/scripts/proxmox/install-linkvault.sh) bash <(curl -fsSL -H "Authorization: token ${GIT_TOKEN}" \
https://gitea.teamthiele.de/ethiele/linkvault/raw/branch/main/scripts/proxmox/install-linkvault.sh)
``` ```
### Nach der Installation ### Nach der Installation

View File

@@ -32,6 +32,7 @@ TEMPLATE_STORAGE="${TEMPLATE_STORAGE:-local}"
CT_PASSWORD="${CT_PASSWORD:-}" # leer = zufällig generiert CT_PASSWORD="${CT_PASSWORD:-}" # leer = zufällig generiert
REPO_URL="${REPO_URL:-https://gitea.teamthiele.de/ethiele/linkvault.git}" REPO_URL="${REPO_URL:-https://gitea.teamthiele.de/ethiele/linkvault.git}"
APP_PORT="${APP_PORT:-8000}" APP_PORT="${APP_PORT:-8000}"
GIT_TOKEN="${GIT_TOKEN:-}" # Gitea Access Token, falls Repo privat ist
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Vorbedingungen # Vorbedingungen
@@ -108,7 +109,11 @@ apt-get update -qq
apt-get install -y -qq git python3 python3-venv python3-pip build-essential curl >/dev/null apt-get install -y -qq git python3 python3-venv python3-pip build-essential curl >/dev/null
if [ ! -d /opt/linkvault ]; then if [ ! -d /opt/linkvault ]; then
git clone --quiet '${REPO_URL}' /opt/linkvault if [ -n '${GIT_TOKEN}' ]; then
git -c http.extraHeader=\"Authorization: token ${GIT_TOKEN}\" clone --quiet '${REPO_URL}' /opt/linkvault
else
git clone --quiet '${REPO_URL}' /opt/linkvault
fi
fi fi
cd /opt/linkvault cd /opt/linkvault