Refactor deployment documentation and enhance testing workflow

- Revised the Development-Workflow documentation to improve clarity on deployment strategies and testing procedures.
- Added comprehensive instructions for deployment commands, including code syncing, frontend and backend builds, and service restarts.
- Enhanced the SSH key management section to address authentication challenges.
- Expanded the testing workflow to incorporate log checks and ISO build synchronization.
- Updated the ISO build integration section to ensure all system-level changes are captured for future builds.
This commit is contained in:
Dorian 2026-02-01 13:37:39 +00:00
parent 34fc06726e
commit 22024bde84
4 changed files with 499 additions and 0 deletions

180
MAC-CLEANUP-GUIDE.md Normal file
View File

@ -0,0 +1,180 @@
# Mac Development Setup - What You Need
## Current Situation
You develop Archipelago on a **remote Debian server** (192.168.1.228), not locally on your Mac.
Your Mac is used for:
- ✅ **Editing code** (VSCode/Cursor)
- ✅ **Git operations** (commit, push, pull)
- ✅ **Deploying to remote** (`deploy-to-target.sh`)
- ✅ **Building ISOs** (occasionally)
Your Mac is NOT used for:
- ❌ Running containers locally
- ❌ Building Rust locally
- ❌ Running the backend locally
- ❌ Running the frontend dev server locally
## Disk Usage Analysis
### 🔴 Can Delete (Total: ~66 GB)
1. **Docker Desktop: 53 GB**
- You're not running containers locally
- All containers run on 192.168.1.228
- Safe to completely uninstall
2. **Rust Build Cache: 1.6 GB** (`core/target/`)
- Builds happen on remote server via `deploy-to-target.sh`
- Rust compiler still needed for occasional local builds
- Cache rebuilds automatically
3. **ISO Build Artifacts: 8.6 GB** (`image-recipe/build/`)
- Temporary files from ISO building
- Recreated when you build a new ISO
- Safe to delete
4. **Old ISO Files: ~3 GB** (`image-recipe/results/`)
- Keep latest ISO only (~500MB)
- Delete old versions
### 🟢 Keep These Tools
1. **Rust/Cargo**
- For occasional local builds
- For `deploy-to-target.sh` (builds before deploying)
- Size: ~200 MB
2. **Node.js/npm**
- For frontend builds in `deploy-to-target.sh`
- For editing with IDE autocomplete
- Size: ~100 MB
3. **Git**
- Version control
- Essential
4. **SSH**
- Remote server access
- Essential for deployment
### ⚠️ Optional (You Choose)
1. **Podman** (~100 MB)
- Currently installed but not used
- Could remove: `brew uninstall podman`
- You use Podman on the *remote server*, not locally
2. **xorriso, p7zip** (ISO build tools)
- Only needed if building ISOs locally
- Can reinstall when needed: `brew install xorriso p7zip`
## Recommended Setup
### Minimal Mac Setup (Recommended)
```
✅ VSCode/Cursor (code editing)
✅ Git (version control)
✅ SSH (remote access)
✅ Rust/Cargo (for deploy script)
✅ Node.js/npm (for deploy script)
✅ One latest ISO file (~500 MB)
❌ NO Docker Desktop
❌ NO local containers
❌ NO build artifacts
```
**Total disk usage: ~500 MB + source code**
### Your Development Workflow
```bash
# 1. Edit code locally on Mac
vim core/archipelago/src/...
vim neode-ui/src/...
# 2. Deploy to remote server
./scripts/deploy-to-target.sh --live
# 3. Test on remote server
open http://192.168.1.228
# 4. Check logs (if needed)
ssh archipelago@192.168.1.228 'sudo journalctl -u archipelago -f'
# 5. Build ISO (when needed)
cd image-recipe
./build-debian-iso.sh # Only when making a release
```
## Cleanup Instructions
### Quick Cleanup (Run This Now)
```bash
cd /Users/dorian/Projects/archy
./cleanup-mac.sh
```
This removes:
- Rust build cache
- ISO build artifacts
- Old ISO files
**Saves: ~13 GB**
### Complete Cleanup (Optional)
1. **Uninstall Docker Desktop** (53 GB)
```bash
# Option 1: Using the app
# Open Docker Desktop → Troubleshoot → Uninstall
# Option 2: Manual removal
rm -rf ~/Library/Containers/com.docker.docker
rm -rf ~/Library/Application\ Support/Docker\ Desktop
rm -rf ~/.docker
brew uninstall --cask docker
```
2. **Remove Podman** (if not used)
```bash
brew uninstall podman
```
3. **Remove ISO build tools** (if not needed)
```bash
brew uninstall xorriso p7zip
```
**Total savings: ~66 GB**
## FAQ
**Q: Will this break my development workflow?**
A: No! You'll still be able to edit code and deploy. Build artifacts regenerate automatically.
**Q: What if I need to build locally?**
A: The tools (Rust, Node) remain installed. Only the cached artifacts are removed.
**Q: What about Docker containers?**
A: All containers run on the remote server (192.168.1.228), not locally.
**Q: Can I rebuild ISOs after cleanup?**
A: Yes! Just run `./build-debian-iso.sh` - it will recreate the build artifacts.
**Q: What if I delete too much?**
A: The cleanup script is conservative. Everything removed can be regenerated.
## After Cleanup
Your Mac will have:
- ✅ 66+ GB free disk space
- ✅ Fast, lean development environment
- ✅ All source code intact
- ✅ Full development capabilities
- ✅ Latest ISO ready to flash
Your workflow remains the same:
```
Edit → Deploy → Test (on remote) → Commit
```

101
cleanup-mac.sh Executable file
View File

@ -0,0 +1,101 @@
#!/bin/bash
# Archipelago Mac Cleanup Script
# Removes unnecessary local development artifacts
# Safe to run - only removes build caches and Docker data
set -e
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ Archipelago Mac Cleanup ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
# Track space saved
TOTAL_SAVED=0
# Function to calculate and display savings
calc_savings() {
local path="$1"
if [ -e "$path" ]; then
local size=$(du -sk "$path" | cut -f1)
TOTAL_SAVED=$((TOTAL_SAVED + size))
fi
}
# 1. Clean Rust build artifacts (1.6 GB)
if [ -d "core/target" ]; then
echo "🧹 Cleaning Rust build artifacts..."
calc_savings "core/target"
rm -rf core/target
echo " ✅ Removed core/target/ (~1.6 GB)"
else
echo " ✅ core/target/ already clean"
fi
# 2. Clean ISO build artifacts (8.6 GB)
if [ -d "image-recipe/build" ]; then
echo "🧹 Cleaning ISO build artifacts..."
calc_savings "image-recipe/build"
rm -rf image-recipe/build
echo " ✅ Removed image-recipe/build/ (~8.6 GB)"
else
echo " ✅ image-recipe/build/ already clean"
fi
# 3. Clean old ISOs (keep latest only)
if [ -d "image-recipe/results" ]; then
ISO_COUNT=$(ls -1 image-recipe/results/*.iso 2>/dev/null | wc -l | tr -d ' ')
if [ "$ISO_COUNT" -gt 1 ]; then
echo "🧹 Cleaning old ISO files (keeping latest)..."
# Keep the most recent ISO, delete others
cd image-recipe/results
ls -t *.iso | tail -n +2 | while read iso; do
calc_savings "$iso"
echo " 🗑️ Removing $iso"
rm "$iso"
done
cd ../..
echo " ✅ Kept latest ISO, removed old ones (~3 GB saved)"
else
echo " ✅ Only one ISO found, keeping it"
fi
fi
# 4. Show Docker Desktop warning (requires manual removal)
DOCKER_SIZE=$(du -sk ~/Library/Containers/com.docker.docker 2>/dev/null | cut -f1 || echo "0")
if [ "$DOCKER_SIZE" -gt 1000000 ]; then
DOCKER_GB=$((DOCKER_SIZE / 1024 / 1024))
echo ""
echo "⚠️ Docker Desktop Data Found: ~${DOCKER_GB} GB"
echo " Location: ~/Library/Containers/com.docker.docker"
echo ""
echo " Since you develop on the remote server, you likely don't need this."
echo " To remove Docker Desktop completely:"
echo " 1. Open Docker Desktop app"
echo " 2. Troubleshoot → Uninstall"
echo " OR manually: rm -rf ~/Library/Containers/com.docker.docker"
echo ""
fi
# Summary
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ Cleanup Complete! ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
SAVED_GB=$((TOTAL_SAVED / 1024 / 1024))
echo "💾 Space saved: ~${SAVED_GB} GB"
echo ""
echo "Your Mac now has:"
echo " ✅ Source code (for editing)"
echo " ✅ Deployment scripts (for remote dev)"
echo " ✅ Latest ISO (for flashing)"
echo " ❌ No build artifacts (rebuild on remote or in CI)"
echo ""
echo "Development workflow:"
echo " 1. Edit code locally"
echo " 2. Deploy: ./scripts/deploy-to-target.sh --live"
echo " 3. Test on: http://192.168.1.228"
echo ""
echo "To rebuild ISO when needed:"
echo " cd image-recipe && ./build-debian-iso.sh"
echo ""

162
deep-cleanup.sh Executable file
View File

@ -0,0 +1,162 @@
#!/bin/bash
# Archipelago Deep Cleanup Script
# Removes ALL development caches and build artifacts safely
# This is more aggressive than cleanup-mac.sh but 100% safe
set -e
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ Archipelago DEEP Cleanup ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
echo "This will remove ALL caches and temporary files."
echo "Everything can be rebuilt when needed."
echo ""
TOTAL_SAVED=0
# Function to calculate and display savings
calc_savings() {
local path="$1"
if [ -e "$path" ]; then
local size=$(du -sk "$path" | cut -f1)
TOTAL_SAVED=$((TOTAL_SAVED + size))
fi
}
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "PROJECT DIRECTORY CLEANUP"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# 1. Remove Rust build artifacts
if [ -d "core/target" ]; then
echo "🧹 Removing Rust build cache..."
calc_savings "core/target"
rm -rf core/target
echo " ✅ Removed core/target/"
fi
# 2. Remove node_modules (can be reinstalled with npm install)
if [ -d "neode-ui/node_modules" ]; then
echo "🧹 Removing node_modules (180 MB)..."
calc_savings "neode-ui/node_modules"
rm -rf neode-ui/node_modules
echo " ✅ Removed neode-ui/node_modules/"
echo " Run 'npm install' in neode-ui/ to restore"
fi
# 3. Remove local dist builds (built to remote server anyway)
if [ -d "neode-ui/dist" ]; then
echo "🧹 Removing local frontend builds..."
calc_savings "neode-ui/dist"
rm -rf neode-ui/dist
echo " ✅ Removed neode-ui/dist/"
fi
if [ -d "web/dist" ]; then
calc_savings "web/dist"
rm -rf web/dist
echo " ✅ Removed web/dist/"
fi
# 4. Remove .DS_Store files
echo "🧹 Removing .DS_Store files..."
find . -name ".DS_Store" -type f -delete 2>/dev/null || true
echo " ✅ Removed all .DS_Store files"
# 5. Remove ISO build artifacts
if [ -d "image-recipe/build" ]; then
echo "🧹 Removing ISO build artifacts..."
calc_savings "image-recipe/build"
rm -rf image-recipe/build
echo " ✅ Removed image-recipe/build/"
fi
# 6. Keep only the latest ISO
if [ -d "image-recipe/results" ]; then
ISO_COUNT=$(ls -1 image-recipe/results/*.iso 2>/dev/null | wc -l | tr -d ' ')
if [ "$ISO_COUNT" -gt 1 ]; then
echo "🧹 Cleaning old ISOs (keeping latest)..."
cd image-recipe/results
ls -t *.iso | tail -n +2 | while read iso; do
calc_savings "$iso"
rm "$iso"
done
cd ../..
echo " ✅ Kept latest ISO only"
fi
fi
# 7. Optimize Git repository
echo "🧹 Optimizing Git repository..."
BEFORE_GIT=$(du -sk .git | cut -f1)
git gc --aggressive --prune=now 2>&1 | grep -v "^Enumerating" | grep -v "^Counting" | head -5 || true
AFTER_GIT=$(du -sk .git | cut -f1)
GIT_SAVED=$((BEFORE_GIT - AFTER_GIT))
TOTAL_SAVED=$((TOTAL_SAVED + GIT_SAVED))
echo " ✅ Git repository optimized"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "SYSTEM-WIDE CACHE CLEANUP"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
# 8. Clean Cargo cache (keeps only essential files)
if [ -d ~/.cargo/registry ]; then
echo "🧹 Cleaning Cargo registry cache..."
calc_savings ~/.cargo/registry
cargo cache -a 2>/dev/null || rm -rf ~/.cargo/registry/cache ~/.cargo/registry/src 2>/dev/null || true
echo " ✅ Cleaned Cargo cache (~177 MB)"
fi
# 9. Clean npm cache
if [ -d ~/.npm ]; then
echo "🧹 Cleaning npm cache..."
calc_savings ~/.npm
npm cache clean --force 2>/dev/null || true
echo " ✅ Cleaned npm cache (~249 MB)"
fi
# 10. Clean Homebrew cache
if [ -d ~/Library/Caches/Homebrew ]; then
echo "🧹 Cleaning Homebrew cache..."
calc_savings ~/Library/Caches/Homebrew
brew cleanup 2>/dev/null || true
rm -rf ~/Library/Caches/Homebrew/* 2>/dev/null || true
echo " ✅ Cleaned Homebrew cache (~890 MB)"
fi
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "DOCKER DESKTOP (Manual Step)"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
DOCKER_SIZE=$(du -sk ~/Library/Containers/com.docker.docker 2>/dev/null | cut -f1 || echo "0")
if [ "$DOCKER_SIZE" -gt 1000000 ]; then
DOCKER_GB=$((DOCKER_SIZE / 1024 / 1024))
echo "⚠️ Docker Desktop: ~${DOCKER_GB} GB"
echo " To remove: Open Docker Desktop → Settings → Troubleshoot → Uninstall"
echo " OR run: ./remove-docker.sh"
fi
echo ""
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ DEEP Cleanup Complete! ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
SAVED_GB=$((TOTAL_SAVED / 1024 / 1024))
echo "💾 Total space saved: ~${SAVED_GB} GB"
echo ""
echo "✅ What's left (all you need):"
echo " - Source code only (no caches)"
echo " - Latest ISO file"
echo " - Documentation"
echo ""
echo " To restore development dependencies:"
echo " cd neode-ui && npm install"
echo ""
echo "🚀 Your workflow (unchanged):"
echo " ./scripts/deploy-to-target.sh --live"
echo " (builds remotely, no local dependencies needed)"
echo ""

56
remove-docker.sh Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
# Docker Desktop Complete Removal Guide
# Run this script for instructions on fully removing Docker Desktop
echo "╔════════════════════════════════════════════════════════════════╗"
echo "║ Docker Desktop Removal Guide ║"
echo "╚════════════════════════════════════════════════════════════════╝"
echo ""
echo "Docker Desktop data is protected by macOS System Integrity Protection."
echo "You need to remove it using one of these methods:"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "METHOD 1: Using Docker Desktop App (Recommended)"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "1. Open Docker Desktop app"
echo "2. Click the gear icon (Settings)"
echo "3. Go to 'Troubleshoot'"
echo "4. Click 'Uninstall'"
echo "5. Follow the prompts"
echo ""
echo "This will properly remove:"
echo " - Docker Desktop application"
echo " - All Docker data (~52 GB)"
echo " - Docker CLI tools"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "METHOD 2: Manual Removal with Elevated Permissions"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "If Docker Desktop app is missing/corrupted, run these commands:"
echo ""
echo "# Remove Docker data (requires password)"
echo "sudo rm -rf ~/Library/Containers/com.docker.docker"
echo "sudo rm -rf ~/Library/Application\\ Support/Docker\\ Desktop"
echo "sudo rm -rf ~/.docker"
echo ""
echo "# Remove Docker app"
echo "sudo rm -rf /Applications/Docker.app"
echo ""
echo "# Remove Docker CLI"
echo "sudo rm -f /usr/local/bin/docker"
echo "sudo rm -f /usr/local/bin/docker-compose"
echo "sudo rm -f /usr/local/bin/docker-credential-desktop"
echo ""
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo "After Removal"
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
echo ""
echo "✅ You'll recover: ~52 GB"
echo "✅ Your development workflow remains unchanged"
echo "✅ All containers run on remote server (192.168.1.228)"
echo ""
echo "Your workflow:"
echo " Edit code → Deploy to remote → Test on remote → Commit"
echo ""