A modular Go-based orchestrator for provisioning KVM resources, managing cloud mining contracts, and integrating with cloud providers like AWS, GCP, Azure, and Terraform.
- Go 1.21+
- SQLite3
- Libvirt (for KVM)
- AWS/GCP/Azure CLI or Terraform installed (optional)
.
├── main.go # App entrypoint
├── api/
│ └── provision.go # HTTP handlers
├── db/
│ └── db.go # SQLite logic
├── internal/
│ ├── orchestrator.go # Provisioning workflow
│ └── config.go # Config loader
├── types/
│ └── types.go # Shared types (JobStatus, Config, Customer)
├── config.json # Your configuration
└── kvm_manager.db # Auto-created SQLite DB
git clone https://github.com/yourname/kvm-manager
cd kvm-manager
go mod tidy
go build -o kvm-manager
Create a config.json
file in root:
{
"region": "us-east-1",
"s3_bucket_name": "cloud-hashrate",
"sales_team_net": "192.168.100.0/24",
"email_domain": "hashcloud.io",
"auth_token": "supersecrettoken"
}
Or set path:
export CONFIG_PATH=/path/to/config.json
./kvm-manager
This launches an HTTP server on :8080
with:
POST /provision
— Starts the provisioning workflowGET /status
— Returns current job statusGET /history
— Returns recent provisioning logs
Use curl or Postman:
curl -X POST http://localhost:8080/provision \
-H "Authorization: Bearer supersecrettoken"
Replace stub logic in internal/orchestrator.go
:
func provisionCloudHashrate() error {
// Example: Run Terraform or GCP SDK logic
return nil
}
Split logic into interfaces like:
type CloudProvider interface {
Provision(customer Customer) error
}
Then register your providers and choose dynamically.
Extend syncWithInfra()
to send emails, webhooks, or Slack updates.
- API auth per-user/token
- Web dashboard
- Kubernetes operator integration
- Advanced billing sync
MIT I guess
Made with ❤️ for hybrid compute orchestration.