Files
michaelschiemer/deployment/DEPLOYMENT_COMMANDS.md
Michael Schiemer 16d586ecdf chore: Update deployment configuration and documentation
- Update Gitea configuration (remove DEFAULT_ACTIONS_URL)
- Fix deployment documentation
- Update Ansible playbooks
- Clean up deprecated files
- Add new deployment scripts and templates
2025-10-31 21:11:11 +01:00

3.4 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

📋 Alle verfügbaren Playbooks

Deployment & Updates

  • playbooks/deploy-update.yml - Deployt neues Docker Image
  • playbooks/sync-code.yml - Synchronisiert Code aus Git Repository
  • playbooks/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 Production
  • playbooks/setup-ssl-certificates.yml - SSL Certificate Setup
  • playbooks/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 all
    

VPN

  • playbooks/setup-wireguard.yml - WireGuard VPN Setup
  • playbooks/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


💡 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