mirror of
https://github.com/complexcaresolutions/documentation.git
synced 2026-03-17 15:13:54 +00:00
3.7 KiB
3.7 KiB
Deployment-Strategie: Dev → Production
Erstellt: 27. Dezember 2025 | Aktualisiert: 29. Dezember 2025
Zusammenfassung
Diese Strategie gewährleistet fehlerfreie Deployments durch:
- Automatisierte CI/CD Pipeline mit obligatorischen Tests
- Staging-first-Ansatz - Änderungen müssen auf Staging erfolgreich sein
- Pre-deployment Backup - Automatische Datenbank-Sicherung
- Health Checks - Automatische Verifizierung nach Deployment
- Rollback-Mechanismus - Schnelle Wiederherstellung bei Fehlern
Umgebungen
| Umgebung | Server | URL | Branch | Zweck |
|---|---|---|---|---|
| Development | sv-payload (LXC 700) | https://pl.porwoll.tech | develop |
Entwicklung & Testing |
| Production | Hetzner 3 | https://cms.c2sgmbh.de | main |
Live-System |
Phase 1: Development & Testing (develop)
git checkout develop
git add . && git commit -m "feat: your feature"
git push origin develop
- Push auf develop: ESLint, Build Test, Auto-Deploy zu Staging
- Pull Request: Volle Test-Suite inkl. E2E
Phase 2: Production Deployment (main)
Via GitHub Actions (Empfohlen)
git checkout main && git merge develop && git push origin main
gh workflow run deploy-production.yml
Optionen: skip_tests, skip_backup, skip_migrations, deploy_tag
Via Deploy-Script
ssh payload@162.55.85.18
cd ~/payload-cms
./scripts/deploy-production.sh
./scripts/deploy-production.sh --rollback # Rollback
./scripts/deploy-production.sh --dry-run # Dry-Run
Schema-Synchronisation
pnpm payload migrate # Payload-Migrationen
pnpm exec drizzle-kit push --force # Schema-Sync
Best Practices
- Nach Collection-Änderungen:
pnpm payload migrate:createauf DEV - Migrations committen:
git add src/migrations/ - Vor Deployment testen:
./scripts/sync-schema.sh --dry-run
Rollback-Strategie
# Automatischer Rollback
./scripts/deploy-production.sh --rollback
# Zu spezifischem Commit
git log --oneline -10
git reset --hard <commit-sha>
pnpm install --frozen-lockfile && pnpm build
pm2 restart payload
# Datenbank-Rollback
gunzip -c ~/backups/pre-deploy/payload_db_*.sql.gz | psql -U payload -d payload_db
Pre-Deployment Checkliste
- CI-Tests auf develop erfolgreich
- Staging-Deployment erfolgreich
- Features auf Staging manuell getestet
- Keine offenen kritischen Bugs
- develop in main gemergt
- Bei DB-Änderungen: Migration auf Staging getestet
GitHub Actions Workflows
| Workflow | Trigger | Geschätzte Dauer |
|---|---|---|
| CI (Push) | Push develop | ~3 Min |
| CI (PR) | Pull Request | ~15 Min |
| Security | PR + Wöchentlich | ~5 Min |
| Deploy Staging | Push develop | ~5 Min |
| Deploy Production | Manual | ~8 Min |
Geschätzte monatliche Nutzung: ~255 Min (von 2.000 kostenlos)
Dateien
| Datei | Beschreibung |
|---|---|
.github/workflows/ci.yml |
CI Pipeline |
.github/workflows/security.yml |
Security Scanning |
.github/workflows/deploy-staging.yml |
Staging-Deployment |
.github/workflows/deploy-production.yml |
Production-Deployment |
scripts/deploy-staging.sh |
Manuelles Staging-Script |
scripts/deploy-production.sh |
Manuelles Production-Script |
ecosystem.config.cjs |
PM2 Konfiguration |
Best Practices
Do's
- Immer erst auf Staging testen
- Backups vor kritischen Änderungen
- Kleine, inkrementelle Deployments
- Rollback-Plan vorbereiten
Don'ts
- Nie direkt auf main entwickeln
- Nie ohne Tests deployen
- Nie große Schema-Änderungen ohne Backup
- Nie am Freitag Nachmittag deployen
Dokumentation: Complex Care Solutions GmbH | 27.12.2025