Kapitel 13/Tutorial.md aktualisiert
This commit is contained in:
@@ -216,117 +216,6 @@ Inhalt:
|
|||||||
|
|
||||||
Mit dieser Einrichtung sind **SSH‑Schlüssel**, **Berechtigungen** und **Pfade** konsistent. `ssh-copy-id` aus Abschnitt 3 funktioniert dadurch ohne Fehlermeldungen – und n8n kann die Skripte stabil starten.
|
Mit dieser Einrichtung sind **SSH‑Schlüssel**, **Berechtigungen** und **Pfade** konsistent. `ssh-copy-id` aus Abschnitt 3 funktioniert dadurch ohne Fehlermeldungen – und n8n kann die Skripte stabil starten.
|
||||||
|
|
||||||
## Abschnitt 2 – Clipper-LXC einrichten (Basisdienste & Einstiegsskripte)
|
|
||||||
|
|
||||||
Damit der Benutzer `clipper` sauber funktioniert, legen wir ihn **immer mit Home-Verzeichnis und Shell** an. So können wir später SSH-Schlüssel ohne Fehler hinterlegen.
|
|
||||||
|
|
||||||
### Benutzer und Verzeichnisse
|
|
||||||
|
|
||||||
Als root:
|
|
||||||
```bash
|
|
||||||
adduser --home /home/clipper --shell /bin/bash clipper
|
|
||||||
```
|
|
||||||
Vergib ein Passwort und bestätige die Abfragen. Danach richte das Konfigurationsverzeichnis ein:
|
|
||||||
```bash
|
|
||||||
mkdir -p /etc/clipper
|
|
||||||
chown root:clipper /etc/clipper
|
|
||||||
chmod 750 /etc/clipper
|
|
||||||
```
|
|
||||||
|
|
||||||
### Pakete installieren
|
|
||||||
```bash
|
|
||||||
apt install -y ffmpeg jq python3 python3-venv curl unzip inotify-tools sudo
|
|
||||||
```
|
|
||||||
|
|
||||||
- **ffmpeg**: Kern für Analyse/Schnitt
|
|
||||||
- **jq**: JSON-Auswertung
|
|
||||||
- **python3/venv**: Virtuelle Umgebung für Analyse
|
|
||||||
- **inotify-tools**: Events
|
|
||||||
- **sudo**: für Rechteeskalation
|
|
||||||
|
|
||||||
### Konfiguration anlegen
|
|
||||||
```bash
|
|
||||||
nano /etc/clipper/clipper.env
|
|
||||||
```
|
|
||||||
Inhalt:
|
|
||||||
```
|
|
||||||
CLIPPER_IN=/srv/clipper/watch
|
|
||||||
CLIPPER_OUT=/srv/clipper/out
|
|
||||||
CLIPPER_TMP=/srv/clipper/temp
|
|
||||||
CLIPPER_LOG=/srv/clipper/logs/clipper.log
|
|
||||||
```
|
|
||||||
|
|
||||||
Rechte setzen:
|
|
||||||
```bash
|
|
||||||
chown root:clipper /etc/clipper/clipper.env
|
|
||||||
chmod 640 /etc/clipper/clipper.env
|
|
||||||
```
|
|
||||||
|
|
||||||
### Python-Umgebung vorbereiten
|
|
||||||
```bash
|
|
||||||
su - clipper
|
|
||||||
python3 -m venv /srv/clipper/.venv
|
|
||||||
source /srv/clipper/.venv/bin/activate
|
|
||||||
pip install --upgrade pip
|
|
||||||
pip install numpy opencv-python-headless
|
|
||||||
```
|
|
||||||
|
|
||||||
### Einstiegsskripte erstellen
|
|
||||||
**Analyse-Stub:**
|
|
||||||
```bash
|
|
||||||
nano /srv/clipper/bin/clipper-analyze
|
|
||||||
```
|
|
||||||
```bash
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
source /etc/clipper/clipper.env
|
|
||||||
IN="$1"
|
|
||||||
JOBID="${2:-manual}"
|
|
||||||
mkdir -p "$CLIPPER_TMP/$JOBID"
|
|
||||||
echo "$(date '+%F %T') [ANALYZE] job=$JOBID file=$IN" | tee -a "$CLIPPER_LOG"
|
|
||||||
OUT_JSON="$CLIPPER_TMP/$JOBID/candidates.json"
|
|
||||||
echo '[]' > "$OUT_JSON"
|
|
||||||
echo "$OUT_JSON"
|
|
||||||
```
|
|
||||||
|
|
||||||
**Schneid-Stub:**
|
|
||||||
```bash
|
|
||||||
nano /srv/clipper/bin/clipper-cut
|
|
||||||
```
|
|
||||||
```bash
|
|
||||||
#!/usr/bin/env bash
|
|
||||||
set -euo pipefail
|
|
||||||
source /etc/clipper/clipper.env
|
|
||||||
IN="$1"
|
|
||||||
RANGES_JSON="$2"
|
|
||||||
JOBID="${3:-manual}"
|
|
||||||
mkdir -p "$CLIPPER_OUT/$JOBID"
|
|
||||||
echo "$(date '+%F %T') [CUT] job=$JOBID file=$IN ranges=$RANGES_JSON" | tee -a "$CLIPPER_LOG"
|
|
||||||
exit 0
|
|
||||||
```
|
|
||||||
|
|
||||||
Rechte setzen:
|
|
||||||
```bash
|
|
||||||
chmod +x /srv/clipper/bin/clipper-*
|
|
||||||
chown -R clipper:clipper /srv/clipper/bin
|
|
||||||
```
|
|
||||||
|
|
||||||
### Logs und Rotation
|
|
||||||
```bash
|
|
||||||
nano /etc/logrotate.d/clipper
|
|
||||||
```
|
|
||||||
```
|
|
||||||
/srv/clipper/logs/*.log {
|
|
||||||
rotate 14
|
|
||||||
daily
|
|
||||||
missingok
|
|
||||||
notifempty
|
|
||||||
compress
|
|
||||||
delaycompress
|
|
||||||
copytruncate
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Abschnitt 3 – n8n ↔ Twitch: VOD & Clips importieren, in Nextcloud ablegen, Clipper starten
|
## Abschnitt 3 – n8n ↔ Twitch: VOD & Clips importieren, in Nextcloud ablegen, Clipper starten
|
||||||
|
|||||||
Reference in New Issue
Block a user