@@ -300,6 +300,76 @@ time make validate-config
300300** What This Verifies** : Generated configuration files are syntactically correct
301301and ready for deployment.
302302
303+ ## Step 1.8: Clean Application Storage (Optional but Recommended)
304+
305+ ⚠️ ** DESTRUCTIVE OPERATION WARNING** : This step permanently deletes all
306+ application data including:
307+
308+ - ** Database data** (MySQL databases, user accounts, torrents)
309+ - ** SSL certificates** (Let's Encrypt certificates, private keys)
310+ - ** Configuration files** (tracker.toml, prometheus.yml, etc.)
311+ - ** Application logs** and persistent data
312+
313+ ** When to use this step** :
314+
315+ - ✅ Starting completely fresh integration test
316+ - ✅ Previous test left corrupted data
317+ - ✅ Database schema changes require clean slate
318+ - ✅ SSL certificate issues need reset
319+ - ❌ ** NEVER** on production systems
320+
321+ ### 1.8.1 Remove Application Storage
322+
323+ ``` bash
324+ # [PROJECT_ROOT] Remove all application storage (DESTRUCTIVE!)
325+ echo " === WARNING: About to delete all application data ==="
326+ echo " This will permanently remove:"
327+ echo " - Database data (MySQL)"
328+ echo " - SSL certificates"
329+ echo " - Configuration files"
330+ echo " - Application logs"
331+ echo " "
332+ read -p " Are you sure you want to continue? (type 'yes' to confirm): " confirm
333+
334+ if [ " $confirm " = " yes" ]; then
335+ echo " Removing application storage..."
336+ rm -rf application/storage/
337+ echo " ✅ Application storage deleted"
338+ else
339+ echo " ❌ Operation cancelled"
340+ fi
341+ ```
342+
343+ ** Alternative non-interactive approach** :
344+
345+ ``` bash
346+ # [PROJECT_ROOT] Force remove without confirmation (use carefully!)
347+ rm -rf application/storage/
348+ echo " ✅ Application storage deleted"
349+ ```
350+
351+ ### 1.8.2 Verify Storage Cleanup
352+
353+ ``` bash
354+ # [PROJECT_ROOT] Verify storage folder is gone
355+ ls -la application/storage/ 2> /dev/null && \
356+ echo ' ❌ Storage folder still exists!' || echo ' ✅ Storage folder removed'
357+
358+ # [PROJECT_ROOT] Verify Docker volumes are clean (if Docker is running)
359+ docker volume ls | grep torrust-tracker-demo && \
360+ echo ' ❌ Docker volumes still exist!' || echo ' ✅ No Docker volumes remain'
361+ ```
362+
363+ ** Expected Output** : Both checks should show "✅" (clean state).
364+
365+ ** What This Achieves** : Ensures a completely clean application state for testing,
366+ preventing issues caused by:
367+
368+ - Corrupted database data from previous tests
369+ - Expired or invalid SSL certificates
370+ - Configuration conflicts from previous deployments
371+ - Stale application logs affecting debugging
372+
303373---
304374
305375## Step 2: Deploy Fresh Virtual Machine
@@ -1240,11 +1310,10 @@ VM_IP=$(cd infrastructure/terraform && tofu output -raw vm_ip)
12401310curl -s http://$VM_IP /api/health_check | jq .
12411311
12421312# Test stats (auth required)
1243- TOKEN=" local-dev-admin-token-12345"
1244- curl -s " http://$VM_IP /api/v1/stats?token=$TOKEN " | jq .
1313+ curl -s " http://$VM_IP /api/v1/stats?token=local-dev-admin-token-12345" | jq .
12451314
12461315# Test specific metrics with jq filtering
1247- curl -s " http://$VM_IP /api/v1/stats?token=$TOKEN " | jq ' .torrents, .seeders'
1316+ curl -s " http://$VM_IP /api/v1/stats?token=local-dev-admin-token-12345 " | jq ' .torrents, .seeders, .leechers '
12481317```
12491318
12501319#### ✅ Monitoring Service Testing
0 commit comments