239 lines
5.5 KiB
Markdown
239 lines
5.5 KiB
Markdown
# Gitea-Lizenzierung: 5-Minuten Quickstart
|
|
|
|
## Schritt 1: Repository in Gitea erstellen (1 Min)
|
|
|
|
```bash
|
|
# In Gitea UI:
|
|
1. Klicke auf "+" → "New Repository"
|
|
2. Repository Name: mycrm-billing-module
|
|
3. Owner: mycrm (oder dein User)
|
|
4. ✅ Make Repository Private
|
|
5. Klicke "Create Repository"
|
|
```
|
|
|
|
**Repository-URL:** `https://git.mycrm.local/mycrm/mycrm-billing-module`
|
|
|
|
---
|
|
|
|
## Schritt 2: Gitea Access Token generieren (1 Min)
|
|
|
|
```bash
|
|
# In Gitea UI:
|
|
1. Klicke auf dein Avatar → "Settings"
|
|
2. Linke Sidebar → "Applications"
|
|
3. Section "Generate New Token"
|
|
- Token Name: "myCRM License - Billing Module"
|
|
- ✅ Select scopes: repo
|
|
4. Klicke "Generate Token"
|
|
5. 📋 Kopiere den Token (wird nur einmal angezeigt!)
|
|
```
|
|
|
|
**Beispiel-Token:** `abc123def456ghi789jkl012mno345`
|
|
|
|
---
|
|
|
|
## Schritt 3: myCRM konfigurieren (1 Min)
|
|
|
|
```bash
|
|
# .env.local erstellen/bearbeiten
|
|
cp .env.plugin.example .env.local
|
|
nano .env.local
|
|
```
|
|
|
|
**Konfiguration:**
|
|
```bash
|
|
###> Plugin-System ###
|
|
LICENSE_BACKEND=GiteaLicenseValidator
|
|
GITEA_BASE_URL=https://git.mycrm.local
|
|
GITEA_ORGANIZATION=mycrm
|
|
INSTANCE_ID=meine-crm-instance-1
|
|
|
|
###> Modul-Lizenzen ###
|
|
GITEA_TOKEN_BILLING=abc123def456ghi789jkl012mno345
|
|
```
|
|
|
|
**Speichern:** `Ctrl+O` → `Enter` → `Ctrl+X`
|
|
|
|
---
|
|
|
|
## Schritt 4: Modul installieren (1 Min)
|
|
|
|
```bash
|
|
# Composer Repository konfigurieren
|
|
composer config repositories.mycrm-billing vcs https://git.mycrm.local/mycrm/mycrm-billing-module
|
|
|
|
# Composer Auth konfigurieren (gleicher Token!)
|
|
composer config http-basic.git.mycrm.local dein-username abc123def456ghi789jkl012mno345
|
|
|
|
# Modul installieren
|
|
composer require mycrm/billing-module
|
|
|
|
# Migration ausführen
|
|
php bin/console doctrine:migrations:migrate -n
|
|
```
|
|
|
|
---
|
|
|
|
## Schritt 5: Verifizieren (1 Min)
|
|
|
|
```bash
|
|
# Cache leeren
|
|
php bin/console cache:clear
|
|
|
|
# Module auflisten
|
|
php bin/console app:module:list
|
|
```
|
|
|
|
**Erwartete Ausgabe:**
|
|
```
|
|
┌──────────┬─────────┬────────────────────────────────────────────┐
|
|
│ Modul │ Status │ Lizenz-Info │
|
|
├──────────┼─────────┼────────────────────────────────────────────┤
|
|
│ billing │ ✓ Aktiv │ Gitea Repository-Zugriff bestätigt │
|
|
│ │ │ (mycrm/mycrm-billing-module) │
|
|
└──────────┴─────────┴────────────────────────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## ✅ Fertig!
|
|
|
|
Dein Modul ist jetzt lizenziert und einsatzbereit.
|
|
|
|
**Testen:**
|
|
1. Gehe zu `https://mycrm.local/billing`
|
|
2. Das Modul sollte geladen sein
|
|
3. Bei Problemen: Logs prüfen in `var/log/dev.log`
|
|
|
|
---
|
|
|
|
## Weitere Benutzer lizenzieren
|
|
|
|
### Variante A: Gitea Collaborator hinzufügen
|
|
|
|
```bash
|
|
# In Gitea UI:
|
|
1. Gehe zu Repository: mycrm-billing-module
|
|
2. Settings → Collaboration
|
|
3. Klicke "Add Collaborator"
|
|
4. User suchen und auswählen
|
|
5. Permission: Read
|
|
6. Klicke "Add Collaborator"
|
|
```
|
|
|
|
Der neue User kann jetzt:
|
|
1. Eigenen Token generieren
|
|
2. In seiner myCRM-Instanz den Token eintragen
|
|
3. Modul nutzen
|
|
|
|
### Variante B: Gitea Team erstellen (für mehrere User)
|
|
|
|
```bash
|
|
# In Gitea UI:
|
|
1. Gehe zu Organisation "mycrm"
|
|
2. Teams → "Create Team"
|
|
3. Team Name: "Premium Customers"
|
|
4. Permissions: Read
|
|
5. Klicke "Create Team"
|
|
|
|
# Dann: Team-Mitglieder hinzufügen
|
|
1. Team → Members
|
|
2. "Add Team Member"
|
|
3. User auswählen
|
|
|
|
# Dann: Repository dem Team zuweisen
|
|
1. Gehe zu Repository: mycrm-billing-module
|
|
2. Settings → Collaboration
|
|
3. "Add Team"
|
|
4. Team: Premium Customers
|
|
5. Permission: Read
|
|
```
|
|
|
|
Alle Team-Mitglieder haben automatisch Zugriff!
|
|
|
|
---
|
|
|
|
## Troubleshooting
|
|
|
|
### ❌ "Kein Zugriff auf Modul-Repository"
|
|
|
|
**Test:**
|
|
```bash
|
|
curl -H "Authorization: token abc123def456..." \
|
|
https://git.mycrm.local/api/v1/repos/mycrm/mycrm-billing-module
|
|
```
|
|
|
|
**Sollte zurückgeben:** Status 200 + JSON
|
|
|
|
**Falls Status 404:**
|
|
- Repository existiert nicht oder ist falsch benannt
|
|
- Prüfe: https://git.mycrm.local/mycrm/mycrm-billing-module
|
|
|
|
**Falls Status 401:**
|
|
- Token ist ungültig oder hat keine `repo` Berechtigung
|
|
- Generiere neuen Token mit korrekten Scopes
|
|
|
|
### ❌ Modul erscheint nicht in Liste
|
|
|
|
```bash
|
|
# Cache leeren
|
|
php bin/console cache:clear
|
|
|
|
# Plugin-System neu laden
|
|
php bin/console cache:warmup
|
|
|
|
# Prüfen ob .env.local geladen wird
|
|
php bin/console debug:container --env-vars | grep GITEA
|
|
```
|
|
|
|
### ❌ Composer kann nicht installieren
|
|
|
|
```bash
|
|
# Auth prüfen
|
|
cat auth.json
|
|
|
|
# Sollte enthalten:
|
|
{
|
|
"http-basic": {
|
|
"git.mycrm.local": {
|
|
"username": "dein-username",
|
|
"password": "dein-token"
|
|
}
|
|
}
|
|
}
|
|
|
|
# Neu versuchen
|
|
composer install -vvv
|
|
```
|
|
|
|
---
|
|
|
|
## Nächste Schritte
|
|
|
|
- **Weitere Module lizenzieren:** Wiederhole Schritte 1-5
|
|
- **Admin-UI nutzen:** Gehe zu `/admin/modules` für grafische Verwaltung
|
|
- **Lizenz-Metadaten:** Lies `GITEA_LICENSE_SYSTEM.md` für Features & Ablaufdatum
|
|
- **Vollständige Doku:** Siehe `PLUGIN_SYSTEM.md`
|
|
|
|
---
|
|
|
|
## Cheat Sheet
|
|
|
|
```bash
|
|
# Token registrieren
|
|
php bin/console app:module:license billing YOUR_TOKEN
|
|
|
|
# Status prüfen
|
|
php bin/console app:module:list
|
|
|
|
# Lizenz widerrufen
|
|
php bin/console app:module:revoke billing
|
|
|
|
# Cache leeren
|
|
php bin/console cache:clear
|
|
|
|
# Gitea API testen
|
|
curl -H "Authorization: token YOUR_TOKEN" \
|
|
https://git.mycrm.local/api/v1/user
|
|
```
|