- Fix upstream configuration in staging-nginx container - Verbessere sed-Befehle zur automatischen Korrektur der PHP-FPM Upstream-Definition - Behebt 502 Bad Gateway Fehler durch korrekte Verbindung zu staging-app:9000
3.6 KiB
3.6 KiB
Deployment Commands - Quick Reference
Alle Deployment-Operationen werden über Ansible Playbooks durchgeführt.
🚀 Häufig verwendete Commands
Code deployen (Image-basiert)
cd deployment/ansible
ansible-playbook -i inventory/production.yml \
playbooks/deploy-update.yml \
-e "image_tag=abc1234-1696234567" \
-e "git_commit_sha=$(git rev-parse HEAD)"
Code synchen (Git-basiert)
cd deployment/ansible
ansible-playbook -i inventory/production.yml \
playbooks/sync-code.yml \
-e "git_branch=main"
Rollback zu vorheriger Version
cd deployment/ansible
ansible-playbook -i inventory/production.yml \
playbooks/rollback.yml
Infrastructure Setup (einmalig)
cd deployment/ansible
ansible-playbook -i inventory/production.yml \
playbooks/setup-infrastructure.yml
System Maintenance (regelmäßig)
cd deployment/ansible
ansible-playbook -i inventory/production.yml \
playbooks/system-maintenance.yml
📋 Alle verfügbaren Playbooks
Deployment & Updates
playbooks/deploy-update.yml- Deployt neues Docker Imageplaybooks/sync-code.yml- Synchronisiert Code aus Git Repositoryplaybooks/rollback.yml- Rollback zu vorheriger Version
Infrastructure Setup
playbooks/setup-infrastructure.yml- Deployed alle Stacks (Traefik, PostgreSQL, Registry, Gitea, Monitoring, Application)playbooks/setup-production-secrets.yml- Deployed Secrets zu Productionplaybooks/setup-ssl-certificates.yml- SSL Certificate Setupplaybooks/sync-stacks.yml- Synchronisiert Stack-Konfigurationen
Troubleshooting & Maintenance
playbooks/troubleshoot.yml- Unified Troubleshooting Playbook mit Tags# Nur Diagnose ansible-playbook ... troubleshoot.yml --tags diagnose # Health Check prüfen ansible-playbook ... troubleshoot.yml --tags health,check # Health Checks fixen ansible-playbook ... troubleshoot.yml --tags health,fix # Nginx 404 fixen ansible-playbook ... troubleshoot.yml --tags nginx,404,fix # Alles ausführen ansible-playbook ... troubleshoot.yml --tags allplaybooks/system-maintenance.yml- Führt Paket-Updates, Unattended-Upgrades und optional Docker-Pruning aus
VPN
playbooks/setup-wireguard.yml- WireGuard VPN Setupplaybooks/add-wireguard-client.yml- WireGuard Client hinzufügen
CI/CD
playbooks/setup-gitea-runner-ci.yml- Gitea Runner CI Setup
🔧 Ansible Variablen
Häufig verwendete Extra Variables
# Image Tag für Deployment
-e "image_tag=abc1234-1696234567"
# Git Branch für Code Sync
-e "git_branch=main"
-e "git_repo_url=https://git.michaelschiemer.de/michael/michaelschiemer.git"
# Registry Credentials (wenn nicht im Vault)
-e "docker_registry_username=admin"
-e "docker_registry_password=secret"
# Dry Run (Check Mode)
--check
# Verbose Output
-v # oder -vv, -vvv für mehr Details
📖 Vollständige Dokumentation
- README.md - Haupt-Dokumentation
- quick-start.md - Schnellstart-Guide
- code-change-workflow.md - Codeänderungen workflow
💡 Tipps
Vault Passwort setzen
export ANSIBLE_VAULT_PASSWORD_FILE=~/.ansible/vault_pass
# oder
ansible-playbook ... --vault-password-file ~/.ansible/vault_pass
Nur bestimmte Tasks ausführen
ansible-playbook ... --tags "deploy,restart"
Check Mode (Dry Run)
ansible-playbook ... --check --diff
Inventory prüfen
ansible -i inventory/production.yml production -m ping