# πŸ”§ Installazione Sistema Debug NetGescon ## πŸ“‹ Prerequisiti ### Software Richiesto - **PHP**: 8.2+ - **Laravel**: 11+ - **Node.js**: 18+ (per asset) - **Composer**: 2.0+ ### Permessi Sistema ```bash # Verifica permessi storage chmod -R 775 storage/ chmod -R 775 bootstrap/cache/ # Verifica proprietario chown -R www-data:www-data storage/ chown -R www-data:www-data bootstrap/cache/ ``` --- ## πŸš€ Installazione ### 1. File giΓ  presenti I file del sistema debug sono giΓ  installati in: ``` app/Debug/ # Sistema completo resources/views/admin/debug/ # Dashboard docs/debug/ # Documentazione ``` ### 2. Verifica Service Provider Il `DebugServiceProvider` Γ¨ registrato in `bootstrap/providers.php`: ```php return [ App\Providers\AppServiceProvider::class, App\Debug\DebugServiceProvider::class, // βœ… Presente ]; ``` ### 3. Verifica Route Le route debug sono in `routes/web.php`: ```php // Sistema Debug Route::prefix('debug')->name('debug.')->group(function () { Route::get('/', [App\Debug\Controllers\SystemDebugController::class, 'index']) ->name('index'); // ... altre route }); ``` ### 4. Test Comandi ```bash # Verifica comandi disponibili php artisan list | grep netgescon # Output atteso: # netgescon:debug Sistema di debug avanzato # netgescon:find-duplicates Trova e gestisce view duplicate ``` --- ## πŸ§ͺ Test Installazione ### 1. Test Console ```bash # Test base php artisan netgescon:debug --help # Test scansione veloce php artisan netgescon:debug --duplicates ``` ### 2. Test Dashboard Web ```bash # Avvia server php artisan serve # Visita dashboard # http://localhost:8000/admin/debug ``` ### 3. Test Permessi ```bash # Test scrittura log php artisan netgescon:debug --report # Verifica file creato ls -la storage/logs/netgescon_debug_*.json ``` --- ## βš™οΈ Configurazione ### 1. Variabili Ambiente Aggiungi a `.env`: ```bash # Debug avanzato DEBUG_SYSTEM_ENABLED=true DEBUG_AUTO_CLEAN=false DEBUG_BACKUP_KEEP_DAYS=30 ``` ### 2. Configurazione Laravel In `config/app.php`: ```php 'debug' => env('APP_DEBUG', false), // Prod: false 'log_level' => env('LOG_LEVEL', 'debug'), ``` ### 3. Personalizzazione Path Se usi directory personalizzate, modifica in `SystemAnalyzer.php`: ```php protected $directories = [ 'resources/views' => 'active', 'tua-directory-backup' => 'backup', // Personalizza ]; ``` --- ## πŸ” Sicurezza ### 1. Protezione Route Le route debug sono giΓ  protette: ```php Route::middleware(['role:admin|amministratore']) ->prefix('admin') ->group(function () { // Route debug qui }); ``` ### 2. Backup Directory ```bash # Crea directory backup sicura mkdir -p _DUPLICATES_MOVED/ chmod 750 _DUPLICATES_MOVED/ chown -R www-data:www-data _DUPLICATES_MOVED/ ``` ### 3. Log Rotation Configura in `/etc/logrotate.d/netgescon`: ``` /var/www/netgescon/storage/logs/*.log { daily rotate 30 compress delaycompress missingok notifempty create 644 www-data www-data } ``` --- ## 🚨 Troubleshooting Installazione ### Errore: "Class not found" ```bash # Rigenera autoload composer dump-autoload # Clear cache php artisan config:clear php artisan cache:clear ``` ### Errore: "Route not defined" ```bash # Verifica route esistenti php artisan route:list | grep debug # Clear route cache php artisan route:clear ``` ### Errore: "Permission denied" ```bash # Fix permessi sudo chown -R $USER:www-data storage/ sudo chmod -R 775 storage/ ``` ### Dashboard non carica 1. Verifica server attivo: `php artisan serve` 2. Controlla URL: `http://localhost:8000/admin/debug` 3. Verifica login come admin 4. Check log: `tail -f storage/logs/laravel.log` --- ## πŸ“Š Verifica Post-Installazione ### Checklist Completa - [ ] βœ… Service Provider registrato - [ ] βœ… Route debug funzionanti - [ ] βœ… Comandi console disponibili - [ ] βœ… Dashboard web accessibile - [ ] βœ… Permessi directory corretti - [ ] βœ… Log system scrivibile - [ ] βœ… Backup directory creata ### Test Funzionale ```bash #!/bin/bash echo "πŸ” Test Sistema Debug NetGescon" echo "1. Test comando base..." php artisan netgescon:debug --help > /dev/null && echo "βœ… OK" || echo "❌ FAIL" echo "2. Test scansione..." php artisan netgescon:debug --duplicates > /dev/null && echo "βœ… OK" || echo "❌ FAIL" echo "3. Test report..." php artisan netgescon:debug --report > /dev/null && echo "βœ… OK" || echo "❌ FAIL" echo "4. Test dashboard (richiede browser)..." curl -s http://localhost:8000/admin/debug > /dev/null && echo "βœ… OK" || echo "⚠️ Server offline" echo "πŸŽ‰ Installazione verificata!" ``` --- ## πŸ”„ Aggiornamenti ### Procedura Update ```bash # Backup configurazione cp -r app/Debug/ app/Debug_backup/ # Pull nuovi file (se da repository) git pull origin main # Aggiorna dipendenze composer dump-autoload # Clear cache php artisan config:clear php artisan view:clear # Test funzionamento php artisan netgescon:debug --scan ``` ### Versioning ``` v1.0 - Release iniziale con dashboard e comandi base v1.1 - Aggiunta report JSON e analytics v1.2 - Integrazione CI/CD e monitoraggio automatico ``` --- ## πŸ“ž Supporto ### In caso di problemi: 1. **Controlla log**: `storage/logs/laravel.log` 2. **Verifica configurazione**: `php artisan config:show` 3. **Test ambiente**: `php artisan about` 4. **Debug modalitΓ **: `APP_DEBUG=true` in `.env` ### Risorse utili: - πŸ“š Documentazione: `docs/debug/README.md` - πŸ› Debug log: `storage/logs/netgescon_debug_*.json` - πŸ”§ Test script: `docs/debug/test-installation.sh` --- **🎯 Sistema Debug installato e pronto all'uso!**