Files
OPENBUREAU/proxmox/install.sh
T
karim b67b24a53c proxmox: Selbsthosting-Set (Dialog-Suite + Einzelskripte) + 2 Artikel
Geführter Installer proxmox/install.sh: erst Vorhaben wählen
(Komplettes Büro / 365+Synology ersetzen / nur Website / einzeln),
dann werden die nötigen LXCs der Reihe nach gebaut. Jeder Dienst ist
auch als eigenständiges, einzeln curlbares Skript verfügbar:

- proxmox/nextcloud-lxc.sh    Nextcloud AIO (ersetzt 365/Synology)
- proxmox/empty-lxc.sh        leerer Docker-LXC als Geruest
- proxmox/git-compose-lxc.sh  beliebiges Git-Repo (RAPPORT/DOSSIER)
- (OPENBUREAU: bestehendes cms/proxmox/create-openbureau-lxc.sh)

Gemeinsames Muster: unprivilegierter Debian-12-LXC mit nesting+keyctl,
Docker via get.docker.com, Dienst als Container/Compose. proxmox/README.md
dokumentiert beide Wege.

Dazu zwei Bibliotheksbeitraege (Hochparterre-Ton):
- server-im-eigenen-haus.md  — das Warum/Ziel
- proxmox-schritt-fuer-schritt.md — die Anleitung mit curl-Befehlen

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 01:20:43 +02:00

134 lines
5.5 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# OPENBUREAU-Suite — der Dialog-Installer für das Selbsthosting-Set auf Proxmox.
#
# Fragt im Dialog, welche Dienste man will, und installiert dann einen LXC nach
# dem anderen — jeder über sein eigenes, eigenständiges Skript (proxmox/*-lxc.sh).
# Fortgeschrittene können diese Einzelskripte auch direkt curlen, ohne die Suite.
#
# AUF DEM PROXMOX-HOST (nicht im Container), als root:
# bash <(curl -fsSL https://git.kgva.ch/karim/OPENBUREAU/raw/branch/main/proxmox/install.sh)
#
# Direkt, ohne Dialog:
# … install.sh openbureau
# … install.sh nextcloud [disk_gb] [ram_mb]
# … install.sh empty [name] [disk_gb] [ram_mb]
# … install.sh git <repo-url> [name] [disk_gb] [ram_mb]
#
set -euo pipefail
RAW="https://git.kgva.ch/karim/OPENBUREAU/raw/branch/main"
say() { echo -e "\n\033[1;36m▸ $*\033[0m"; }
die() { echo -e "\033[1;31m✗ $*\033[0m" >&2; exit 1; }
[ "$(id -u)" -eq 0 ] || die "Bitte als root auf dem Proxmox-Host ausführen."
command -v pct >/dev/null || die "pct nicht gefunden — läuft das wirklich auf Proxmox VE?"
# Jeder Dienst = ein eigenständiges Skript. Die Suite ruft sie nur auf.
run_service() {
local svc="$1"; shift || true
case "$svc" in
openbureau) say "OPENBUREAU — Website + CMS…"; bash <(curl -fsSL "$RAW/cms/proxmox/create-openbureau-lxc.sh") ;;
nextcloud) say "Nextcloud…"; bash <(curl -fsSL "$RAW/proxmox/nextcloud-lxc.sh") "$@" ;;
empty) say "Leerer Docker-LXC…"; bash <(curl -fsSL "$RAW/proxmox/empty-lxc.sh") "$@" ;;
git) say "Git-Compose-Dienst…"; bash <(curl -fsSL "$RAW/proxmox/git-compose-lxc.sh") "$@" ;;
*) die "Unbekannter Dienst: $svc" ;;
esac
}
# ---------------------------------------------------------------------------
# Stufe 1: Vorhaben. schlüssel | Beschreibung | Liste der Dienste
# (Sonderfall "custom" → Einzelauswahl, siehe service_checklist.)
PROFILES=(
"buero|Komplettes Büro einrichten — Website/CMS + Nextcloud|openbureau nextcloud"
"cloud|Office 365 + Synology ersetzen — nur Nextcloud|nextcloud"
"web|Nur die öffentliche Website + CMS|openbureau"
"custom|Einzeln auswählen … (für Fortgeschrittene)|custom"
)
# Stufe 2 (custom): einzelne Dienste. schlüssel | Beschreibung
SERVICES=(
"openbureau|OPENBUREAU — Website + CMS (Hugo + Supabase)"
"nextcloud|Nextcloud — Dateien, Kalender, Kontakte, Office (ersetzt 365/Synology)"
"empty|Leerer Docker-LXC — Gerüst für eigene Dienste"
"git|Git-Compose-Dienst — eigenes Repo (z. B. RAPPORT / DOSSIER)"
)
# Holt für die interaktive Auswahl die Zusatzangaben (Repo-URL, Name) nach.
run_from_menu() {
case "$1" in
git)
local repo name
read -rp " Repo-URL (z. B. git.kgva.ch/karim/RAPPORT-SERVER.git): " repo
[ -n "$repo" ] || { echo " übersprungen (keine URL)."; return 0; }
read -rp " Name [auto]: " name
run_service git "$repo" "$name" ;;
empty)
local name
read -rp " Name des Containers [docker]: " name
run_service empty "${name:-docker}" ;;
*) run_service "$1" ;;
esac
}
# Stufe 2: Einzelauswahl der Dienste (Checkliste).
service_checklist() {
local choices=()
if command -v whiptail >/dev/null && [ -t 0 ]; then
local items=()
for s in "${SERVICES[@]}"; do items+=("${s%%|*}" "${s#*|}" OFF); done
local sel
sel="$(whiptail --title "OPENBUREAU — Dienste auswählen" \
--checklist "Mit der Leertaste auswählen, Enter bestätigt:" 20 78 ${#SERVICES[@]} \
"${items[@]}" 3>&1 1>&2 2>&3)" || { echo "Abgebrochen."; exit 0; }
eval "choices=($sel)" # whiptail liefert die Tags in Anführungszeichen
else
echo "Welche Dienste installieren? (Nummern mit Komma/Leerzeichen, Enter = nichts)"
local i=1
for s in "${SERVICES[@]}"; do printf " %d) %s\n" "$i" "${s#*|}"; i=$((i+1)); done
read -rp "Auswahl: " line
for n in ${line//,/ }; do
[ "$n" -ge 1 ] 2>/dev/null && [ "$n" -le "${#SERVICES[@]}" ] && choices+=("${SERVICES[$((n-1))]%%|*}")
done
fi
[ "${#choices[@]}" -gt 0 ] || { echo "Nichts ausgewählt."; exit 0; }
for c in "${choices[@]}"; do run_from_menu "$c"; done
}
# Stufe 1: Vorhaben wählen, dann das passende Bündel installieren.
choose_profile() {
local key=""
if command -v whiptail >/dev/null && [ -t 0 ]; then
local items=() first=ON
for p in "${PROFILES[@]}"; do items+=("${p%%|*}" "$(echo "$p" | cut -d'|' -f2)" "$first"); first=OFF; done
key="$(whiptail --title "OPENBUREAU — Was hast du vor?" \
--radiolist "Vorhaben wählen (Leertaste markiert, Enter bestätigt):" 20 78 ${#PROFILES[@]} \
"${items[@]}" 3>&1 1>&2 2>&3)" || { echo "Abgebrochen."; exit 0; }
else
echo "Was hast du vor? (eine Nummer)"
local i=1
for p in "${PROFILES[@]}"; do printf " %d) %s\n" "$i" "$(echo "$p" | cut -d'|' -f2)"; i=$((i+1)); done
read -rp "Auswahl [1]: " n; n="${n:-1}"
[ "$n" -ge 1 ] 2>/dev/null && [ "$n" -le "${#PROFILES[@]}" ] || die "Ungültige Auswahl."
key="${PROFILES[$((n-1))]%%|*}"
fi
if [ "$key" = "custom" ]; then
service_checklist
else
local svcs=""
for p in "${PROFILES[@]}"; do [ "${p%%|*}" = "$key" ] && svcs="${p##*|}"; done
say "Vorhaben '$key': installiere -> $svcs"
for s in $svcs; do run_service "$s"; done
fi
}
################################# Einstieg #################################
if [ "$#" -gt 0 ]; then
run_service "$@" # direkt, ohne Dialog
else
choose_profile # geführter Dialog: erst Vorhaben, dann Dienste
fi
say "Fertig. Alle ausgewählten Dienste sind durch."