Files
michaelschiemer/.deployment-backup/ansible/netcup-simple-deploy/Makefile
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

137 lines
4.1 KiB
Makefile

# Test Makefile für rsync debugging (Fixed)
.PHONY: test-rsync debug-sync upload restart quick-deploy
# Teste manuellen rsync
test-rsync:
@echo "🔍 Testing manual rsync..."
@SERVER_IP=$$(grep ansible_host inventory/hosts.yml | awk '{print $$2}'); \
echo "Server IP: $$SERVER_IP"; \
APP_PATH=$$(grep local_app_path inventory/hosts.yml | awk '{print $$2}' | tr -d '"'); \
echo "Local path: $$APP_PATH"; \
echo ""; \
echo "=== Testing dry-run rsync ==="; \
rsync -av --dry-run \
--exclude='ansible' \
--exclude='.git' \
--exclude='vendor' \
--exclude='node_modules' \
--exclude='storage/logs' \
--exclude='cache' \
--exclude='logs' \
--exclude='dist' \
--exclude='.archive' \
$$APP_PATH/ root@$$SERVER_IP:/opt/myapp/; \
echo ""; \
echo "If this shows files, then rsync should work"
# Debug was in lokalen Dateien ist
debug-local:
@echo "📁 Local files debug:"
@APP_PATH=$$(grep local_app_path inventory/hosts.yml | awk '{print $$2}' | tr -d '"'); \
echo "Path: $$APP_PATH"; \
echo ""; \
if [ -z "$$APP_PATH" ]; then \
echo "❌ APP_PATH is empty!"; \
echo "Raw line from hosts.yml:"; \
grep local_app_path inventory/hosts.yml; \
exit 1; \
fi; \
echo "=== Root files ==="; \
ls -la "$$APP_PATH" | head -10; \
echo ""; \
echo "=== Public files ==="; \
ls -la "$$APP_PATH/public" | head -10; \
echo ""; \
echo "=== Does index.php exist locally? ==="; \
if [ -f "$$APP_PATH/public/index.php" ]; then \
echo "✅ index.php exists locally"; \
echo "Size: $$(wc -c < $$APP_PATH/public/index.php) bytes"; \
echo "Content preview:"; \
head -5 "$$APP_PATH/public/index.php"; \
else \
echo "❌ index.php NOT found locally!"; \
echo "Checking if public folder exists:"; \
if [ -d "$$APP_PATH/public" ]; then \
echo "Public folder exists, contents:"; \
ls -la "$$APP_PATH/public/"; \
else \
echo "Public folder does not exist!"; \
fi; \
fi
# Test direkt mit absoluten Pfaden
debug-direct:
@echo "📁 Direct path test:"
@echo "=== Current directory ==="
pwd
@echo ""
@echo "=== Going to project root ==="
cd ../.. && pwd
@echo ""
@echo "=== Files in project root ==="
cd ../.. && ls -la | head -10
@echo ""
@echo "=== Public folder ==="
cd ../.. && ls -la public/ | head -10
@echo ""
@echo "=== Index.php check ==="
cd ../.. && if [ -f "public/index.php" ]; then \
echo "✅ index.php found!"; \
echo "Size: $$(wc -c < public/index.php) bytes"; \
else \
echo "❌ index.php not found"; \
fi
# Test Ansible synchronize mit debug
debug-sync:
@echo "🔍 Testing Ansible synchronize with debug..."
ansible-playbook -i inventory/hosts.yml debug-sync.yml -v
# Upload files only (no infrastructure setup)
upload:
@echo "📤 Uploading files only..."
ansible-playbook -i inventory/hosts.yml upload-only.yml
# Restart application after upload
restart:
@echo "🔄 Restarting application..."
ansible-playbook -i inventory/hosts.yml restart-app.yml
# Quick upload and restart
quick-deploy:
@echo "⚡ Quick deploy: upload + restart..."
ansible-playbook -i inventory/hosts.yml upload-only.yml
ansible-playbook -i inventory/hosts.yml restart-app.yml
# Alle Standard-Befehle
deploy:
@echo "🚀 Deploying project to Netcup..."
chmod +x deploy.sh
./deploy.sh
check:
@echo "🔍 Testing configuration..."
ansible all -m ping
logs:
@echo "📋 Showing container logs..."
ansible all -m shell -a "cd /opt/myapp && (docker compose logs --tail 100 || docker-compose logs --tail 100)"
help:
@echo "📖 Debug commands:"
@echo " make debug-local - Check local files"
@echo " make debug-direct - Check with direct paths"
@echo " make test-rsync - Test manual rsync"
@echo " make debug-sync - Test Ansible sync"
@echo ""
@echo "📖 Deploy commands:"
@echo " make deploy - Full deployment (infrastructure + app)"
@echo " make upload - Upload files only (no infrastructure)"
@echo " make restart - Restart application containers"
@echo " make quick-deploy - Upload files + restart (fastest)"
@echo ""
@echo "📖 Utility commands:"
@echo " make logs - Show container logs"
@echo " make check - Test connection"