chore: monorepo - plugin, backend und hilfsdaten in einem repo
- Eltern-Ordner ist jetzt EIN Git-Repo (statt getrennter Repos). - root .gitignore haelt Secrets (.env), node_modules, DB und Build-Artefakte raus. - release.ps1: manueller Release (ZIP bauen + ans Backend laden). - root README mit Struktur und Release-Ablauf. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
92
hilfsdaten/SPICKZETTEL.md
Normal file
92
hilfsdaten/SPICKZETTEL.md
Normal file
@@ -0,0 +1,92 @@
|
||||
# GDPR Content Blocker — Spickzettel (intern, NICHT ins Plugin)
|
||||
|
||||
Dieser Ordner liegt **außerhalb** des Plugin-Repos und wird nicht ausgeliefert.
|
||||
Hier nur Hilfsdaten/Notizen für mich speichern.
|
||||
|
||||
## Wichtige URLs
|
||||
- Gitea (Plugin): https://gitea.lucas-orth.de/lucas.orth/GDPR-Content-Blocker.git
|
||||
- Lizenz-Backend: https://hub.lucas-orth.de
|
||||
- Impressum: https://lucas-orth.de/impressum
|
||||
- Datenschutz: https://lucas-orth.de/datenschutz
|
||||
|
||||
## Ordnerstruktur (lokal)
|
||||
- `gdpr-content-blocker/` → das Plugin (Git-Repo, → Gitea). NUR Plugin-Dateien.
|
||||
- `license-backend/` → Docker-Backend (separat).
|
||||
- `hilfsdaten/` → dieser Ordner (Notizen, n8n, Skripte).
|
||||
|
||||
## Geheimnisse (NICHT hier im Klartext ablegen!)
|
||||
- ADMIN_API_TOKEN → in license-backend/.env (openssl rand -hex 32)
|
||||
- DOWNLOAD_SECRET → in license-backend/.env (openssl rand -hex 32)
|
||||
- Gitea-Secrets: LICENSE_BACKEND_URL, LICENSE_ADMIN_TOKEN (Repo → Settings → Actions → Secrets)
|
||||
|
||||
---
|
||||
|
||||
## Backend starten / verwalten (auf dem Server)
|
||||
```bash
|
||||
cd /pfad/zu/license-backend
|
||||
cp .env.example .env # einmalig, dann ausfüllen
|
||||
docker compose up -d --build
|
||||
docker compose logs -f
|
||||
curl https://hub.lucas-orth.de/healthz
|
||||
```
|
||||
|
||||
## Lizenzschlüssel erzeugen (manuell oder via n8n)
|
||||
```bash
|
||||
curl -X POST https://hub.lucas-orth.de/api/v1/licenses \
|
||||
-H "X-Admin-Token: ADMIN_TOKEN" -H "Content-Type: application/json" \
|
||||
-d '{"product":"gdpr-content-blocker","max_activations":1,"email":"kunde@x.de"}'
|
||||
```
|
||||
max_activations: 1 = Einzelseite, 3 = drei Seiten, -1 = unbegrenzt.
|
||||
|
||||
## Lizenz verwalten
|
||||
```bash
|
||||
# ansehen (Status + Domains)
|
||||
curl https://hub.lucas-orth.de/api/v1/licenses/KEY -H "X-Admin-Token: TOKEN"
|
||||
# sperren / entsperren
|
||||
curl -X POST https://hub.lucas-orth.de/api/v1/licenses/KEY/disable -H "X-Admin-Token: TOKEN"
|
||||
curl -X POST https://hub.lucas-orth.de/api/v1/licenses/KEY/enable -H "X-Admin-Token: TOKEN"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Neue Plugin-Version ausliefern (Update)
|
||||
|
||||
WICHTIG: interner Plugin-Slug = `gdpr-content-blocker` (NICHT umbenennen — Lizenz/Update
|
||||
hängen daran). Repo-/Ordnername = gdpr-content-blocker, das ist nur kosmetisch.
|
||||
|
||||
### Automatisch (mit Gitea Act Runner)
|
||||
```bash
|
||||
cd .../gdpr-content-blocker
|
||||
# Version in gdpr-content-blocker.php (Header + CB_VERSION) bumpen, committen
|
||||
git add -A && git commit -m "release: 1.0.1"
|
||||
git tag v1.0.1
|
||||
git push origin main
|
||||
git push origin v1.0.1 # löst den Release-Workflow aus
|
||||
```
|
||||
|
||||
### Manuell (ohne Runner)
|
||||
```bash
|
||||
cd .../gdpr-content-blocker
|
||||
git archive --format=zip --prefix=gdpr-content-blocker/ -o gdpr-content-blocker.zip HEAD
|
||||
curl -fSs -X POST "https://hub.lucas-orth.de/api/v1/releases?product=gdpr-content-blocker&version=1.0.1" \
|
||||
-H "X-Admin-Token: ADMIN_TOKEN" -H "Content-Type: application/zip" \
|
||||
--data-binary @gdpr-content-blocker.zip
|
||||
```
|
||||
|
||||
### Prüfen
|
||||
```bash
|
||||
curl https://hub.lucas-orth.de/api/v1/releases/gdpr-content-blocker -H "X-Admin-Token: TOKEN"
|
||||
```
|
||||
|
||||
## Erstinstallation auf einer Kundenseite
|
||||
1. ZIP einmalig manuell in WordPress hochladen (Plugins → Installieren → Hochladen).
|
||||
2. Aktivieren → Einstellungen → GDPR Content Blocker → Tab „Lizenz" → Key eintragen.
|
||||
3. Künftige Updates kommen automatisch (sobald höhere Version im Backend liegt).
|
||||
|
||||
## Tests lokal
|
||||
```bash
|
||||
# Backend
|
||||
cd license-backend
|
||||
npm run test:unit
|
||||
npm run test:integration # braucht express in node_modules
|
||||
```
|
||||
41
hilfsdaten/gitea-runner/README.md
Normal file
41
hilfsdaten/gitea-runner/README.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Gitea Act Runner – Einrichtung
|
||||
|
||||
Einmalig nötig, damit der Release-Workflow (Tag `v*`) automatisch baut + hochlädt.
|
||||
|
||||
## 1. Registrierungs-Token holen
|
||||
Gitea → Repo **GDPR-Content-Blocker** → **Settings → Actions → Runner** →
|
||||
Button **„Neuen Runner erstellen"**. Es erscheint ein **Registration Token**
|
||||
(eine lange Zeichenkette). Kopieren.
|
||||
|
||||
(Alternativ instanzweit: Admin-Bereich → Actions → Runners → Create new Runner.)
|
||||
|
||||
## 2. Token eintragen
|
||||
In `docker-compose.yml` bei `GITEA_RUNNER_REGISTRATION_TOKEN` einsetzen.
|
||||
|
||||
## 3. Runner starten (auf dem Server, wo Docker läuft)
|
||||
```bash
|
||||
cd /pfad/zu/gitea-runner
|
||||
docker compose up -d
|
||||
docker compose logs -f # "runner registered successfully" abwarten
|
||||
```
|
||||
|
||||
Danach in Gitea unter Settings → Actions → Runner taucht „hub-runner" mit
|
||||
Status **idle/online** auf. Ab jetzt laufen Workflows automatisch.
|
||||
|
||||
## 4. Testen
|
||||
Im Plugin-Repo:
|
||||
```bash
|
||||
git tag v1.0.1
|
||||
git push origin v1.0.1
|
||||
```
|
||||
Gitea → Repo → Tab **Actions** zeigt den Lauf. Bei Erfolg ist die ZIP im Backend:
|
||||
```bash
|
||||
curl https://hub.lucas-orth.de/api/v1/releases/gdpr-content-blocker -H "X-Admin-Token: TOKEN"
|
||||
```
|
||||
|
||||
## Hinweise
|
||||
- Der Runner braucht Zugriff auf den Docker-Socket (startet die Job-Container).
|
||||
- Erstes Image (catthehacker/ubuntu) wird beim ersten Lauf gezogen → dauert kurz.
|
||||
- Das `data/`-Verzeichnis enthält nach der Registrierung die Runner-Identität
|
||||
(`.runner`). Nicht löschen, sonst neu registrieren.
|
||||
- Token wird nur einmal gebraucht; nach erfolgreicher Registrierung ignoriert.
|
||||
18
hilfsdaten/gitea-runner/docker-compose.yml
Normal file
18
hilfsdaten/gitea-runner/docker-compose.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
services:
|
||||
gitea-runner:
|
||||
image: gitea/act_runner:latest
|
||||
container_name: gitea-runner
|
||||
restart: always
|
||||
environment:
|
||||
GITEA_INSTANCE_URL: https://gitea.lucas-orth.de
|
||||
# Registrierungs-Token aus: Repo → Settings → Actions → Runner →
|
||||
# "Neuen Runner erstellen". Nur fuer die ERSTE Registrierung noetig.
|
||||
GITEA_RUNNER_REGISTRATION_TOKEN: "HIER_TOKEN_EINFUEGEN"
|
||||
GITEA_RUNNER_NAME: hub-runner
|
||||
# Bildet das im Workflow genutzte "ubuntu-latest" auf ein Image ab,
|
||||
# das zip, rsync, curl, git und node bereits enthaelt.
|
||||
GITEA_RUNNER_LABELS: "ubuntu-latest:docker://catthehacker/ubuntu:act-latest"
|
||||
volumes:
|
||||
- ./data:/data
|
||||
# Docker-Socket: der Runner startet die Job-Container ueber den Host-Docker.
|
||||
- /var/run/docker.sock:/var/run/docker.sock
|
||||
Reference in New Issue
Block a user