Universal deployment orchestrator for ThreeFold Grid applications.
TFGrid Compose is a production-ready deployment platform that makes deploying applications on ThreeFold Grid as simple as tfgrid-compose up.
Key Features:
- ✅ One-command deployment - From zero to running app in 2-3 minutes
- ✅ Context file support - Set app once, use short commands everywhere
- ✅ App-specific commands - Apps define custom commands (
tfgrid-compose create,tfgrid-compose run) - ✅ Auto-install - Automatically sets up PATH in your shell
- ✅ Multiple patterns - single-vm, gateway, k3s (coming soon)
- ✅ Smart validation - Checks prerequisites and prevents errors
- ✅ Remote execution - Run commands on deployed VMs from your local machine
- ✅ State management - Tracks all deployments automatically
- ✅ Idempotency - Safe to retry, prevents duplicate deployments
Complete documentation: docs.tfgrid.studio
- Getting Started - Installation and first deployment
- Architecture - System design and components
- Troubleshooting - Common errors and solutions
- AI Agent Guide - Deploy AI coding assistant
- Pattern Contract - Create custom patterns
- Contributing - How to contribute
- Code of Conduct - Community guidelines
- Security Policy - Report vulnerabilities
tfgrid-compose/
├── cli/ # tfgrid-compose CLI tool
├── core/ # Core orchestration logic
├── patterns/ # Deployment patterns
│ └── single-vm/ # Single VM pattern (MVP)
├── lib/ # Shared modules and roles
└── docs/ # Documentation
🎉 v0.13.4 - Production Ready
All 3 core deployment patterns are production-ready!
- Full deployment orchestration (Terraform + WireGuard + Ansible)
- Context file support (
.tfgrid-compose.yaml) - Agent subcommand for AI agent management
- Automatic PATH setup during installation
- Input validation and error handling
- Idempotency protection
- Remote command execution (
exec) - Comprehensive documentation
- Auto-install with
make install - Single-VM pattern (fully tested)
- Single-VM pattern - Development, databases, AI agents
- Gateway pattern - Production web apps with public IPv4, SSL, load balancing
- K3s pattern - Kubernetes clusters for cloud-native apps
- tfgrid-wordpress - WordPress + Caddy + MariaDB with DNS automation
- tfgrid-nextcloud - Nextcloud All-in-One cloud platform
- tfgrid-erpnext - ERPNext business ERP system
- tfgrid-ai-agent - AI coding assistant
- tfgrid-ai-stack - Complete AI development environment with Git hosting
- tfgrid-gitea - Self-hosted Git service
- Interactive mode (
-iflag) - Guided deployment with prompts - DNS automation - Cloudflare, Name.com, Namecheap support
- Local dashboard - Visual deployment management
- Automated test suite
- Shell completion (bash/zsh/fish)
- Video tutorials
Single VM deployment with Wireguard and Mycelium networking.
Use cases:
- Development environments
- Databases (PostgreSQL, MongoDB, Redis)
- Internal services
- AI agents
- Background workers
Documentation: patterns/single-vm/
Gateway VM with public IPv4 + backend VMs with private networking.
Use cases:
- Production web applications
- E-commerce sites
- Multi-tier applications
- Public-facing services
Features:
- Public IPv4 on gateway
- Nginx/HAProxy reverse proxy
- Free SSL/TLS (Let's Encrypt)
- Load balancing & health checks
- Private backend network
- Network redundancy (WireGuard + Mycelium)
Documentation: patterns/gateway/README.md
Kubernetes cluster (K3s) with control plane, workers, and management node.
Use cases:
- Cloud-native applications
- Microservices architectures
- Production SaaS platforms
- High availability requirements
Features:
- Lightweight Kubernetes (K3s)
- MetalLB load balancer
- Nginx Ingress Controller
- Management node with kubectl, helm, k9s
- Local-path storage provisioner
- HA control plane support
Documentation: patterns/k3s/README.md
# Setup standard workspace
mkdir -p ~/code/github.com/tfgrid-studio
cd ~/code/github.com/tfgrid-studio
# Clone repositories
git clone https://github.com/tfgrid-studio/tfgrid-compose
git clone https://github.com/tfgrid-studio/tfgrid-ai-agent
# Install (auto-configures PATH)
cd tfgrid-compose
make installThis automatically adds tfgrid-compose to your PATH and creates a default tfgrid shortcut!
Shortcuts: Use tfgrid instead of tfgrid-compose for shorter commands, or create your own with tfgrid-compose shortcut <name>.
Note: We use ~/code/github.com/{org}/{repo} as the standard workspace structure. See WORKSPACE_STANDARD.md for details.
Prerequisites:
- Terraform or OpenTofu
- Ansible
- WireGuard (for private networking)
- ThreeFold Grid account with mnemonic
See Quick Start Guide for detailed setup.
# Store your mnemonic
mkdir -p ~/.config/threefold
echo "your twelve word mnemonic" > ~/.config/threefold/mnemonic
chmod 600 ~/.config/threefold/mnemonic
# Create context file (optional but recommended)
echo "app: ../tfgrid-ai-agent" > .tfgrid-compose.yaml# Deploy application (uses context)
tfgrid-compose up
# Use AI agent with simple commands
tfgrid-compose projects
tfgrid-compose create
tfgrid-compose run my-project
# Specify app path every time
tfgrid-compose up ../tfgrid-ai-agent
tfgrid-compose status ../tfgrid-ai-agent
tfgrid-compose ssh ../tfgrid-ai-agent
tfgrid-compose down ../tfgrid-ai-agent# Deploy
tfgrid-compose up [app-path]
# Execute commands on VM
tfgrid-compose exec [app-path] <command>
# AI Agent management (requires context)
tfgrid-compose projects
tfgrid-compose create
tfgrid-compose run <project>
tfgrid-compose monitor <project>
tfgrid-compose stop <project>
# Status & logs
tfgrid-compose status [app-path]
tfgrid-compose ssh [app-path]
tfgrid-compose logs [app-path]
# Destroy
tfgrid-compose down [app-path]
# Shortcuts (optional)
tfgrid-compose shortcut <name> # Create custom shortcut
tfgrid-compose shortcut --list # List shortcutsSave typing with custom shortcuts:
# Default shortcut (created during install)
tfgrid up # Instead of: tfgrid-compose up
# Interactive mode - easy menu-driven interface
tfgrid-compose shortcut
# 1) Create a new shortcut
# 2) Remove a shortcut
# 3) List all shortcuts
# 4) Reset to default (tfgrid)
# 5) Exit
# Or create directly
tfgrid-compose shortcut tf
tf up # Even shorter!
# List all shortcuts
tfgrid-compose shortcut --list
# Remove a shortcut
tfgrid-compose shortcut --remove tf# 1. Setup context
echo "app: ../tfgrid-ai-agent" > .tfgrid-compose.yaml
# 2. Deploy
tfgrid-compose up
# 3. Use AI agent
tfgrid-compose create
# Follow prompts: name, duration, prompt
# 4. Monitor
tfgrid-compose projects
tfgrid-compose monitor my-project
# 5. Cleanup
tfgrid-compose stop my-project
tfgrid-compose downComplete deployment flow:
- ✅ Validates prerequisites and configuration
- ✅ Plans infrastructure with Terraform
- ✅ Provisions VM on ThreeFold Grid
- ✅ Configures WireGuard networking
- ✅ Waits for SSH to be ready
- ✅ Runs Ansible playbooks
- ✅ Deploys application source code
- ✅ Runs deployment hooks (setup → configure → healthcheck)
- ✅ Verifies deployment success
- ✅ Saves state for management
Total time: 2-3 minutes ⚡
- Quick Start Guide - Get started in 5 minutes
- AI Agent Guide - Complete AI agent integration guide
- Context File Usage - Using
.tfgrid-compose.yamlfor simpler commands
- TODO - Roadmap and future features
- Implementation Summary - Development notes
- Contributing - How to contribute
See full pattern documentation above or run:
tfgrid-compose patterns# Validation tests
./tests/test-validation.sh
# Full lifecycle test
make up APP=../tfgrid-ai-agent
make status APP=../tfgrid-ai-agent
make down APP=../tfgrid-ai-agentFull guide: docs.tfgrid.studio/troubleshooting/guide
Quick fixes:
- Missing prerequisites:
tfgrid-compose upwill tell you what's missing - Existing deployment:
tfgrid-compose down <app>then redeploy - State corruption:
rm -rf .tfgrid-compose/(⚠️ removes state)
We welcome contributions! Please see our Contributing Guide and Code of Conduct.
Quick start:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
Security issues: See our Security Policy
Apache 2.0 - See LICENSE file
Part of: TFGrid Studio
Status: ✅ Complete First Layer
Version: 0.13.4
Patterns: 3/3 Production Ready
All deployment patterns complete and ready for production! 🚀
- 📚 Documentation: docs.tfgrid.studio
- 🐛 Issues: GitHub Issues
- 💬 Discussions: GitHub Discussions
- 📧 Contact: tfgrid.studio/contact
- 🌐 Main Site: tfgrid.studio
- 📝 Changelog: CHANGELOG.md