Bigbox Deployment Plan: Firecracker-Rust + Terraphim Multi-Agent System
Target Server: bigbox (SSH access required) Date: 2025-10-06 Objective: Deploy complete Terraphim AI multi-agent system with Firecracker VM execution, integrated with existing Caddy infrastructure
ποΈ Infrastructure Overview
Existing Infrastructure (Reused)
- β Caddy Server with OAuth (GitHub) + JWT authentication
- β Redis for session/state management
- β
Cloudflare DNS/TLS for
*.terraphim.clouddomains - β ~/infrastructure/ directory structure
- β Log rotation configured in Caddy
New Components to Deploy
- π fcctl-web (Firecracker VM management HTTP API)
- π Terraphim Server (Multi-agent system with LLM integration)
- π Ollama (Local LLM: llama3.2:3b)
- π Agent Workflows (Starting with parallelization demo)
π Deployment Directory Structure
/home/alex/infrastructure/terraphim-private-cloud/
βββ firecracker-rust/ # Firecracker VM management
β βββ fcctl-web/ # Web API binary
β βββ firecracker-ci-artifacts/ # Firecracker binary
β βββ ubuntu-focal-*.ext4 # VM root filesystem images
β βββ vmlinux* # Linux kernels
βββ agent-system/ # Terraphim multi-agent codebase
β βββ target/release/ # Compiled binaries
β βββ terraphim_server/ # Server with configs
β βββ crates/ # Library crates
β βββ examples/ # Workflow examples
βββ workflows/ # Static workflow frontends
β βββ parallelization/ # Multi-perspective analysis demo
βββ data/ # Runtime data
β βββ knowledge-graph/ # KG data
β βββ documents/ # Document haystacks
β βββ sessions/ # VM session data
βββ logs/ # Application logs
βββ fcctl-web.log
βββ terraphim-server.log
βββ vm-api.log
βββ agents-api.log
βββ workflows.logπ Domain/URL Configuration
Public Endpoints (via Caddy with OAuth)
- Authentication: https://auth.terraphim.cloud (existing)
- Workflows UI: https://workflows.terraphim.cloud/parallelization/
- Agent API: https://agents.terraphim.cloud/
- VM Management: https://vm.terraphim.cloud/ (admin-only)
Internal Endpoints (localhost only)
- fcctl-web: http://127.0.0.1:8080
- Terraphim Server: http://127.0.0.1:3000
- Ollama: http://127.0.0.1:11434
- Redis: localhost:6379
π Phase-by-Phase Deployment Steps
Phase 1: Environment Preparation
1.1 SSH Access & Directory Setup
# Connect to bigbox
# Create deployment structure
1.2 System Dependencies
# Update packages
&&
# Install Firecracker prerequisites
# Verify/Install Rust
|| {
|
}
# Enable KVM for current user
1.3 Verify Existing Services
# Check what's already running
# Verify Caddy config location
# Check existing domains
| Phase 2: Firecracker-Rust Deployment
2.1 Clone/Transfer Repository
# Option A: Git clone (if repo accessible from bigbox)
# Option B: SCP from development machine (run from dev machine)
# scp -r /home/alex/projects/terraphim/terraphim-ai/scratchpad/firecracker-rust/* user@bigbox:/home/alex/infrastructure/terraphim-private-cloud/firecracker-rust/2.2 Build Firecracker Components
# Build all workspace components
# Verify builds
2.3 Download Firecracker Binary
# Download latest Firecracker release
# Verify
2.4 Build VM Images
# Build Ubuntu Focal (20.04) image - recommended for stability
# This creates:
# - ubuntu-focal-rootfs.ext4 (base root filesystem)
# - ubuntu-focal-vmlinux (Linux kernel)
# - ubuntu-focal-ssh.ext4 (SSH-enabled variant)
# Verify images
2.5 Network Setup for Firecracker VMs
# Create network setup script
2.6 Create fcctl-web Systemd Service
# Get current user for service
CURRENT_USER=
# Enable and start service
# Verify
Phase 3: Terraphim Agent System Deployment
3.1 Clone/Transfer Agent System
# Option A: Git clone
# Option B: SCP from dev machine (run from dev machine)
# scp -r /home/alex/projects/terraphim/terraphim-ai/* user@bigbox:/home/alex/infrastructure/terraphim-private-cloud/agent-system/3.2 Build Agent System
# Build with all features
# Verify
3.3 Install Ollama (Local LLM)
# Check if already installed
if ! ; then
|
fi
# Enable and start service
# Pull model
# Verify
3.4 Create Agent Configuration
# Create bigbox-specific config
CURRENT_USER=
# Create data directories
3.5 Create Terraphim Server Systemd Service
CURRENT_USER=
# Enable and start
# Verify
Phase 4: Caddy Integration
4.1 Add Terraphim Subdomains to Caddyfile
# Backup existing Caddyfile
# Add Terraphim configuration
CURRENT_USER=
4.2 Validate and Reload Caddy
# Validate configuration
# Reload Caddy (no downtime)
# Verify
Phase 5: Parallelization Workflow Deployment
5.1 Deploy Workflow Frontend
# Copy parallelization workflow
# Set correct permissions
5.2 Configure Workflow API Endpoints
# Update API endpoints in workflow config
# Replace localhost with agents.terraphim.cloud
| while ; do
5.3 Create Workflow Index Page
Phase 6: Testing & Validation
6.1 Create Health Check Script
6.2 Run Health Check
6.3 Run VM Execution Tests
# Unit tests (no fcctl-web required)
# Integration tests (requires fcctl-web)
# All tests
Phase 7: Security & Hardening
7.1 Firewall Configuration
# Ensure UFW allows only Caddy ports
# All internal services (fcctl-web:8080, terraphim:3000, ollama:11434)
# are bound to 127.0.0.1 only - not exposed externally7.2 Service Permissions Check
# Verify services run as non-root
|
|
|
# All should run as your user, not root7.3 Automated Backup
# Add to crontab (daily at 2 AM)
(; ) | Phase 8: Monitoring (Caddy Metrics)
8.1 Enable Caddy Metrics
# Caddy already exposes Prometheus metrics at :2019/metrics by default
# Verify
| 8.2 Log Locations
# Service logs (journalctl)
# Application logs (Caddy-managed)
π― Post-Deployment Verification
Step 1: Verify All Services Running
Step 2: Test Internal Endpoints
Step 3: Test Public Endpoints (Requires OAuth Login)
- Login: Navigate to https://auth.terraphim.cloud
- Authenticate: Use GitHub OAuth
- Access Workflows: https://workflows.terraphim.cloud/parallelization/
- Test Agent API: https://agents.terraphim.cloud/health
Step 4: Run Parallelization Workflow
- Open https://workflows.terraphim.cloud/parallelization/
- Enter topic: "Impact of AI on software development"
- Select perspectives: Analytical, Creative, Practical
- Select domains: Technical, Business
- Click "Start Analysis"
- Verify parallel execution with real-time progress
π System Architecture Diagram
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Internet (HTTPS) β
β *.terraphim.cloud β
ββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββββββββ
β
ββββββΌββββββ
β Caddy β :80/:443
β Server β OAuth + JWT + TLS
ββββββ¬ββββββ
β
βββββββββββββββββΌββββββββββββββββ
β β β
ββββββΌββββββ ββββββΌβββββ ββββββΌββββββ
β vm. β βagents. β βworkflows.β
βterraphim β βterraphimβ βterraphim β
β.cloud β β.cloud β β.cloud β
ββββββ¬ββββββ ββββββ¬βββββ ββββββ¬ββββββ
β β β
ββββββΌββββββ ββββββΌβββββ ββββββΌββββββ
βfcctl-web β βTerraphimβ β Static β
β:8080 β βServer β β Files β
β(localhost) β:3000 β β(workflows)β
β β β(localhost) β β
ββββββ¬ββββββ ββββββ¬βββββ ββββββββββββ
β β
β ββββββΌββββββ
β β Ollama β
β β :11434 β
β β(localhost)β
β ββββββββββββ
β
ββββββΌβββββββββββββ
β Firecracker β
β MicroVMs β
β (br0 network) β
βββββββββββββββββββπ§ Troubleshooting
Service Not Starting
# Check logs
# Check port conflicts
VM Creation Fails
# Check Firecracker binary
# Check KVM access
|
# Check network bridge
Caddy 502 Bad Gateway
# Verify backend services running
# Check Caddy error logs
OAuth/JWT Issues
# Verify JWT shared key is set
# Check GitHub OAuth credentials
# Verify cookie domain
π Next Steps After Deployment
Short Term (Week 1)
- β Deploy additional workflows (routing, orchestrator-workers)
- β Configure monitoring dashboards (Grafana + Prometheus)
- β Set up alerting (PagerDuty/Slack)
- β Create user documentation
Medium Term (Month 1)
- Scale VM pool based on workload
- Implement distributed tracing (Jaeger)
- Add more LLM providers (OpenRouter, local Mixtral)
- Create workflow templates library
Long Term (Quarter 1)
- Multi-region deployment
- High availability setup (Caddy cluster)
- Advanced workflow orchestration
- ML model fine-tuning pipeline
π Support & Resources
Documentation
- Terraphim AI: https://github.com/terraphim/terraphim-ai
- Firecracker: https://firecracker-microvm.github.io/
- Caddy: https://caddyserver.com/docs/
- Ollama: https://ollama.com/
Logs Locations
- fcctl-web:
journalctl -fu fcctl-web - terraphim-server:
journalctl -fu terraphim-server - Caddy access:
/home/alex/infrastructure/terraphim-private-cloud/logs/*.log
Health Check
Deployment Checklist:
- [ ] Phase 1: Environment preparation complete
- [ ] Phase 2: Firecracker-rust deployed
- [ ] Phase 3: Agent system deployed
- [ ] Phase 4: Caddy integration complete
- [ ] Phase 5: Workflows deployed
- [ ] Phase 6: Tests passing
- [ ] Phase 7: Security hardened
- [ ] Phase 8: Monitoring configured
- [ ] Post-deployment verification successful