120 lines
3.0 KiB
Markdown
120 lines
3.0 KiB
Markdown
# ✅ Secrets erfolgreich gesetzt!
|
|
|
|
## Status
|
|
|
|
✅ Repository erstellt
|
|
✅ Secrets konfiguriert:
|
|
- REGISTRY_USER
|
|
- REGISTRY_PASSWORD
|
|
- SSH_PRIVATE_KEY
|
|
|
|
## 🚀 Nächster Schritt: CI/CD Workflow testen
|
|
|
|
### Option 1: Workflow manuell triggern (Empfohlen)
|
|
|
|
1. **Gehe zu Actions:**
|
|
```
|
|
https://git.michaelschiemer.de/michael/michaelschiemer/actions
|
|
```
|
|
|
|
2. **Workflow auswählen:**
|
|
- Suche nach "Production Deployment Pipeline"
|
|
- Klicke auf den Workflow
|
|
|
|
3. **Workflow starten:**
|
|
- Klicke "Run workflow" (rechts oben)
|
|
- Branch: `main`
|
|
- `skip_tests`: deaktiviert (Tests sollen laufen)
|
|
- Klicke "Run workflow"
|
|
|
|
4. **Logs beobachten:**
|
|
- Prüfe jeden Schritt in den Logs
|
|
- Er_warte ~8-15 Minuten für komplette Ausführung
|
|
|
|
### Option 2: Automatisches Deployment via Commit
|
|
|
|
```bash
|
|
# Stelle sicher, dass alles committed ist
|
|
git add .
|
|
git commit -m "chore: CI/CD pipeline setup complete"
|
|
|
|
# Push zu main - startet automatisch den Workflow
|
|
git push origin main
|
|
```
|
|
|
|
## 📊 Workflow-Schritte
|
|
|
|
Der Workflow führt folgende Schritte aus:
|
|
|
|
1. **Tests** (~2-5 Min)
|
|
- PHP Setup
|
|
- Composer Dependencies
|
|
- Tests ausführen
|
|
|
|
2. **Build** (~3-5 Min)
|
|
- Multi-Stage Docker Build
|
|
- Composer Dependencies (Production)
|
|
- Frontend Build (npm)
|
|
- Final Production Image
|
|
|
|
3. **Push** (~1-2 Min)
|
|
- Docker Login zur Registry
|
|
- Image Tag generieren
|
|
- Image zur Registry pushen
|
|
|
|
4. **Deploy** (~2-4 Min)
|
|
- Ansible Playbook ausführen
|
|
- Image auf Production pullen
|
|
- Application Stack aktualisieren
|
|
- Services neu starten
|
|
|
|
**Gesamtzeit: ~8-15 Minuten**
|
|
|
|
## ✅ Erfolgreiche Ausführung erkennen
|
|
|
|
Der Workflow ist erfolgreich, wenn:
|
|
|
|
- ✅ Alle Jobs grün sind
|
|
- ✅ Keine Fehler in den Logs
|
|
- ✅ "Deploy via Ansible" erfolgreich
|
|
- ✅ Application läuft auf Production-Server
|
|
|
|
## 🔍 Verifizierung nach Deployment
|
|
|
|
```bash
|
|
# Prüfe Application-Status
|
|
ssh deploy@94.16.110.151 "cd ~/deployment/stacks/application && docker compose ps"
|
|
|
|
# Prüfe Logs
|
|
ssh deploy@94.16.110.151 "cd ~/deployment/stacks/application && docker compose logs --tail=50"
|
|
|
|
# Prüfe Health Endpoint
|
|
curl -k https://michaelschiemer.de/health
|
|
```
|
|
|
|
## 🐛 Troubleshooting
|
|
|
|
### Workflow startet nicht
|
|
- Prüfe, ob `.gitea/workflows/production-deploy.yml` im Repository ist
|
|
- Prüfe Workflow-Syntax
|
|
|
|
### "Secret not found" Fehler
|
|
- Prüfe Secrets-Seite: `https://git.michaelschiemer.de/michael/michaelschiemer/settings/secrets/actions`
|
|
- Prüfe, ob Namen exakt übereinstimmen (Groß-/Kleinschreibung!)
|
|
|
|
### Registry Login fehlgeschlagen
|
|
- Prüfe `REGISTRY_USER` und `REGISTRY_PASSWORD` Secrets
|
|
- Teste Registry: `curl -u admin:registry-secure-password-2025 http://127.0.0.1:5000/v2/_catalog`
|
|
|
|
### Deployment fehlgeschlagen
|
|
- Prüfe `SSH_PRIVATE_KEY` Secret
|
|
- Prüfe Ansible-Verbindung: `ssh deploy@94.16.110.151 "echo OK"`
|
|
- Prüfe Server-Logs
|
|
|
|
## 🎉 Nach erfolgreichem Test
|
|
|
|
Du kannst jetzt:
|
|
- ✅ Commits pushen → Automatisches Deployment
|
|
- ✅ Workflow manuell triggern für kontrollierte Deployments
|
|
- ✅ Branch-Protection aktivieren für sichere Deployments
|