devex recovery & rollback
Diagnose problems, repair installations, and rollback changes
devex recovery & rollback
The recovery and rollback commands provide comprehensive tools for diagnosing problems, repairing broken installations, and reverting changes when something goes wrong. These commands are essential for maintaining a healthy development environment.
devex recovery
Diagnose and repair problems in your development environment.
Usage
devex recovery <subcommand> [flags]Recovery Subcommands
check
Comprehensive system health check and diagnostics
repair
Automatically fix common issues
clean
Clean up broken installations and cache
doctor
Interactive problem diagnosis and resolution
devex recovery check
Perform a comprehensive health check of your development environment.
Usage
devex recovery check [flags]Options
| Flag | Type | Default | Description |
|---|---|---|---|
--verbose | bool | false | Show detailed diagnostic information |
--fix | bool | false | Automatically fix issues found |
--report | string | Save diagnostic report to file | |
--category | string | all | Check specific category only |
Health Check Output
devex recovery check
System Health Check Results:
┌─────────────────────┬─────────┬─────────────────────────────┐
│ Component │ Status │ Issues │
├─────────────────────┼─────────┼─────────────────────────────┤
│ Package Managers │ ✓ │ All working correctly │
│ Installed Apps │ ⚠ │ 2 apps need attention │
│ Dependencies │ ✓ │ All dependencies met │
│ Services │ ✗ │ PostgreSQL not running │
│ Permissions │ ⚠ │ Docker group membership │
│ Configuration │ ✓ │ Valid configuration │
│ Disk Space │ ✓ │ 45% used (sufficient) │
│ Network │ ✓ │ All repositories accessible │
└─────────────────────┴─────────┴─────────────────────────────┘
Summary: 5 OK, 2 Warnings, 1 Error
Critical Issues:
✗ PostgreSQL service not running
→ Fix: sudo systemctl start postgresql
Warnings:
⚠ User not in docker group (requires logout/login)
→ Fix: sudo usermod -aG docker $USER
⚠ VS Code extensions need update
→ Fix: code --install-extension ms-python.python
Run 'devex recovery check --fix' to automatically resolve fixable issuesdevex recovery repair
Automatically repair common issues in your development environment.
Usage
devex recovery repair [flags]Options
| Flag | Type | Default | Description |
|---|---|---|---|
--app | string[] | Repair specific applications | |
--service | string[] | Repair specific services | |
--permissions | bool | false | Fix permission issues |
--reinstall | bool | false | Reinstall broken applications |
--dry-run | bool | false | Show what would be repaired |
Repair Categories
devex recovery repair --service postgresql,docker
Repairing Services:
🔧 PostgreSQL:
✓ Starting postgresql.service
✓ Enabling auto-start
✓ Checking configuration files
✓ Testing database connection
✓ Service repair completed
🔧 Docker:
✓ Starting docker.service
✓ Checking socket permissions
✓ Testing Docker daemon connection
⚠ User group membership required
→ Added user to docker group
→ Logout/login required
✓ Service repair completed
Summary: 2 services repaired successfullydevex recovery clean
Clean up broken installations, cache, and temporary files.
Usage
devex recovery clean [flags]Options
| Flag | Type | Default | Description |
|---|---|---|---|
--cache | bool | true | Clean package manager caches |
--broken | bool | true | Remove broken installations |
--logs | bool | false | Clean old log files |
--temp | bool | false | Clean temporary files |
--aggressive | bool | false | Perform deep cleaning |
Clean Operations
Cache Cleanup
devex recovery clean --cache
Cleaning Package Caches:
✓ APT cache: Freed 245MB
✓ Flatpak cache: Freed 67MB
✓ Snap cache: Freed 123MB
✓ mise cache: Freed 89MB
✓ DevEx cache: Freed 34MB
Total space freed: 558MBBroken Installation Cleanup
devex recovery clean --broken
Removing Broken Installations:
✓ Removed incomplete Slack installation
✓ Cleaned up failed Docker Compose install
✓ Removed orphaned configuration files
✓ Fixed broken symlinks
Summary: 4 broken installations cleanedDeep Cleaning (Aggressive)
devex recovery clean --aggressive
Performing Deep Cleanup:
✓ Removed unused packages (autoremove)
✓ Cleaned old kernel versions
✓ Removed orphaned dependencies
✓ Cleaned application logs older than 30 days
✓ Removed temporary download files
✓ Compacted package databases
Total space freed: 1.2GBdevex recovery doctor
Interactive diagnosis and resolution of complex problems.
Usage
devex recovery doctor [flags]The doctor command provides an interactive session to diagnose and resolve issues:
Initial Diagnosis
DevEx Doctor - Interactive Problem Resolution
🏥 Running initial diagnosis...
Found 3 potential issues:
1. Docker service not responding
2. Node.js version mismatch
3. PostgreSQL connection refused
Let's work through these one by one.Issue-by-Issue Resolution
Issue 1: Docker service not responding
Symptoms:
- docker commands hang
- Cannot connect to Docker daemon
- Service appears running but unresponsive
Possible causes:
1. Service stuck in unhealthy state
2. Permission issues with socket
3. Out of disk space
4. Corrupted Docker data
What would you like to try first?
[1] Restart Docker service
[2] Check disk space
[3] Reset Docker data (destructive)
[4] Check permissions
[q] Skip this issue
Choice: 1
🔧 Restarting Docker service...
✓ Stopped docker.service
✓ Started docker.service
✓ Testing Docker daemon...
✓ Docker is now responding correctly!
Issue resolved! Moving to next issue...Resolution Summary
DevEx Doctor Session Complete
Issues Resolved:
✅ Docker service - Restarted successfully
✅ Node.js version - Updated to LTS via mise
✅ PostgreSQL connection - Started service and fixed permissions
Summary:
- 3 issues identified
- 3 issues resolved
- 0 issues require manual intervention
Your development environment is now healthy!
💡 Recommendations:
- Run 'devex status' to verify all applications
- Consider setting up automatic service monitoring
- Create a backup of your working configurationdevex rollback
Rollback recent changes to restore a previous working state.
Usage
devex rollback [flags]Options
| Flag | Type | Default | Description |
|---|---|---|---|
--to | string | Rollback to specific backup or timestamp | |
--steps | int | 1 | Number of operations to rollback |
--dry-run | bool | false | Show what would be rolled back |
--interactive | bool | true | Prompt for confirmation |
Rollback Operations
devex rollback
Recent Changes (last 24 hours):
┌────┬─────────────────────┬─────────────────┬─────────────────────┐
│ ID │ Operation │ Files Changed │ Timestamp │
├────┼─────────────────────┼─────────────────┼─────────────────────┤
│ 1 │ add docker kubectl │ applications │ 2024-08-17 14:30:00 │
│ 2 │ template apply │ all configs │ 2024-08-17 13:15:00 │
│ 3 │ config edit │ environment │ 2024-08-17 12:00:00 │
└────┴─────────────────────┴─────────────────┴─────────────────────┘
Rollback last operation? (add docker kubectl) [Y/n]
🔄 Rolling back operation 1...
✓ Restored applications.yaml
✓ Removed added applications from configuration
✓ Cleaned up Docker and kubectl installations
✓ Rollback completed successfully
Configuration restored to state before adding Docker and kubectl.Backup Integration
Both recovery and rollback commands integrate closely with DevEx's backup system:
Automatic Backups
# DevEx automatically creates backups before:
# - Major configuration changes
# - Template applications
# - Bulk application additions/removals
# - System-level modifications
# View backup history
devex config backup list
# Create manual backup before risky operation
devex config backup create --name "before-experimental-setup"Backup-based Recovery
# Restore from specific backup
devex recovery restore backup-20240817-1430
# Compare current state with backup
devex config diff backup-20240817-1430
# List available restore points
devex recovery list-restore-pointsCommon Recovery Scenarios
# Application failed to install properly
devex recovery repair --app docker --reinstall
# Package manager issues
devex recovery check --category packages --fix
# Dependency conflicts
devex recovery clean --broken
devex install docker # retry installationPrevention and Monitoring
Proactive Health Monitoring:
- Regular health checks: Run
devex recovery checkweekly - Automatic backups: Enable before major changes
- Monitor service status: Include in startup scripts
- Keep logs: Enable verbose logging for troubleshooting
Health Check Automation
# Add to crontab for weekly health checks
0 9 * * 1 devex recovery check --report /var/log/devex-health.log
# Check health before important work
alias devwork='devex recovery check --fix && echo "Environment ready!"'
# Monitor service health
devex status --problems-only || devex recovery repair --serviceRelated Commands
devex status- Check current installation statusdevex config backup- Manage configuration backupsdevex install- Reinstall applications after recoverydevex config validate- Validate configuration integrity
Important: Always create a backup before performing recovery operations that might modify your configuration or reinstall applications.