- Add pre-flight checks in deploy-update.yml - Automatically copy docker-compose.yml and nginx config in setup-infrastructure.yml - Add comprehensive deployment documentation - Ready for automated code deployments via CI/CD pipeline
461 lines
13 KiB
Markdown
461 lines
13 KiB
Markdown
# Deployment Status - Gitea Actions Runner Setup
|
|
|
|
**Status**: ✅ Phase 3 Complete - Ready for Phase 1
|
|
**Last Updated**: 2025-10-31
|
|
**Target Server**: 94.16.110.151 (Netcup)
|
|
|
|
---
|
|
|
|
## Aktueller Status
|
|
|
|
### ✅ Phase 0: Git Repository SSH Access Setup - COMPLETE
|
|
|
|
1. ✅ Git SSH Key generiert (`~/.ssh/git_michaelschiemer`)
|
|
2. ✅ SSH Config konfiguriert für `git.michaelschiemer.de`
|
|
3. ✅ Public Key zu Gitea hinzugefügt
|
|
4. ✅ Git Remote auf SSH umgestellt
|
|
5. ✅ Push zu origin funktioniert ohne Credentials
|
|
|
|
### ✅ Phase 3: Production Server Initial Setup - COMPLETE
|
|
|
|
**Infrastructure Stacks deployed via Ansible:**
|
|
|
|
1. ✅ **Traefik** - Reverse Proxy & SSL (healthy)
|
|
- HTTPS funktioniert, Let's Encrypt SSL aktiv
|
|
- Dashboard: https://traefik.michaelschiemer.de
|
|
|
|
2. ✅ **PostgreSQL** - Database Stack (healthy)
|
|
- Database läuft und ist bereit
|
|
|
|
3. ✅ **Docker Registry** - Private Registry (running, accessible)
|
|
- Authentication konfiguriert
|
|
- Zugriff erfolgreich getestet
|
|
|
|
4. ✅ **Gitea** - Git Server (healthy)
|
|
- HTTPS erreichbar: https://git.michaelschiemer.de ✅
|
|
- SSH Port 2222 aktiv
|
|
- PostgreSQL Database verbunden
|
|
|
|
5. ✅ **Monitoring** - Monitoring Stack (deployed)
|
|
- Grafana: https://grafana.michaelschiemer.de
|
|
- Prometheus: https://prometheus.michaelschiemer.de
|
|
- Portainer: https://portainer.michaelschiemer.de
|
|
|
|
**Deployment Method:** Ansible Playbook `setup-infrastructure.yml`
|
|
**Deployment Date:** 2025-10-31
|
|
|
|
### ⏳ Phase 1: Gitea Runner Setup - READY TO START
|
|
|
|
**Prerequisites erfüllt:**
|
|
- ✅ Gitea deployed und erreichbar
|
|
- ✅ Runner-Verzeichnisstruktur vorhanden
|
|
- ✅ `.env.example` Template analysiert
|
|
- ✅ `.env` Datei erstellt
|
|
|
|
**Nächste Schritte:**
|
|
1. ⏳ Gitea Admin Panel öffnen: https://git.michaelschiemer.de/admin/actions/runners
|
|
2. ⏳ Actions in Gitea aktivieren (falls noch nicht geschehen)
|
|
3. ⏳ Registration Token abrufen
|
|
4. ⏳ Token in `.env` eintragen
|
|
5. ⏳ Runner registrieren und starten
|
|
|
|
---
|
|
|
|
## Dateistatus
|
|
|
|
### `/home/michael/dev/michaelschiemer/deployment/gitea-runner/.env`
|
|
|
|
**Status**: ✅ Erstellt (diese Session)
|
|
**Quelle**: Kopie von `.env.example`
|
|
**Problem**: `GITEA_RUNNER_REGISTRATION_TOKEN` ist leer
|
|
|
|
**Aktueller Inhalt**:
|
|
```bash
|
|
# Gitea Actions Runner Configuration
|
|
|
|
# Gitea Instance URL (must be accessible from runner)
|
|
GITEA_INSTANCE_URL=https://git.michaelschiemer.de
|
|
|
|
# Runner Registration Token (get from Gitea: Admin > Actions > Runners)
|
|
# To generate: Gitea UI > Site Administration > Actions > Runners > Create New Runner
|
|
GITEA_RUNNER_REGISTRATION_TOKEN= # ← LEER - BLOCKIERT durch 404
|
|
|
|
# Runner Name (appears in Gitea UI)
|
|
GITEA_RUNNER_NAME=dev-runner-01
|
|
|
|
# Runner Labels (comma-separated)
|
|
# Format: label:image
|
|
GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye,debian-latest:docker://debian:bullseye
|
|
|
|
# Optional: Custom Docker registry for job images
|
|
# DOCKER_REGISTRY_MIRROR=https://registry.michaelschiemer.de
|
|
|
|
# Optional: Runner capacity (max concurrent jobs)
|
|
# GITEA_RUNNER_CAPACITY=1
|
|
```
|
|
|
|
---
|
|
|
|
## Fehleranalyse: 404 auf Gitea Admin Panel
|
|
|
|
### Wahrscheinliche Ursachen (nach Priorität)
|
|
|
|
#### 1. Gitea noch nicht deployed ⚠️ **HÖCHSTE WAHRSCHEINLICHKEIT**
|
|
|
|
**Problem**: Phasen-Reihenfolge-Konflikt in SETUP-GUIDE.md
|
|
|
|
- Phase 1 erfordert Gitea erreichbar
|
|
- Phase 3 deployed Gitea auf Production Server
|
|
- Klassisches Henne-Ei-Problem
|
|
|
|
**Beweis**: SETUP-GUIDE.md Phase 3, Step 3.1 zeigt:
|
|
```markdown
|
|
# 4. Gitea (Git Server + MySQL + Redis)
|
|
cd ../gitea
|
|
docker compose up -d
|
|
docker compose logs -f
|
|
# Wait for "Listen: http://0.0.0.0:3000"
|
|
```
|
|
|
|
**Lösung**: Phase 3 VOR Phase 1 ausführen
|
|
|
|
#### 2. Gitea Actions Feature deaktiviert
|
|
|
|
**Problem**: Actions in `app.ini` nicht enabled
|
|
|
|
**Check benötigt**:
|
|
```bash
|
|
ssh deploy@94.16.110.151
|
|
cat ~/deployment/stacks/gitea/data/gitea/conf/app.ini | grep -A 5 "[actions]"
|
|
```
|
|
|
|
**Erwartetes Ergebnis**:
|
|
```ini
|
|
[actions]
|
|
ENABLED = true
|
|
```
|
|
|
|
#### 3. Falsche URL (andere Gitea Version)
|
|
|
|
**Mögliche alternative URLs**:
|
|
- `https://git.michaelschiemer.de/admin`
|
|
- `https://git.michaelschiemer.de/user/settings/actions`
|
|
- `https://git.michaelschiemer.de/admin/runners`
|
|
|
|
#### 4. Authentication/Authorization Problem
|
|
|
|
**Mögliche Ursachen**:
|
|
- User nicht eingeloggt in Gitea
|
|
- User hat keine Admin-Rechte
|
|
- Session abgelaufen
|
|
|
|
#### 5. Gitea Service nicht gestartet
|
|
|
|
**Check benötigt**:
|
|
```bash
|
|
ssh deploy@94.16.110.151
|
|
cd ~/deployment/stacks/gitea
|
|
docker compose ps
|
|
```
|
|
|
|
---
|
|
|
|
## Untersuchungsplan
|
|
|
|
### Step 1: Base Gitea Accessibility prüfen
|
|
|
|
```bash
|
|
# Test ob Gitea überhaupt läuft
|
|
curl -I https://git.michaelschiemer.de
|
|
```
|
|
|
|
**Erwartetes Ergebnis**:
|
|
- HTTP 200 → Gitea läuft
|
|
- Connection Error → Gitea nicht deployed
|
|
|
|
### Step 2: Browser Verification
|
|
|
|
1. `https://git.michaelschiemer.de` direkt öffnen
|
|
2. Homepage-Load verifizieren
|
|
3. Login-Status prüfen
|
|
4. Admin-Rechte verifizieren
|
|
|
|
### Step 3: Alternative Admin Panel URLs testen
|
|
|
|
```bash
|
|
# Try different paths
|
|
https://git.michaelschiemer.de/admin
|
|
https://git.michaelschiemer.de/user/settings/actions
|
|
https://git.michaelschiemer.de/admin/runners
|
|
```
|
|
|
|
### Step 4: Gitea Configuration prüfen (SSH benötigt)
|
|
|
|
```bash
|
|
ssh deploy@94.16.110.151
|
|
cat ~/deployment/stacks/gitea/data/gitea/conf/app.ini | grep -A 5 "\[actions\]"
|
|
```
|
|
|
|
### Step 5: Gitea Stack Status prüfen (SSH benötigt)
|
|
|
|
```bash
|
|
ssh deploy@94.16.110.151
|
|
cd ~/deployment/stacks/gitea
|
|
docker compose ps
|
|
docker compose logs gitea --tail 50
|
|
```
|
|
|
|
---
|
|
|
|
## Alternative Lösungsansätze
|
|
|
|
### Option A: Phasen-Reihenfolge ändern ⭐ **EMPFOHLEN**
|
|
|
|
**Ansatz**: Phase 3 zuerst ausführen, dann Phase 1
|
|
|
|
**Begründung**:
|
|
- Gitea muss deployed sein bevor Runner registriert werden kann
|
|
- Phase 3 deployed komplette Infrastructure (Traefik, PostgreSQL, Registry, **Gitea**, Monitoring)
|
|
- Danach kann Phase 1 normal durchgeführt werden
|
|
|
|
**Ablauf**:
|
|
1. Phase 3 komplett ausführen (Infrastructure deployment)
|
|
2. Gitea Accessibility verifizieren
|
|
3. Gitea Actions in UI enablen
|
|
4. Zurück zu Phase 1 für Runner Setup
|
|
5. Weiter mit Phasen 2, 4-8
|
|
|
|
### Option B: CLI-basierte Runner Registration
|
|
|
|
**Ansatz**: Runner über Gitea CLI registrieren statt Web UI
|
|
|
|
```bash
|
|
# Auf Production Server
|
|
ssh deploy@94.16.110.151
|
|
docker exec gitea gitea admin actions generate-runner-token
|
|
|
|
# Token zurück zu Dev Machine kopieren
|
|
# In .env eintragen
|
|
```
|
|
|
|
### Option C: Manual Token Generation
|
|
|
|
**Ansatz**: Token direkt in Gitea Database generieren (nur als letzter Ausweg)
|
|
|
|
**WARNUNG**: Nur verwenden wenn alle anderen Optionen fehlschlagen
|
|
|
|
---
|
|
|
|
## Docker-in-Docker Architektur (Referenz)
|
|
|
|
### Services
|
|
|
|
**gitea-runner**:
|
|
- Image: `gitea/act_runner:latest`
|
|
- Purpose: Hauptrunner-Service
|
|
- Volumes:
|
|
- `./data:/data` (Runner-Daten)
|
|
- `/var/run/docker.sock:/var/run/docker.sock` (Host Docker Socket)
|
|
- `./config.yaml:/config.yaml:ro` (Konfiguration)
|
|
- Environment: Variablen aus `.env` File
|
|
- Network: `gitea-runner` Bridge Network
|
|
|
|
**docker-dind**:
|
|
- Image: `docker:dind`
|
|
- Purpose: Isolierte Docker-Daemon für Job-Execution
|
|
- Privileged: `true` (benötigt für nested containerization)
|
|
- TLS: `DOCKER_TLS_CERTDIR=/certs`
|
|
- Volumes:
|
|
- `docker-certs:/certs` (TLS Zertifikate)
|
|
- `docker-data:/var/lib/docker` (Docker Layer Storage)
|
|
- Command: `dockerd --host=unix:///var/run/docker.sock --host=tcp://0.0.0.0:2376 --tlsverify`
|
|
|
|
### Networks
|
|
|
|
**gitea-runner** Bridge Network:
|
|
- Isoliert Runner-Infrastructure vom Host
|
|
- Secure TLS Communication zwischen Services
|
|
|
|
### Volumes
|
|
|
|
- `docker-certs`: Shared TLS Certificates für runner ↔ dind
|
|
- `docker-data`: Persistent Docker Layer Storage
|
|
|
|
---
|
|
|
|
## 8-Phasen Deployment Prozess (Übersicht)
|
|
|
|
### Phase 1: Gitea Runner Setup (Development Machine) - **⚠️ BLOCKIERT**
|
|
**Status**: Kann nicht starten wegen 404 auf Admin Panel
|
|
**Benötigt**: Gitea erreichbar und Actions enabled
|
|
|
|
### Phase 2: Ansible Vault Secrets Setup - **⏳ WARTET**
|
|
**Status**: Kann nicht starten bis Phase 1 komplett
|
|
**Tasks**:
|
|
- Vault Password erstellen (`.vault_pass`)
|
|
- `production.vault.yml` mit Secrets erstellen
|
|
- Encryption Keys generieren
|
|
- Vault File verschlüsseln
|
|
|
|
### Phase 3: Production Server Initial Setup - **⏳ KÖNNTE ZUERST AUSGEFÜHRT WERDEN**
|
|
**Status**: Sollte möglicherweise VOR Phase 1 ausgeführt werden
|
|
**Tasks**:
|
|
- SSH zu Production Server
|
|
- Deploy Infrastructure Stacks:
|
|
1. Traefik (Reverse Proxy & SSL)
|
|
2. PostgreSQL (Database)
|
|
3. Docker Registry (Private Registry)
|
|
4. **Gitea (Git Server + MySQL + Redis)** ← Benötigt für Phase 1!
|
|
5. Monitoring (Portainer + Grafana + Prometheus)
|
|
|
|
### Phase 4: Application Secrets Deployment - **⏳ WARTET**
|
|
**Status**: Wartet auf Phase 1-3
|
|
**Tasks**: Secrets via Ansible zu Production deployen
|
|
|
|
### Phase 5: Gitea CI/CD Secrets Configuration - **✅ ERLEDIGT**
|
|
**Status**: Wartet auf Phase 1-4
|
|
**Tasks**: Repository Secrets in Gitea konfigurieren
|
|
|
|
### Phase 6: First Deployment Test - **⏳ WARTET**
|
|
**Status**: Wartet auf Phase 1-5
|
|
**Tasks**: CI/CD Pipeline triggern und testen
|
|
|
|
### Phase 7: Monitoring & Health Checks - **⏳ WARTET**
|
|
**Status**: Wartet auf Phase 1-6
|
|
**Tasks**: Monitoring Tools konfigurieren und Alerting einrichten
|
|
|
|
### Phase 8: Backup & Rollback Testing - **⏳ WARTET**
|
|
**Status**: Wartet auf Phase 1-7
|
|
**Tasks**: Backup-Mechanismus und Rollback testen
|
|
|
|
---
|
|
|
|
## Empfohlener Nächster Schritt
|
|
|
|
### ⭐ Option A: Phase 3 zuerst ausführen (Empfohlen)
|
|
|
|
**Begründung**:
|
|
- Behebt die Grundursache (Gitea nicht deployed)
|
|
- Folgt logischer Abhängigkeitskette
|
|
- Erlaubt normalen Fortschritt durch alle Phasen
|
|
|
|
**Ablauf**:
|
|
```bash
|
|
# 1. SSH zu Production Server
|
|
ssh deploy@94.16.110.151
|
|
|
|
# 2. Navigate zu stacks
|
|
cd ~/deployment/stacks
|
|
|
|
# 3. Deploy Traefik
|
|
cd traefik
|
|
docker compose up -d
|
|
docker compose logs -f # Warten auf "Configuration loaded"
|
|
|
|
# 4. Deploy PostgreSQL
|
|
cd ../postgresql
|
|
docker compose up -d
|
|
docker compose logs -f # Warten auf "database system is ready"
|
|
|
|
# 5. Deploy Registry
|
|
cd ../registry
|
|
docker compose up -d
|
|
docker compose logs -f # Warten auf "listening on [::]:5000"
|
|
|
|
# 6. Deploy Gitea ← KRITISCH für Phase 1
|
|
cd ../gitea
|
|
docker compose up -d
|
|
docker compose logs -f # Warten auf "Listen: http://0.0.0.0:3000"
|
|
|
|
# 7. Deploy Monitoring
|
|
cd ../monitoring
|
|
docker compose up -d
|
|
docker compose logs -f
|
|
|
|
# 8. Verify all stacks
|
|
docker ps
|
|
|
|
# 9. Test Gitea Accessibility
|
|
curl -I https://git.michaelschiemer.de
|
|
```
|
|
|
|
**Nach Erfolg**:
|
|
1. Gitea Web UI öffnen: `https://git.michaelschiemer.de`
|
|
2. Initial Setup Wizard durchlaufen
|
|
3. Admin Account erstellen
|
|
4. Actions in Settings enablen
|
|
5. **Zurück zu Phase 1**: Jetzt kann Admin Panel erreicht werden
|
|
6. Registration Token holen
|
|
7. `.env` komplettieren
|
|
8. Runner registrieren und starten
|
|
|
|
---
|
|
|
|
## Technische Details
|
|
|
|
### Gitea Actions Architecture
|
|
|
|
**Components**:
|
|
- **act_runner**: Gitea's self-hosted runner (basiert auf nektos/act)
|
|
- **Docker-in-Docker**: Isolierte Job-Execution Environment
|
|
- **TLS Communication**: Secure runner ↔ dind via certificates
|
|
|
|
**Runner Registration**:
|
|
1. Generate Token in Gitea Admin Panel
|
|
2. Add Token zu `.env`: `GITEA_RUNNER_REGISTRATION_TOKEN=<token>`
|
|
3. Run `./register.sh` (registriert runner mit Gitea instance)
|
|
4. Start services: `docker compose up -d`
|
|
5. Verify in Gitea UI: Runner shows as "Idle" or "Active"
|
|
|
|
**Runner Labels**:
|
|
Define welche Execution Environments unterstützt werden:
|
|
```bash
|
|
GITEA_RUNNER_LABELS=ubuntu-latest:docker://node:16-bullseye,ubuntu-22.04:docker://node:16-bullseye,debian-latest:docker://debian:bullseye
|
|
```
|
|
|
|
Format: `label:docker://image`
|
|
|
|
---
|
|
|
|
## Dateireferenzen
|
|
|
|
### Wichtige Dateien
|
|
|
|
| Datei | Status | Beschreibung |
|
|
|-------|--------|--------------|
|
|
| `SETUP-GUIDE.md` | ✅ Vorhanden | Komplette 8-Phasen Deployment Anleitung (708 Zeilen) |
|
|
| `deployment/gitea-runner/.env.example` | ✅ Vorhanden | Template für Runner Configuration (23 Zeilen) |
|
|
| `deployment/gitea-runner/.env` | ✅ Erstellt | Active Configuration - **Token fehlt** |
|
|
| `deployment/gitea-runner/docker-compose.yml` | ✅ Vorhanden | Two-Service Architecture Definition (47 Zeilen) |
|
|
|
|
### Code Snippets Location
|
|
|
|
**Runner Configuration** (`.env`):
|
|
- Zeilen 1-23: Komplette Environment Variables Definition
|
|
- Zeile 8: `GITEA_RUNNER_REGISTRATION_TOKEN=` ← **KRITISCH: LEER**
|
|
|
|
**Docker Compose** (`docker-compose.yml`):
|
|
- Zeilen 4-20: `gitea-runner` Service Definition
|
|
- Zeilen 23-34: `docker-dind` Service Definition
|
|
- Zeilen 37-40: Network Configuration
|
|
- Zeilen 43-47: Volume Definitions
|
|
|
|
**Setup Guide** (SETUP-GUIDE.md):
|
|
- Zeilen 36-108: Phase 1 Komplette Anleitung
|
|
- Zeilen 236-329: Phase 3 Infrastructure Deployment (inkl. Gitea)
|
|
|
|
---
|
|
|
|
## Support Kontakte
|
|
|
|
**Bei Problemen**:
|
|
- Framework Issues: Siehe `docs/claude/troubleshooting.md`
|
|
- Gitea Documentation: https://docs.gitea.io/
|
|
- act_runner Documentation: https://docs.gitea.io/en-us/usage/actions/act-runner/
|
|
|
|
---
|
|
|
|
**Erstellt**: 2025-10-30
|
|
**Letzte Änderung**: 2025-10-30
|
|
**Status**: BLOCKED - Awaiting Gitea Deployment (Phase 3)
|