Umbenennung: Audiofy heißt jetzt Playwish
Name, Seitentitel, Dienste (playwish-web, playwish-controller), Dienst-Benutzer (playwish), Pfade (/opt/playwish, /usr/local/src/playwish), Vorlagen und Repository-Adresse. „Audiofy“ war bereits von mehreren Produkten belegt. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+9
-9
@@ -1,17 +1,17 @@
|
||||
#!/usr/bin/env bash
|
||||
# Audiofy – Installation per Einzeiler (holt das Repository und startet das passende Install-Skript):
|
||||
# Playwish – Installation per Einzeiler (holt das Repository und startet das passende Install-Skript):
|
||||
#
|
||||
# curl -fsSL https://git.wind8000.de/0/audiofy/raw/branch/main/install/get.sh | bash -s -- server
|
||||
# curl -fsSL https://git.wind8000.de/0/audiofy/raw/branch/main/install/get.sh | bash -s -- player
|
||||
# curl -fsSL https://git.wind8000.de/0/playwish/raw/branch/main/install/get.sh | bash -s -- server
|
||||
# curl -fsSL https://git.wind8000.de/0/playwish/raw/branch/main/install/get.sh | bash -s -- player
|
||||
# … | bash -s -- server --update später aktualisieren (holt den neuesten Stand)
|
||||
#
|
||||
# Die Quellen liegen danach in /usr/local/src/audiofy. Andere Quelle/Zweig:
|
||||
# AUDIOFY_REPO=https://…/audiofy.git AUDIOFY_BRANCH=main
|
||||
# Die Quellen liegen danach in /usr/local/src/playwish. Andere Quelle/Zweig:
|
||||
# PLAYWISH_REPO=https://…/playwish.git PLAYWISH_BRANCH=main
|
||||
set -euo pipefail
|
||||
|
||||
REPO="${AUDIOFY_REPO:-https://git.wind8000.de/0/audiofy.git}"
|
||||
ZWEIG="${AUDIOFY_BRANCH:-main}"
|
||||
QUELLE="${AUDIOFY_SRC:-/usr/local/src/audiofy}"
|
||||
REPO="${PLAYWISH_REPO:-https://git.wind8000.de/0/playwish.git}"
|
||||
ZWEIG="${PLAYWISH_BRANCH:-main}"
|
||||
QUELLE="${PLAYWISH_SRC:-/usr/local/src/playwish}"
|
||||
|
||||
ROLLE="${1:-}"
|
||||
[ $# -gt 0 ] && shift
|
||||
@@ -25,7 +25,7 @@ if [ "$(id -u)" -eq 0 ]; then SUDO=""; else
|
||||
SUDO="sudo"
|
||||
fi
|
||||
|
||||
echo "==> Audiofy-Quellen holen ($REPO, Zweig $ZWEIG)"
|
||||
echo "==> Playwish-Quellen holen ($REPO, Zweig $ZWEIG)"
|
||||
if ! command -v git >/dev/null; then
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO env DEBIAN_FRONTEND=noninteractive apt-get install -y -qq git >/dev/null
|
||||
|
||||
+22
-22
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Audiofy – Installation der Rolle "Player": Spotify-Connect-Gerät (raspotify) und Controller.
|
||||
# Playwish – Installation der Rolle "Player": Spotify-Connect-Gerät (raspotify) und Controller.
|
||||
#
|
||||
# install/install-player.sh Neuinstallation (fragt alles Nötige ab)
|
||||
# install/install-player.sh --update nur Code, Python-Umgebung und Dienst aktualisieren
|
||||
@@ -20,23 +20,23 @@ for arg in "$@"; do
|
||||
esac
|
||||
done
|
||||
|
||||
KONFIG="$AUDIOFY_DIR/config"
|
||||
KONFIG="$PLAYWISH_DIR/config"
|
||||
ENV_DATEI="$KONFIG/.env"
|
||||
RASPOTIFY_CONF=/etc/raspotify/conf
|
||||
export AUDIOFY_DIR AUDIOFY_USER
|
||||
export PLAYWISH_DIR PLAYWISH_USER
|
||||
|
||||
schritt "Audiofy-Player: $([ $UPDATE = 1 ] && echo Update || echo Neuinstallation)"
|
||||
schritt "Playwish-Player: $([ $UPDATE = 1 ] && echo Update || echo Neuinstallation)"
|
||||
pruefe_system
|
||||
ARCH="$(dpkg --print-architecture)"
|
||||
case "$ARCH" in arm64|armhf|amd64) ;; *) abbruch "raspotify gibt es nicht für $ARCH (nur arm64, armhf, amd64)." ;; esac
|
||||
if [ $UPDATE = 1 ] && ! $SUDO test -f "$ENV_DATEI"; then
|
||||
abbruch "Keine bestehende Installation in $AUDIOFY_DIR gefunden – ohne --update ausführen."
|
||||
abbruch "Keine bestehende Installation in $PLAYWISH_DIR gefunden – ohne --update ausführen."
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------ Abfragen
|
||||
if [ $UPDATE = 0 ]; then
|
||||
schritt "Angaben"
|
||||
frage GERAETENAME "Name des Spotify-Connect-Geräts" "Audiofy"
|
||||
frage GERAETENAME "Name des Spotify-Connect-Geräts" "Playwish"
|
||||
echo " Audio-Ausgabe: 1) Bluetooth-Lautsprecher 2) Kabel/HDMI/USB (ALSA)"
|
||||
frage AUSGABE "Auswahl" "1"
|
||||
if [ "$AUSGABE" = 2 ]; then
|
||||
@@ -50,7 +50,7 @@ if [ $UPDATE = 0 ]; then
|
||||
BLUETOOTH=1
|
||||
ALSA_GERAET="bluealsa:DEV=00:00:00:00:00:00,PROFILE=a2dp" # = zuletzt verbundener Lautsprecher
|
||||
fi
|
||||
frage SERVER_URL "Adresse des Audiofy-Servers (leer = ohne Wünsche, nur Playlist)" ""
|
||||
frage SERVER_URL "Adresse des Playwish-Servers (leer = ohne Wünsche, nur Playlist)" ""
|
||||
SERVER_URL="${SERVER_URL%/}"
|
||||
PLAYER_TOKEN=""
|
||||
[ -n "$SERVER_URL" ] && frage_geheim PLAYER_TOKEN "PLAYER_API_TOKEN vom Server (verdeckt)"
|
||||
@@ -102,7 +102,7 @@ if [ $UPDATE = 0 ]; then
|
||||
info "Name „$GERAETENAME“, Ausgabe $ALSA_GERAET"
|
||||
fi
|
||||
$SUDO install -d /etc/systemd/system/raspotify.service.d
|
||||
vorlage raspotify-10-audiofy.conf /etc/systemd/system/raspotify.service.d/10-audiofy.conf
|
||||
vorlage raspotify-10-playwish.conf /etc/systemd/system/raspotify.service.d/10-playwish.conf
|
||||
$SUDO systemctl daemon-reload
|
||||
$SUDO systemctl enable raspotify >/dev/null 2>&1
|
||||
[ $UPDATE = 0 ] && $SUDO systemctl restart raspotify
|
||||
@@ -144,16 +144,16 @@ fi
|
||||
# ------------------------------------------------------------------ Benutzer, Ordner, Code
|
||||
schritt "Dienst-Benutzer, Ordner und Code"
|
||||
dienst_benutzer
|
||||
$SUDO install -d -o root -g "$AUDIOFY_USER" -m 750 "$AUDIOFY_DIR"
|
||||
$SUDO install -d -o "$AUDIOFY_USER" -g "$AUDIOFY_USER" -m 700 "$KONFIG"
|
||||
code_kopieren "$REPO/player" "$AUDIOFY_DIR/app"
|
||||
venv_einrichten "$AUDIOFY_DIR/app/requirements.txt"
|
||||
info "Code in $AUDIOFY_DIR/app, Konfiguration in $KONFIG"
|
||||
$SUDO install -d -o root -g "$PLAYWISH_USER" -m 750 "$PLAYWISH_DIR"
|
||||
$SUDO install -d -o "$PLAYWISH_USER" -g "$PLAYWISH_USER" -m 700 "$KONFIG"
|
||||
code_kopieren "$REPO/player" "$PLAYWISH_DIR/app"
|
||||
venv_einrichten "$PLAYWISH_DIR/app/requirements.txt"
|
||||
info "Code in $PLAYWISH_DIR/app, Konfiguration in $KONFIG"
|
||||
|
||||
# ------------------------------------------------------------------ Konfiguration
|
||||
schritt "Konfiguration ($ENV_DATEI)"
|
||||
if [ $UPDATE = 0 ]; then
|
||||
$SUDO test -f "$ENV_DATEI" || $SUDO install -o "$AUDIOFY_USER" -g "$AUDIOFY_USER" -m 600 /dev/null "$ENV_DATEI"
|
||||
$SUDO test -f "$ENV_DATEI" || $SUDO install -o "$PLAYWISH_USER" -g "$PLAYWISH_USER" -m 600 /dev/null "$ENV_DATEI"
|
||||
env_setzen "$ENV_DATEI" SPOTIFY_CLIENT_ID "$SPOTIFY_CLIENT_ID"
|
||||
env_setzen "$ENV_DATEI" SPOTIFY_CLIENT_SECRET "$SPOTIFY_CLIENT_SECRET"
|
||||
env_setzen "$ENV_DATEI" SPOTIFY_REDIRECT_URI "http://127.0.0.1:8888/callback"
|
||||
@@ -170,7 +170,7 @@ if [ $UPDATE = 0 ]; then
|
||||
schritt "Spotify-Login für die Wiedergabe-Steuerung"
|
||||
info "Öffne gleich die angezeigte Adresse im Browser, melde dich an und füge danach die"
|
||||
info "Adresse aus der Adresszeile (http://127.0.0.1:8888/callback?...) hier ein."
|
||||
"${ALS_DIENST[@]}" "$AUDIOFY_DIR/.venv/bin/python" "$AUDIOFY_DIR/app/auth.py" --profil player --env "$ENV_DATEI" \
|
||||
"${ALS_DIENST[@]}" "$PLAYWISH_DIR/.venv/bin/python" "$PLAYWISH_DIR/app/auth.py" --profil player --env "$ENV_DATEI" \
|
||||
|| warnung "Login fehlgeschlagen – später nachholen (siehe README)."
|
||||
else
|
||||
# alte Schlüsselnamen übernehmen
|
||||
@@ -179,18 +179,18 @@ else
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------ Dienst
|
||||
schritt "Dienst audiofy-controller"
|
||||
vorlage audiofy-controller.service /etc/systemd/system/audiofy-controller.service
|
||||
schritt "Dienst playwish-controller"
|
||||
vorlage playwish-controller.service /etc/systemd/system/playwish-controller.service
|
||||
$SUDO systemctl daemon-reload
|
||||
$SUDO systemctl enable audiofy-controller >/dev/null 2>&1
|
||||
$SUDO systemctl restart audiofy-controller
|
||||
$SUDO systemctl enable playwish-controller >/dev/null 2>&1
|
||||
$SUDO systemctl restart playwish-controller
|
||||
sleep 5
|
||||
systemctl is-active --quiet audiofy-controller || abbruch "audiofy-controller läuft nicht – siehe: journalctl -u audiofy-controller"
|
||||
info "audiofy-controller läuft"
|
||||
systemctl is-active --quiet playwish-controller || abbruch "playwish-controller läuft nicht – siehe: journalctl -u playwish-controller"
|
||||
info "playwish-controller läuft"
|
||||
|
||||
# ------------------------------------------------------------------ Zusammenfassung
|
||||
schritt "Fertig"
|
||||
info "Logs: journalctl -u audiofy-controller -f · journalctl -u raspotify -f"
|
||||
info "Logs: journalctl -u playwish-controller -f · journalctl -u raspotify -f"
|
||||
if [ $UPDATE = 0 ]; then
|
||||
info ""
|
||||
info "Wichtig: Wähle das Gerät „$GERAETENAME“ EINMAL in der Spotify-App aus (im selben Netz)."
|
||||
|
||||
+26
-26
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
# Audiofy – Installation der Rolle "Server": Website für Gäste, Admin-Bereich, Player-API.
|
||||
# Playwish – Installation der Rolle "Server": Website für Gäste, Admin-Bereich, Player-API.
|
||||
#
|
||||
# install/install-server.sh Neuinstallation (fragt alles Nötige ab)
|
||||
# install/install-server.sh --update nur Code, Python-Umgebung und Dienst aktualisieren
|
||||
@@ -18,14 +18,14 @@ for arg in "$@"; do
|
||||
esac
|
||||
done
|
||||
|
||||
ENV_DATEI="$AUDIOFY_DIR/.env"
|
||||
export AUDIOFY_DIR AUDIOFY_USER
|
||||
ENV_DATEI="$PLAYWISH_DIR/.env"
|
||||
export PLAYWISH_DIR PLAYWISH_USER
|
||||
export APP_PORT="${APP_PORT:-8000}"
|
||||
|
||||
schritt "Audiofy-Server: $([ $UPDATE = 1 ] && echo Update || echo Neuinstallation)"
|
||||
schritt "Playwish-Server: $([ $UPDATE = 1 ] && echo Update || echo Neuinstallation)"
|
||||
pruefe_system
|
||||
if [ $UPDATE = 1 ] && ! $SUDO test -f "$ENV_DATEI"; then
|
||||
abbruch "Keine bestehende Installation in $AUDIOFY_DIR gefunden – ohne --update ausführen."
|
||||
abbruch "Keine bestehende Installation in $PLAYWISH_DIR gefunden – ohne --update ausführen."
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------ Abfragen
|
||||
@@ -67,20 +67,20 @@ pakete "${PAKETE[@]}"
|
||||
# ------------------------------------------------------------------ Benutzer, Ordner, Code
|
||||
schritt "Dienst-Benutzer, Ordner und Code"
|
||||
dienst_benutzer
|
||||
$SUDO install -d -o root -g "$AUDIOFY_USER" -m 750 "$AUDIOFY_DIR"
|
||||
$SUDO install -d -o "$AUDIOFY_USER" -g "$AUDIOFY_USER" -m 700 "$AUDIOFY_DIR/data"
|
||||
code_kopieren "$REPO/server" "$AUDIOFY_DIR/app"
|
||||
$SUDO install -o root -g "$AUDIOFY_USER" -m 640 "$REPO/player/auth.py" "$AUDIOFY_DIR/app/auth.py"
|
||||
venv_einrichten "$AUDIOFY_DIR/app/requirements.txt"
|
||||
info "Code in $AUDIOFY_DIR/app, Python-Umgebung in $AUDIOFY_DIR/.venv"
|
||||
$SUDO install -d -o root -g "$PLAYWISH_USER" -m 750 "$PLAYWISH_DIR"
|
||||
$SUDO install -d -o "$PLAYWISH_USER" -g "$PLAYWISH_USER" -m 700 "$PLAYWISH_DIR/data"
|
||||
code_kopieren "$REPO/server" "$PLAYWISH_DIR/app"
|
||||
$SUDO install -o root -g "$PLAYWISH_USER" -m 640 "$REPO/player/auth.py" "$PLAYWISH_DIR/app/auth.py"
|
||||
venv_einrichten "$PLAYWISH_DIR/app/requirements.txt"
|
||||
info "Code in $PLAYWISH_DIR/app, Python-Umgebung in $PLAYWISH_DIR/.venv"
|
||||
|
||||
# ------------------------------------------------------------------ Konfiguration
|
||||
schritt "Konfiguration ($ENV_DATEI)"
|
||||
$SUDO test -f "$ENV_DATEI" || $SUDO install -o "$AUDIOFY_USER" -g "$AUDIOFY_USER" -m 600 /dev/null "$ENV_DATEI"
|
||||
VERWALTUNG=("${ALS_DIENST[@]}" "$AUDIOFY_DIR/.venv/bin/python" "$AUDIOFY_DIR/app/verwaltung.py")
|
||||
$SUDO test -f "$ENV_DATEI" || $SUDO install -o "$PLAYWISH_USER" -g "$PLAYWISH_USER" -m 600 /dev/null "$ENV_DATEI"
|
||||
VERWALTUNG=("${ALS_DIENST[@]}" "$PLAYWISH_DIR/.venv/bin/python" "$PLAYWISH_DIR/app/verwaltung.py")
|
||||
"${VERWALTUNG[@]}" geheimnisse --env "$ENV_DATEI" | sed 's/^/ /'
|
||||
if [ $UPDATE = 0 ]; then
|
||||
env_setzen "$ENV_DATEI" DB_PATH "$AUDIOFY_DIR/data/audiofy.db"
|
||||
env_setzen "$ENV_DATEI" DB_PATH "$PLAYWISH_DIR/data/playwish.db"
|
||||
env_setzen "$ENV_DATEI" PUBLIC_URL "https://$DOMAIN"
|
||||
env_setzen "$ENV_DATEI" SPOTIFY_CLIENT_ID "$SPOTIFY_CLIENT_ID"
|
||||
env_setzen "$ENV_DATEI" SPOTIFY_CLIENT_SECRET "$SPOTIFY_CLIENT_SECRET"
|
||||
@@ -91,7 +91,7 @@ if [ $UPDATE = 0 ]; then
|
||||
info "Öffne gleich die angezeigte Adresse im Browser, melde dich an und füge danach die"
|
||||
info "Adresse aus der Adresszeile (http://127.0.0.1:8888/callback?...) hier ein."
|
||||
if ja_nein "Jetzt anmelden?" j; then
|
||||
"${ALS_DIENST[@]}" "$AUDIOFY_DIR/.venv/bin/python" "$AUDIOFY_DIR/app/auth.py" --profil server --env "$ENV_DATEI" \
|
||||
"${ALS_DIENST[@]}" "$PLAYWISH_DIR/.venv/bin/python" "$PLAYWISH_DIR/app/auth.py" --profil server --env "$ENV_DATEI" \
|
||||
|| warnung "Login fehlgeschlagen – später nachholen (siehe README)."
|
||||
fi
|
||||
|
||||
@@ -103,19 +103,19 @@ if [ $UPDATE = 0 ]; then
|
||||
fi
|
||||
|
||||
# ------------------------------------------------------------------ Dienst
|
||||
schritt "Dienst audiofy-web"
|
||||
vorlage audiofy-web.service /etc/systemd/system/audiofy-web.service
|
||||
schritt "Dienst playwish-web"
|
||||
vorlage playwish-web.service /etc/systemd/system/playwish-web.service
|
||||
$SUDO systemctl daemon-reload
|
||||
$SUDO systemctl enable audiofy-web >/dev/null 2>&1
|
||||
$SUDO systemctl restart audiofy-web
|
||||
$SUDO systemctl enable playwish-web >/dev/null 2>&1
|
||||
$SUDO systemctl restart playwish-web
|
||||
sleep 3
|
||||
systemctl is-active --quiet audiofy-web || abbruch "audiofy-web läuft nicht – siehe: journalctl -u audiofy-web"
|
||||
curl -fsS "http://127.0.0.1:$APP_PORT/healthz" >/dev/null && info "audiofy-web läuft"
|
||||
systemctl is-active --quiet playwish-web || abbruch "playwish-web läuft nicht – siehe: journalctl -u playwish-web"
|
||||
curl -fsS "http://127.0.0.1:$APP_PORT/healthz" >/dev/null && info "playwish-web läuft"
|
||||
|
||||
# ------------------------------------------------------------------ Caddy & Schutz (nur Neuinstallation)
|
||||
if [ $UPDATE = 0 ]; then
|
||||
schritt "Caddy (HTTPS)"
|
||||
if $SUDO grep -q "Audiofy" /etc/caddy/Caddyfile 2>/dev/null || $SUDO grep -q "/usr/share/caddy" /etc/caddy/Caddyfile 2>/dev/null; then
|
||||
if $SUDO grep -q "Playwish" /etc/caddy/Caddyfile 2>/dev/null || $SUDO grep -q "/usr/share/caddy" /etc/caddy/Caddyfile 2>/dev/null; then
|
||||
vorlage Caddyfile /etc/caddy/Caddyfile
|
||||
$SUDO caddy validate --config /etc/caddy/Caddyfile --adapter caddyfile >/dev/null 2>&1 || abbruch "Caddyfile ungültig"
|
||||
$SUDO systemctl enable caddy >/dev/null 2>&1
|
||||
@@ -138,7 +138,7 @@ if [ $UPDATE = 0 ]; then
|
||||
fi
|
||||
if [ $FAIL2BAN = 1 ]; then
|
||||
schritt "fail2ban"
|
||||
vorlage fail2ban-audiofy.conf /etc/fail2ban/jail.d/audiofy.conf
|
||||
vorlage fail2ban-playwish.conf /etc/fail2ban/jail.d/playwish.conf
|
||||
$SUDO systemctl enable fail2ban >/dev/null 2>&1
|
||||
$SUDO systemctl restart fail2ban
|
||||
info "SSH-Schutz auf Port $SSH_PORT aktiv"
|
||||
@@ -150,7 +150,7 @@ if [ $UPDATE = 0 ]; then
|
||||
fi
|
||||
schritt "Logs begrenzen"
|
||||
$SUDO install -d /etc/systemd/journald.conf.d
|
||||
vorlage journald-10-audiofy.conf /etc/systemd/journald.conf.d/10-audiofy.conf
|
||||
vorlage journald-10-playwish.conf /etc/systemd/journald.conf.d/10-playwish.conf
|
||||
$SUDO systemctl restart systemd-journald
|
||||
info "journald max. 200 MB"
|
||||
fi
|
||||
@@ -160,11 +160,11 @@ schritt "Fertig"
|
||||
URL="$(env_wert "$ENV_DATEI" PUBLIC_URL)"
|
||||
info "Website: $URL (Gäste nur mit Einladungslink/QR-Code)"
|
||||
info "Admin: $URL/admin"
|
||||
info "Logs: journalctl -u audiofy-web -f"
|
||||
info "Logs: journalctl -u playwish-web -f"
|
||||
if [ $UPDATE = 0 ]; then
|
||||
info ""
|
||||
info "Für die Player-Installation brauchst du:"
|
||||
info " Server-Adresse: $URL"
|
||||
info " Player-Token: sudo -u $AUDIOFY_USER grep PLAYER_API_TOKEN $ENV_DATEI"
|
||||
info " Player-Token: sudo -u $PLAYWISH_USER grep PLAYER_API_TOKEN $ENV_DATEI"
|
||||
info "Gastzugang ist anfangs aus – im Admin unter „Gäste“ einschalten."
|
||||
fi
|
||||
|
||||
+12
-12
@@ -1,17 +1,17 @@
|
||||
# Audiofy – gemeinsame Hilfsfunktionen für die Install-Skripte (wird per "source" geladen)
|
||||
# Playwish – gemeinsame Hilfsfunktionen für die Install-Skripte (wird per "source" geladen)
|
||||
# shellcheck shell=bash
|
||||
|
||||
AUDIOFY_DIR="${AUDIOFY_DIR:-/opt/audiofy}"
|
||||
AUDIOFY_USER="${AUDIOFY_USER:-audiofy}"
|
||||
PLAYWISH_DIR="${PLAYWISH_DIR:-/opt/playwish}"
|
||||
PLAYWISH_USER="${PLAYWISH_USER:-playwish}"
|
||||
REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
VORLAGEN="$REPO/install/vorlagen"
|
||||
|
||||
if [ "$(id -u)" -eq 0 ]; then
|
||||
SUDO=""
|
||||
ALS_DIENST=(runuser -u "$AUDIOFY_USER" --)
|
||||
ALS_DIENST=(runuser -u "$PLAYWISH_USER" --)
|
||||
else
|
||||
SUDO="sudo"
|
||||
ALS_DIENST=(sudo -u "$AUDIOFY_USER")
|
||||
ALS_DIENST=(sudo -u "$PLAYWISH_USER")
|
||||
fi
|
||||
|
||||
# --- Ausgabe ------------------------------------------------------------------
|
||||
@@ -67,31 +67,31 @@ pakete() {
|
||||
}
|
||||
|
||||
dienst_benutzer() {
|
||||
if ! id "$AUDIOFY_USER" >/dev/null 2>&1; then
|
||||
$SUDO useradd --system --home-dir "$AUDIOFY_DIR" --no-create-home --shell /usr/sbin/nologin "$AUDIOFY_USER"
|
||||
info "Dienst-Benutzer '$AUDIOFY_USER' angelegt (ohne Login, ohne sudo)"
|
||||
if ! id "$PLAYWISH_USER" >/dev/null 2>&1; then
|
||||
$SUDO useradd --system --home-dir "$PLAYWISH_DIR" --no-create-home --shell /usr/sbin/nologin "$PLAYWISH_USER"
|
||||
info "Dienst-Benutzer '$PLAYWISH_USER' angelegt (ohne Login, ohne sudo)"
|
||||
fi
|
||||
}
|
||||
|
||||
# code_kopieren QUELLE ZIEL – ersetzt den Inhalt von ZIEL (gehört root, Dienst darf nur lesen)
|
||||
code_kopieren() {
|
||||
local quelle="$1" ziel="$2"
|
||||
$SUDO install -d -o root -g "$AUDIOFY_USER" -m 750 "$ziel"
|
||||
$SUDO install -d -o root -g "$PLAYWISH_USER" -m 750 "$ziel"
|
||||
$SUDO find "$ziel" -mindepth 1 -delete
|
||||
tar -C "$quelle" --exclude='__pycache__' --exclude='.venv' --exclude='.pytest_cache' --exclude='tests' -cf - . \
|
||||
| $SUDO tar -C "$ziel" --no-same-owner -xf -
|
||||
$SUDO chown -R root:"$AUDIOFY_USER" "$ziel"
|
||||
$SUDO chown -R root:"$PLAYWISH_USER" "$ziel"
|
||||
$SUDO find "$ziel" -type d -exec chmod 750 {} +
|
||||
$SUDO find "$ziel" -type f -exec chmod 640 {} +
|
||||
}
|
||||
|
||||
# venv_einrichten REQUIREMENTS
|
||||
venv_einrichten() {
|
||||
local venv="$AUDIOFY_DIR/.venv"
|
||||
local venv="$PLAYWISH_DIR/.venv"
|
||||
[ -x "$venv/bin/python" ] || $SUDO python3 -m venv "$venv"
|
||||
$SUDO "$venv/bin/pip" install -q --upgrade pip
|
||||
$SUDO "$venv/bin/pip" install -q -r "$1"
|
||||
$SUDO chown -R root:"$AUDIOFY_USER" "$venv"
|
||||
$SUDO chown -R root:"$PLAYWISH_USER" "$venv"
|
||||
$SUDO chmod -R g+rX,o-rwx "$venv"
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Audiofy – Caddy-Konfiguration (erzeugt von install-server.sh)
|
||||
# Playwish – Caddy-Konfiguration (erzeugt von install-server.sh)
|
||||
{
|
||||
email {{ACME_EMAIL}}
|
||||
servers {
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
[Unit]
|
||||
Description=Audiofy – Website, Admin-Bereich und Player-API
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
User={{AUDIOFY_USER}}
|
||||
Group={{AUDIOFY_USER}}
|
||||
WorkingDirectory={{AUDIOFY_DIR}}/app
|
||||
Environment=AUDIOFY_ENV={{AUDIOFY_DIR}}/.env
|
||||
ExecStart={{AUDIOFY_DIR}}/.venv/bin/uvicorn app.main:app --host 127.0.0.1 --port {{APP_PORT}} --workers 1 --no-access-log --proxy-headers --forwarded-allow-ips 127.0.0.1
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
UMask=0077
|
||||
# Härtung
|
||||
NoNewPrivileges=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
ReadWritePaths={{AUDIOFY_DIR}}/data {{AUDIOFY_DIR}}/.env
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
ProtectKernelTunables=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectControlGroups=yes
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
||||
LockPersonality=yes
|
||||
MemoryMax=300M
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
@@ -1,4 +1,4 @@
|
||||
# Audiofy – SSH gegen Passwort-Raten schützen
|
||||
# Playwish – SSH gegen Passwort-Raten schützen
|
||||
[sshd]
|
||||
enabled = true
|
||||
port = {{SSH_PORT}}
|
||||
+6
-6
@@ -1,15 +1,15 @@
|
||||
[Unit]
|
||||
Description=Audiofy – Controller (Spotify-Steuerung, Wünsche vom Server)
|
||||
Description=Playwish – Controller (Spotify-Steuerung, Wünsche vom Server)
|
||||
After=network-online.target bluetooth.target raspotify.service
|
||||
Wants=network-online.target raspotify.service
|
||||
# nie aufgeben, immer wieder neu starten
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
User={{AUDIOFY_USER}}
|
||||
Group={{AUDIOFY_USER}}
|
||||
WorkingDirectory={{AUDIOFY_DIR}}/app
|
||||
ExecStart={{AUDIOFY_DIR}}/.venv/bin/python -u {{AUDIOFY_DIR}}/app/controller.py --env {{AUDIOFY_DIR}}/config/.env
|
||||
User={{PLAYWISH_USER}}
|
||||
Group={{PLAYWISH_USER}}
|
||||
WorkingDirectory={{PLAYWISH_DIR}}/app
|
||||
ExecStart={{PLAYWISH_DIR}}/.venv/bin/python -u {{PLAYWISH_DIR}}/app/controller.py --env {{PLAYWISH_DIR}}/config/.env
|
||||
Restart=always
|
||||
RestartSec=5
|
||||
UMask=0077
|
||||
@@ -17,7 +17,7 @@ UMask=0077
|
||||
NoNewPrivileges=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
ReadWritePaths={{AUDIOFY_DIR}}/config
|
||||
ReadWritePaths={{PLAYWISH_DIR}}/config
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
ProtectKernelTunables=yes
|
||||
@@ -0,0 +1,30 @@
|
||||
[Unit]
|
||||
Description=Playwish – Website, Admin-Bereich und Player-API
|
||||
After=network-online.target
|
||||
Wants=network-online.target
|
||||
|
||||
[Service]
|
||||
User={{PLAYWISH_USER}}
|
||||
Group={{PLAYWISH_USER}}
|
||||
WorkingDirectory={{PLAYWISH_DIR}}/app
|
||||
Environment=PLAYWISH_ENV={{PLAYWISH_DIR}}/.env
|
||||
ExecStart={{PLAYWISH_DIR}}/.venv/bin/uvicorn app.main:app --host 127.0.0.1 --port {{APP_PORT}} --workers 1 --no-access-log --proxy-headers --forwarded-allow-ips 127.0.0.1
|
||||
Restart=always
|
||||
RestartSec=3
|
||||
UMask=0077
|
||||
# Härtung
|
||||
NoNewPrivileges=yes
|
||||
ProtectSystem=strict
|
||||
ProtectHome=yes
|
||||
ReadWritePaths={{PLAYWISH_DIR}}/data {{PLAYWISH_DIR}}/.env
|
||||
PrivateTmp=yes
|
||||
PrivateDevices=yes
|
||||
ProtectKernelTunables=yes
|
||||
ProtectKernelModules=yes
|
||||
ProtectControlGroups=yes
|
||||
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
|
||||
LockPersonality=yes
|
||||
MemoryMax=300M
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
# Audiofy: raspotify nie endgültig aufgeben (z. B. wenn der Lautsprecher kurz fehlt
|
||||
# Playwish: raspotify nie endgültig aufgeben (z. B. wenn der Lautsprecher kurz fehlt
|
||||
# oder das Netz beim Start noch nicht da ist)
|
||||
[Unit]
|
||||
StartLimitIntervalSec=0
|
||||
@@ -1,4 +1,4 @@
|
||||
# Audiofy – SSH-Härtung (NICHT automatisch installiert, siehe README „Server härten“)
|
||||
# Playwish – SSH-Härtung (NICHT automatisch installiert, siehe README „Server härten“)
|
||||
# Erst einsetzen, wenn der Login per Schlüssel für {{ADMIN_USER}} nachweislich klappt!
|
||||
Port {{SSH_PORT}}
|
||||
PermitRootLogin no
|
||||
Reference in New Issue
Block a user