Files
michaelschiemer/.deployment-backup/x_ansible/playbooks/deploy/production.yml
Michael Schiemer 9b74ade5b0 feat: Fix discovery system critical issues
Resolved multiple critical discovery system issues:

## Discovery System Fixes
- Fixed console commands not being discovered on first run
- Implemented fallback discovery for empty caches
- Added context-aware caching with separate cache keys
- Fixed object serialization preventing __PHP_Incomplete_Class

## Cache System Improvements
- Smart caching that only caches meaningful results
- Separate caches for different execution contexts (console, web, test)
- Proper array serialization/deserialization for cache compatibility
- Cache hit logging for debugging and monitoring

## Object Serialization Fixes
- Fixed DiscoveredAttribute serialization with proper string conversion
- Sanitized additional data to prevent object reference issues
- Added fallback for corrupted cache entries

## Performance & Reliability
- All 69 console commands properly discovered and cached
- 534 total discovery items successfully cached and restored
- No more __PHP_Incomplete_Class cache corruption
- Improved error handling and graceful fallbacks

## Testing & Quality
- Fixed code style issues across discovery components
- Enhanced logging for better debugging capabilities
- Improved cache validation and error recovery

Ready for production deployment with stable discovery system.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 12:04:17 +02:00

99 lines
2.7 KiB
YAML

- name: Deployment für PRODUCTION
hosts: production
become: true
gather_facts: false
vars:
docker_compose_project_path: "/var/www/www.michaelschiemer.de/"
env_file_path: "/var/www/www.michaelschiemer.de/.env"
deploy_root: /var/www/www.michaelschiemer.de
deploy_public: "{{ deploy_root }}/public"
deploy_user: deploy
app_domain: "michaelschiemer.de"
project_root: "{{ playbook_dir }}/../.."
roles:
- app
- nginx
- php
- redis
---
# Produktions-Deployment
# Dieses Playbook steuert das Deployment in die Produktionsumgebung
- name: Deployment für PRODUKTIONS-Umgebung
hosts: production
become: true
gather_facts: true
# Vorbereitung des Deployments
pre_tasks:
- name: Prüfe Verbindung zum Produktionsserver
ping:
register: ping_result
tags: [always, check]
- name: Zeige Serverinformationen
debug:
msg: "Verbunden mit {{ inventory_hostname }} ({{ ansible_host }})"
tags: [always, check]
- name: Sicherung der aktuellen Anwendung erstellen
shell: |
timestamp=$(date +%Y%m%d_%H%M%S)
mkdir -p {{ deploy_root }}_backups
tar -czf {{ deploy_root }}_backups/backup_$timestamp.tar.gz -C {{ deploy_root }} . || true
tags: [backup]
# Rollen für die Basiseinrichtung des Servers
roles:
- docker
- app
- nginx
- php
- redis
# Haupttasks für das Deployment
tasks:
- name: Synchronisiere Anwendungsdateien
synchronize:
src: "{{ project_source }}/"
dest: "{{ deploy_root }}/"
delete: yes
rsync_opts:
- "--exclude=.git/"
- "--exclude=node_modules/"
- "--exclude=vendor/"
- "--exclude=.env.local"
tags: [sync, files]
- name: Wende modulare Deployment-Tasks an
import_tasks: ../deploy/includes/deploy_common.yml
tags: [deploy]
# Nachbereitung nach dem Deployment
post_tasks:
- name: Prüfe Anwendungsstatus
uri:
url: "https://{{ app_domain }}/"
return_content: no
status_code: 200, 301, 302, 403
validate_certs: yes
register: app_status
ignore_errors: yes
delegate_to: localhost
tags: [check]
- name: Zeige Anwendungsstatus
debug:
msg: "Anwendung ist {% if app_status.status == 200 %}verfügbar{% else %}nicht verfügbar (Status: {{ app_status.status | default('unbekannt') }}){% endif %}"
tags: [check]
- name: Benachrichtigung über abgeschlossenes Deployment
debug:
msg: "Deployment in Produktionsumgebung abgeschlossen"
tags: [always, notify]
tasks:
- name: Common Deployment Tasks
import_tasks: ../deploy/includes/deploy_common.yml