Files
michaelschiemer/deployment/docs/guides/quick-start.md
Michael Schiemer 36ef2a1e2c
Some checks failed
🚀 Build & Deploy Image / Determine Build Necessity (push) Failing after 10m14s
🚀 Build & Deploy Image / Build Runtime Base Image (push) Has been skipped
🚀 Build & Deploy Image / Build Docker Image (push) Has been skipped
🚀 Build & Deploy Image / Run Tests & Quality Checks (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Staging (push) Has been skipped
🚀 Build & Deploy Image / Auto-deploy to Production (push) Has been skipped
Security Vulnerability Scan / Check for Dependency Changes (push) Failing after 11m25s
Security Vulnerability Scan / Composer Security Audit (push) Has been cancelled
fix: Gitea Traefik routing and connection pool optimization
- Remove middleware reference from Gitea Traefik labels (caused routing issues)
- Optimize Gitea connection pool settings (MAX_IDLE_CONNS=30, authentication_timeout=180s)
- Add explicit service reference in Traefik labels
- Fix intermittent 504 timeouts by improving PostgreSQL connection handling

Fixes Gitea unreachability via git.michaelschiemer.de
2025-11-09 14:46:15 +01:00

4.8 KiB

Quick Start Guide - Deployment & CI/CD

🚀 Schnellstart: Code deployen

Initial Deployment (Einmalig - erstes Setup)

Für erstes Setup des Servers:

# 1. Code synchronisieren (Rsync)
cd deployment/ansible
ansible-playbook -i inventory/production.yml \
  playbooks/sync-application-code.yml \
  --vault-password-file secrets/.vault_pass

# 2. Composer Dependencies installieren
ansible-playbook -i inventory/production.yml \
  playbooks/install-composer-dependencies.yml \
  --vault-password-file secrets/.vault_pass

# 3. Application Stack deployen
ansible-playbook -i inventory/production.yml \
  playbooks/setup-infrastructure.yml \
  --tags application \
  --vault-password-file secrets/.vault_pass

Siehe auch: Initial Deployment Guide

Normal Deployment (CI/CD)

Für zukünftige Deployments:

# 1. Code ändern
# ... Dateien bearbeiten ...

# 2. Committen
git add .
git commit -m "feat: Add new feature"

# 3. Pushen → Automatisches Deployment!
git push origin main

Das war's! Die Pipeline läuft automatisch (~8-15 Minuten).


📋 Status-Übersicht

Vollständig konfiguriert

  • CI/CD Pipeline - Automatisches Deployment bei Push zu main
  • Gitea Runner - Läuft und ist registriert
  • Secrets - Alle kritischen Secrets konfiguriert
  • Application Stack - Integration in setup-infrastructure.yml
  • Ansible Playbooks - Deployment & Rollback vorhanden

⚠️ Ausstehend

  • Pipeline testen - End-to-End Test durchführen
  • Backup-Scripts - Backup-Playbook erstellen
  • Dokumentation vervollständigen - Finale Updates

🔍 Pipeline-Status prüfen

Nach einem Push

Gitea Actions UI:

https://git.michaelschiemer.de/michael/michaelschiemer/actions

Status-Anzeigen:

  • 🟢 Grüner Haken = Erfolgreich
  • 🔴 Roter Haken = Fehlgeschlagen
  • 🟡 Gelber Kreis = Läuft gerade

Logs ansehen:

  1. Klicke auf den Workflow-Run
  2. Klicke auf Job (z.B. "Deploy to Production Server")
  3. Klicke auf Step (z.B. "Deploy via Ansible")
  4. Logs ansehen

Application-Status prüfen

# SSH zum Production-Server
ssh deploy@94.16.110.151

# Container-Status
cd ~/deployment/stacks/production
docker compose ps

# Logs ansehen
docker compose logs app

# Health-Check
curl https://michaelschiemer.de/health

📚 Vollständige Dokumentation

Deployment-Dokumentation

  • CODE_CHANGE_WORKFLOW.md - Wie Codeänderungen gepusht werden
  • APPLICATION_STACK_DEPLOYMENT.md - Detaillierter Deployment-Ablauf
  • CI_CD_STATUS.md - CI/CD Pipeline Status & Checkliste
  • DEPLOYMENT-TODO.md - Aktuelle TODO-Liste

Setup-Dokumentation

  • docs/guides/setup-guide.md - Kompletter Setup-Guide
  • ansible/README.md - Ansible Playbooks Dokumentation
  • stacks/production/README.md - Application Stack Details

Workflow-Dokumentation

  • .gitea/workflows/production-deploy.yml - Haupt-Deployment-Pipeline
  • .gitea/workflows/TEST_WORKFLOW.md - Workflow-Test-Anleitung

🎯 Nächste Schritte

1. Pipeline testen (Empfohlen)

Option A: Test-Commit pushen

# Kleine Änderung
echo "# Test" >> README.md
git add README.md
git commit -m "test: CI/CD pipeline test"
git push origin main

Option B: Workflow manuell triggern

https://git.michaelschiemer.de/michael/michaelschiemer/actions
→ "Production Deployment Pipeline"
→ "Run workflow"

2. Backup-Scripts erstellen

# Backup-Playbook erstellen
cd deployment/ansible/playbooks
# → Erstelle backup.yml

3. Dokumentation finalisieren

  • Finale Updates in DEPLOYMENT-STATUS.md
  • README aktualisieren

🆘 Troubleshooting

Pipeline schlägt fehl

Tests fehlgeschlagen:

# Tests lokal ausführen
./vendor/bin/pest
composer cs
make phpstan

Build fehlgeschlagen:

# Docker Build lokal testen
docker build -f Dockerfile.production -t test .

Deployment fehlgeschlagen:

# Logs prüfen
ssh deploy@94.16.110.151 "cd ~/deployment/stacks/production && docker compose logs"

# Manueller Rollback
cd deployment/ansible
ansible-playbook -i inventory/production.yml playbooks/rollback.yml

Runner-Probleme

# Runner-Status prüfen
cd deployment/gitea-runner
docker compose ps
docker compose logs gitea-runner

# Runner neu starten
docker compose restart gitea-runner

📞 Support

Dokumentation:

  • deployment/README.md - Haupt-Dokumentation
  • deployment/CI_CD_STATUS.md - CI/CD Details
  • deployment/CODE_CHANGE_WORKFLOW.md - Workflow-Guide

Gitea:

  • Actions: https://git.michaelschiemer.de/michael/michaelschiemer/actions
  • Runners: https://git.michaelschiemer.de/admin/actions/runners

Ready to deploy! 🚀