- Replace git.michaelschiemer.de:5000 (HTTP) with registry.michaelschiemer.de (HTTPS) - Update all Ansible playbooks and configuration files - Update CI/CD workflows to use HTTPS registry endpoint - Update Docker Compose files with new registry URL - Update documentation and scripts Benefits: - Secure HTTPS connection (no insecure registry config needed) - Consistent use of HTTPS endpoint via Traefik - Better security practices for production deployment
6.3 KiB
6.3 KiB
Deployment System - Verbesserungsvorschläge
Erstellt: 2025-01-31
Status: Vorschläge zur Diskussion
🔍 Gefundene Redundanzen und Verbesserungsmöglichkeiten
1. ❌ Dokumentations-Redundanz
Problem:
- 38+ Markdown-Dateien im
deployment/unddocs/deployment/Verzeichnis - Viele veraltete Dokumentationsdateien in
docs/deployment/ - Überschneidende Inhalte zwischen mehreren Dateien
Konkrete Redundanzen:
DEPLOYMENT_SUMMARY.mdvsDEPLOYMENT-TODO.md(ähnliche Status-Übersichten)NATIVE-WORKFLOW-README.md(veraltet? bereits durch CI/CD Pipeline ersetzt)docs/deployment/*- Viele veraltete Guides (Swarm, alte Workflows, etc.)
Empfehlung:
# Dateien die gelöscht/archiviert werden könnten:
- deployment/NATIVE-WORKFLOW-README.md # Durch CI/CD Pipeline ersetzt
- docs/deployment/docker-swarm-deployment.md # Swarm nicht mehr verwendet
- docs/deployment/DEPLOYMENT_RESTRUCTURE.md # Historisch
- docs/deployment/* (viele veraltete Dateien)
Lösung:
- Dokumentation konsolidieren auf:
README.md- Haupt-DokumentationQUICK_START.md- SchnellstartDEPLOYMENT_COMMANDS.md- Command-ReferenzCODE_CHANGE_WORKFLOW.md- Workflow-DokumentationSETUP-GUIDE.md- Setup-Anleitung- Stack-spezifische READMEs in
stacks/*/README.md
2. ❌ Playbook-Redundanz: Troubleshooting Playbooks
Problem:
4 separate Playbooks für ähnliche Troubleshooting-Aufgaben:
check-container-health.yml- Prüft Health Statusdiagnose-404.yml- Diagnostiziert 404 Fehlerfix-container-health-checks.yml- Fixes Health Checksfix-nginx-404.yml- Fixes Nginx 404
Empfehlung:
Konsolidieren zu einem einzigen Playbook troubleshoot.yml mit Tags:
# deployment/ansible/playbooks/troubleshoot.yml
---
- name: Application Troubleshooting
hosts: production
gather_facts: yes
become: no
tasks:
- name: Check container health
include_tasks: tasks/check-health.yml
tags: ['health', 'check']
- name: Diagnose 404 errors
include_tasks: tasks/diagnose-404.yml
tags: ['404', 'diagnose']
- name: Fix container health checks
include_tasks: tasks/fix-health-checks.yml
tags: ['health', 'fix']
- name: Fix nginx 404
include_tasks: tasks/fix-nginx-404.yml
tags: ['nginx', '404', 'fix']
Verwendung:
# Nur Diagnose
ansible-playbook ... troubleshoot.yml --tags diagnose
# Nur Fix
ansible-playbook ... troubleshoot.yml --tags fix
# Alles
ansible-playbook ... troubleshoot.yml
Vorteile:
- Weniger Redundanz
- Einfacher zu warten
- Konsistente Struktur
3. ⚠️ Variablen-Redundanz
Problem:
Jedes Playbook definiert eigene Pfade:
# In vielen Playbooks:
vars:
app_stack_path: "{{ deploy_user_home }}/deployment/stacks/application"
stacks_base_path: "~/deployment/stacks"
Empfehlung:
Zentrale Variablendefinition in group_vars/production.yml:
# deployment/ansible/group_vars/production.yml
---
# Base paths
deploy_user_home: "~"
stacks_base_path: "{{ deploy_user_home }}/deployment/stacks"
app_stack_path: "{{ stacks_base_path }}/application"
backups_path: "{{ deploy_user_home }}/deployment/backups"
# Registry
docker_registry_url: "registry.michaelschiemer.de"
app_image: "{{ docker_registry_url }}/framework"
app_name: "framework"
# Health checks
health_check_url: "https://michaelschiemer.de/health"
max_rollback_versions: 5
Vorteile:
- Einmal definiert, überall verwendbar
- Einfacher zu ändern
- Konsistenz über alle Playbooks
4. ❓ Playbook: sync-stacks.yml
Problem:
sync-stacks.yml synchronisiert Stack-Dateien zu Production, aber:
setup-infrastructure.ymldeployed die Stacks bereits direkt- Wird wahrscheinlich nicht mehr benötigt?
Empfehlung:
Entweder:
- Löschen wenn nicht mehr verwendet
- Oder dokumentieren wann es noch gebraucht wird
5. ❓ Stack-Redundanz: postgres/ vs postgresql/
Problem:
Es gibt beide Ordner:
deployment/stacks/postgres/deployment/stacks/postgresql/
Einer scheint leer zu sein?
Empfehlung:
- Prüfen welcher verwendet wird
- Leeren Ordner löschen
- Konsistente Namensgebung verwenden
6. ✅ Playbook: WireGuard Dokumentation
Positiv:
WireGuard hat separate README (README-WIREGUARD.md) - das ist gut strukturiert!
Könnte als Vorbild dienen für andere komplexe Features.
7. ⚠️ Templates: Mehrfache .env Templates
Problem:
ansible/templates/application.env.j2ansible/templates/monitoring.env.j2- Gibt es weitere?
Empfehlung:
Template-Verzeichnis strukturieren:
ansible/templates/
├── env/
│ ├── application.env.j2
│ ├── monitoring.env.j2
│ └── ...
└── config/
├── wireguard-server.conf.j2
└── ...
8. ✅ Verbesserung: Zentrales Playbook für Common Tasks
Empfehlung:
Common Tasks als Reusable Roles/Tasks:
# deployment/ansible/roles/common/tasks/verify-stack.yml
---
- name: Verify stack directory exists
stat:
path: "{{ stack_path }}"
register: stack_dir
- name: Fail if stack directory doesn't exist
fail:
msg: "Stack directory not found at {{ stack_path }}"
when: not stack_dir.stat.exists
Verwendung in Playbooks:
- name: Verify application stack
include_role:
name: common
tasks_from: verify-stack
vars:
stack_path: "{{ app_stack_path }}"
Vorteile:
- DRY (Don't Repeat Yourself)
- Konsistenz
- Einfacher zu warten
📊 Priorisierte Empfehlungen
🔴 Hoch (sofort umsetzbar):
- Zentrale Variablen →
group_vars/production.yml - Dokumentation aufräumen → Veraltete Dateien löschen/archivieren
- Stack-Redundanz prüfen →
postgres/vspostgresql/
🟡 Mittel (bald umsetzen):
- Troubleshooting Playbooks konsolidieren → Ein Playbook mit Tags
- Common Tasks als Roles → Redundanz reduzieren
🟢 Niedrig (nice to have):
- Template-Struktur verbessern
- Playbook
sync-stacks.ymlprüfen → Ob noch benötigt
📝 Nächste Schritte
- ✅ Redundante Scripts entfernt
- ⏳ Dokumentation aufräumen
- ⏳ Zentrale Variablen erstellen
- ⏳ Troubleshooting Playbooks konsolidieren
Soll ich mit der Umsetzung beginnen?