Cleanup and Maintenance
This guide covers coderaft’s cleanup and maintenance features to keep your development environment healthy and optimized.
Cleanup Command
Section titled “Cleanup Command”The coderaft cleanup command helps maintain a clean system by removing various Docker resources and coderaft artifacts.
Interactive Cleanup
Section titled “Interactive Cleanup”coderaft cleanupThis opens an interactive menu with the following options:
- Clean up orphaned coderaft Islands - Remove Islands not tracked in config
- Remove unused Docker images - Remove dangling and unused images
- Remove unused Docker volumes - Remove unused volumes
- Remove unused Docker networks - Remove unused networks
- Run Docker system prune - Comprehensive cleanup of all unused resources
- Clean up everything - Combines options 1-4
- Show system status - Display disk usage and system information
Command-Line Flags
Section titled “Command-Line Flags”# Specific cleanup taskscoderaft cleanup --orphaned # Remove orphaned Islands onlycoderaft cleanup --images # Remove unused images onlycoderaft cleanup --volumes # Remove unused volumes onlycoderaft cleanup --networks # Remove unused networks onlycoderaft cleanup --system-prune # Run docker system prunecoderaft cleanup --all # Clean up everything
# Safety and informationcoderaft cleanup --dry-run # Show what would be cleaned (no changes)coderaft cleanup --force # Skip confirmation promptsExamples
Section titled “Examples”# See what would be cleaned without making changescoderaft cleanup --dry-run --all
# Clean only orphaned Islandscoderaft cleanup --orphaned
# Comprehensive cleanup with confirmationcoderaft cleanup --all
# Quick cleanup without promptscoderaft cleanup --all --forceMaintenance Command
Section titled “Maintenance Command”The coderaft maintenance command provides system health monitoring, updates, and repair functionality.
Interactive Maintenance
Section titled “Interactive Maintenance”coderaft maintenanceThis opens an interactive menu with these options:
- Check system status - Show Docker status, projects, and disk usage
- Perform health check - Check health of all projects
- Update system packages - Update packages in all Islands
- Restart stopped Islands - Start any stopped coderaft Islands
- Rebuild all Islands - Recreate Islands from latest base images
- Auto-repair common issues - Automatically fix detected problems
- Full maintenance - Combines health check, updates, and restarts
Command-Line Flags
Section titled “Command-Line Flags”# Individual maintenance taskscoderaft maintenance --status # Show detailed system statuscoderaft maintenance --health-check # Check health of all projectscoderaft maintenance --update # Update all Islandscoderaft maintenance --restart # Restart stopped Islandscoderaft maintenance --rebuild # Rebuild all Islandscoderaft maintenance --auto-repair # Auto-fix common issues
# Control flagscoderaft maintenance --force # Skip confirmation promptsExamples
Section titled “Examples”# Check system healthcoderaft maintenance --health-check
# Update all Islandscoderaft maintenance --update
# Rebuild all Islands (with confirmation)coderaft maintenance --rebuild
# Quick full maintenance without promptscoderaft maintenance --force --health-check --update --restartUpdate Command
Section titled “Update Command”Use the coderaft update command to rebuild environment Islands from the latest base images. This is the recommended way to apply upstream image updates or configuration changes that affect the base image or setup commands.
Why use coderaft update?
Section titled “Why use coderaft update?”- Pulls the newest base image(s)
- Recreates the Island with your current
coderaft.jsonconfiguration - Automatically runs a full system update inside the Island
- Re-runs your
setup_commandsto ensure tools are present - Preserves your project files on the host at
~/coderaft/<project>/
# Update a single projectcoderaft update myproject
# Update all projectscoderaft updateWhen to use maintenance vs update
Section titled “When to use maintenance vs update”coderaft maintenance --update: Update system packages inside existing Islandscoderaft update: Rebuild Islands from the latest base images and re-apply configuration
If you’re changing base_image in coderaft.json or want to ensure you are using the latest upstream image, use coderaft update.
Health Checks
Section titled “Health Checks”The health check system monitors:
- Island Status: Whether Islands are running or stopped
- Island Responsiveness: Whether Islands respond to commands
- Workspace Directories: Whether project directories exist
- Configuration Files: Whether coderaft.json files are valid
Health check results show:
- ✅ Healthy: Island running and responsive
- ⚠️ Unhealthy: Island stopped or unresponsive
- ❌ Missing: Island or workspace missing
Auto-Repair
Section titled “Auto-Repair”The auto-repair feature automatically fixes common issues:
- Missing workspace directories: Creates missing project directories
- Missing Islands: Recreates Islands from configuration
- Stopped Islands: Starts stopped Islands
- Unresponsive Islands: Restarts Islands that don’t respond
System Updates
Section titled “System Updates”The update feature:
- Runs
apt update -yto refresh package lists - Runs
apt full-upgrade -yto install updates - Runs
apt autoremove -yto remove unnecessary packages - Runs
apt autocleanto clean package cache
Updates are applied to all tracked Islands that are running or can be started.
Island Rebuilding
Section titled “Island Rebuilding”The rebuild feature:
- Stops and removes existing Islands
- Pulls latest base images
- Recreates Islands with current configuration
- Runs system updates
- Executes setup commands from coderaft.json
- Sets up coderaft environment
Monitoring
Section titled “Monitoring”System Status
Section titled “System Status”# Quick status overviewcoderaft list
# Detailed system informationcoderaft maintenance --status
# Docker resource usagedocker system dfIsland Health
Section titled “Island Health”# Check all project healthcoderaft maintenance --health-check
# Check specific Islanddocker inspect coderaft_myproject
# View Island logsdocker logs coderaft_myprojectResource Usage
Section titled “Resource Usage”# Live Island statsdocker stats
# Disk usage by typedocker system df -v
# List all coderaft Islandsdocker ps -a --filter "name=coderaft_"