| name | hetzner-temp-host |
| description | Automate deployment of services from GitHub repositories to temporary Hetzner Cloud hosts with ZeroTier integration. Use this skill when users need to quickly spin up a service from a GitHub repo on a disposable VM, connected to an existing ZeroTier network. Supports Docker Compose deployments with automatic health checks. |
Hetzner Temporary Host
Overview
Rapidly deploy services from GitHub repositories to temporary Hetzner Cloud VMs with automatic ZeroTier network integration. This skill automates the entire workflow: provision a VM, join it to your existing ZeroTier network, clone a GitHub repo, deploy with Docker Compose, and verify the service is healthy. Perfect for testing, demos, or temporary service deployments.
When to Use This Skill
Use this skill when users request:
- Deploying a service from GitHub to a temporary server
- Quick testing of containerized applications in the cloud
- Creating disposable demo environments
- Deploying services to a specific ZeroTier network
- Setting up temporary infrastructure that can be easily torn down
- Running short-lived services without permanent infrastructure
Quick Start
To deploy a service from GitHub to a temporary host:
- Set required configuration:
- Hetzner Cloud API token (from https://console.hetzner.cloud/)
- ZeroTier API token (from https://my.zerotier.com/account)
- ZeroTier network ID (from existing network)
- GitHub repository URL
- Copy the Terraform template from
assets/terraform-hetzner-temp-host/to working directory - Configure SSH key path (defaults to
~/.ssh/id_ed25519) - Deploy using
scripts/deploy_host.shor manually with Terraform - Service automatically deploys via Docker Compose after host provisioning
- Health checks verify service is running correctly
Core Capabilities
1. Host Configuration
The Terraform templates support flexible host configurations:
Server Types (CCX Line):
ccx13: 2 vCPU, 8GB RAM, 80GB NVMe (~$8.90/month, ~$0.012/hour) - Defaultccx23: 4 vCPU, 16GB RAM, 160GB NVMe (~$17.80/month, ~$0.025/hour)ccx33: 8 vCPU, 32GB RAM, 240GB NVMe (~$35.60/month, ~$0.049/hour)
Datacenters:
hillsboro: Hillsboro, OR, USA (hil-dc1) - Defaultsingapore: Singapore (sin-dc1)germany: Falkenstein, Germany (fsn1-dc14)
Example Configuration:
host_name = "temp-api-server"
server_type = "ccx13"
datacenter = "hillsboro"
github_repo_url = "https://github.com/user/my-service"
zerotier_network = "1c33c1ced02a5a44"
2. Service Deployment
Docker Compose Workflow:
- Host provisioned on Hetzner Cloud
- Docker and Docker Compose automatically installed
- GitHub repository cloned to
/opt/app docker compose up -dexecuted in repo directory- Health checks verify service started successfully
- Connection details provided in outputs
Requirements:
- Repository must contain a
docker-compose.ymlorcompose.yamlfile - Service should expose health check endpoint (optional but recommended)
- Public repositories work out of the box
- Private repositories require SSH key or access token configuration
Supported Deployment Patterns:
- Single container services
- Multi-container applications
- Services with databases and dependencies
- Applications with volume mounts
- Services requiring environment variables (via .env file in repo)
3. ZeroTier Integration
Join Existing Network:
- Connects to your pre-configured ZeroTier network
- Automatically installs ZeroTier One client
- Joins specified network and waits for authorization
- Host becomes accessible via ZeroTier IP
- Can be authorized manually or automatically (depending on network settings)
Configuration Methods:
Method A: Environment Variable (Recommended for security)
export ZEROTIER_NETWORK_ID='1c33c1ced02a5a44'
export ZEROTIER_API_TOKEN='your-zerotier-api-token'
export HCLOUD_TOKEN='your-hetzner-api-token'
Method B: Terraform Variables
zerotier_network = "1c33c1ced02a5a44"
zerotier_api_token = "your-zerotier-api-token"
Method C: Mixed (Network ID in config, token in env)
export ZEROTIER_API_TOKEN='your-zerotier-api-token'
export HCLOUD_TOKEN='your-hetzner-api-token'
zerotier_network = "1c33c1ced02a5a44"
Authorization:
- If network has auto-authorization enabled, host joins automatically
- Otherwise, manually authorize at https://my.zerotier.com
- Check authorization status:
zerotier-cli listnetworks
4. Health Checks
Automatic Service Verification:
- Checks that Docker containers are running
- Optionally pings HTTP/HTTPS health endpoint
- Verifies ZeroTier connectivity
- Reports status in Terraform outputs
Health Check Options:
# Basic check (Docker containers running)
health_check_enabled = true
# HTTP endpoint check
health_check_url = "http://localhost:8080/health"
health_check_url = "http://localhost:3000/api/status"
# Disable health checks
health_check_enabled = false
Example Health Check Output:
Outputs:
health_status = {
"docker_running" = true
"containers_up" = 3
"endpoint_healthy" = true
"zerotier_connected" = true
}
5. Deployment Methods
Method A: Using the Helper Script (Recommended)
The scripts/deploy_host.sh script automates the entire deployment:
# Copy script to working directory
cp scripts/deploy_host.sh .
chmod +x deploy_host.sh
# Set required tokens
export HCLOUD_TOKEN='your-hetzner-api-token'
export ZEROTIER_API_TOKEN='your-zerotier-api-token'
export ZEROTIER_NETWORK_ID='your-network-id'
# Deploy with repository URL
./deploy_host.sh https://github.com/user/my-service
# Deploy with custom configuration
./deploy_host.sh https://github.com/user/my-api my-api-host ccx23 singapore
The script will:
- Verify API tokens and network ID are set
- Verify SSH key pair exists
- Generate
terraform.tfvarswith configuration - Initialize Terraform
- Show plan and prompt for confirmation
- Deploy host and join ZeroTier network
- Clone repo and deploy with Docker Compose
- Run health checks
- Display connection and service information
Method B: Manual Deployment
For more control:
Copy Terraform templates:
cp -r assets/terraform-hetzner-temp-host/* ./Create terraform.tfvars:
hcloud_token = "your-hetzner-api-token" zerotier_api_token = "your-zerotier-api-token" zerotier_network = "1c33c1ced02a5a44" host_name = "my-temp-host" github_repo_url = "https://github.com/user/my-service" server_type = "ccx13" datacenter = "hillsboro" ssh_private_key_path = "~/.ssh/id_ed25519" health_check_enabled = true health_check_url = "http://localhost:8080/health"Deploy:
terraform init terraform plan terraform applyView outputs:
terraform output terraform output zerotier_ip terraform output service_url
6. Accessing the Host and Service
SSH Access:
# Via public IP
ssh root@<public-ip>
# Via ZeroTier IP (after authorization)
ssh root@<zerotier-ip>
# Get SSH command from Terraform
terraform output -raw ssh_command
Service Access:
# Get service URL
terraform output service_url
# Access via public IP
curl http://<public-ip>:<port>
# Access via ZeroTier (from any device on the network)
curl http://<zerotier-ip>:<port>
Docker Management:
# View running containers
ssh root@<host> 'docker ps'
# View logs
ssh root@<host> 'docker compose -f /opt/app/docker-compose.yml logs'
# Restart services
ssh root@<host> 'docker compose -f /opt/app/docker-compose.yml restart'
7. Host Management
Check service status:
terraform output health_status
ssh root@<host> 'docker ps'
ssh root@<host> 'zerotier-cli listnetworks'
Redeploy service:
ssh root@<host> 'cd /opt/app && git pull && docker compose down && docker compose up -d'
Destroy host:
terraform destroy
Cost Management:
- Hourly billing means you only pay for actual usage
- Always destroy temporary hosts when done
- ccx13 costs
$0.012/hour ($0.29/day) - Set calendar reminders to tear down test environments
Common Workflows
Workflow 1: Deploy a Simple Web Service
User request: "Deploy my web app from GitHub to a temporary server on my ZeroTier network"
- Get ZeroTier network ID from https://my.zerotier.com
- Set environment variables:
export HCLOUD_TOKEN='...' export ZEROTIER_API_TOKEN='...' export ZEROTIER_NETWORK_ID='...' - Use helper script:
./deploy_host.sh https://github.com/user/webapp my-webapp - Authorize host on ZeroTier Central if needed
- Access service via ZeroTier IP
- Destroy when done:
terraform destroy
Workflow 2: Test a Multi-Container Application
User request: "I need to test my microservices stack with Redis and Postgres before deploying to production"
- Ensure GitHub repo has complete
docker-compose.ymlwith all services - Deploy to temporary host:
./deploy_host.sh https://github.com/user/microservices test-stack ccx23 - Health check verifies all containers are running
- Access services via public IP or ZeroTier
- Run integration tests
- Tear down:
terraform destroy
Workflow 3: Demo Environment for Client
User request: "Create a temporary demo environment for a client presentation tomorrow"
- Deploy service to temporary host:
./deploy_host.sh https://github.com/company/demo-app client-demo - Get public IP from outputs:
terraform output public_ip - Share URL with client:
http://<public-ip>:<port> - After demo, destroy environment:
terraform destroy - Total cost: ~$0.50 for 2-day deployment
Workflow 4: Test Feature Branch
User request: "I want to deploy a feature branch to test it in a real environment"
- Push feature branch to GitHub
- Modify
github_repo_urlin terraform.tfvars:github_repo_url = "https://github.com/user/repo#feature-branch" - Deploy:
terraform apply - Test the feature via ZeroTier network
- Destroy when testing complete
Troubleshooting
SSH key pair not found:
- Ensure both
~/.ssh/id_ed25519and~/.ssh/id_ed25519.pubexist - Generate:
ssh-keygen -t ed25519 - Or set custom path:
export SSH_KEY_PATH="/path/to/key"
GitHub clone fails:
- Public repos: Check URL is correct
- Private repos: Add SSH key to GitHub or use personal access token in URL
- Format:
https://username:token@github.com/user/repo
Docker Compose not found in repo:
- Verify repo contains
docker-compose.ymlorcompose.yaml - Check file is in root directory of repo
- Test locally:
git clone <repo> && cd <repo> && docker compose config
Containers fail to start:
- Check logs:
ssh root@<host> 'docker compose -f /opt/app/docker-compose.yml logs' - Verify environment variables if needed (add .env file to repo)
- Check resource requirements match server type
- Verify all required ports are available
ZeroTier node not joining:
- Check network ID is correct
- Verify ZeroTier API token has permissions
- Wait 30-60 seconds for service to start
- Check status:
ssh root@<host> 'zerotier-cli listnetworks'
ZeroTier not authorized:
- Go to https://my.zerotier.com
- Find your network
- Authorize the new member
- Check authorization:
zerotier-cli listnetworks
Health checks failing:
- Verify containers are running:
docker ps - Check health endpoint URL is correct
- Ensure service is listening on correct port
- Try accessing directly:
curl http://localhost:<port> - Disable health checks temporarily:
health_check_enabled = false
Provisioner timeout:
- Increase timeout in main.tf provisioner blocks
- Check SSH connectivity manually
- Verify firewall rules allow SSH
- Check SSH key permissions:
chmod 600 ~/.ssh/id_ed25519
Resources
scripts/
deploy_host.sh: Complete deployment automation with validation and interactive promptshealth_check.sh: Service health verification script (used by Terraform provisioners)
assets/
terraform-hetzner-temp-host/: Terraform templates for temporary host deploymentmain.tf: Core infrastructure (server, firewall, ZeroTier, provisioning)variables.tf: Input variables with validation and defaultsoutputs.tf: Connection info, service details, health statusversions.tf: Terraform and provider requirementsterraform.tfvars.example: Example configuration
Best Practices
- Always destroy temporary hosts when finished to avoid unnecessary costs
- Use environment variables for secrets (tokens, keys) instead of hardcoding
- Enable health checks to verify successful deployment
- Tag hosts appropriately with descriptive names for easy identification
- Set reminders to tear down test environments after demos/testing
- Use ZeroTier for secure access instead of exposing services publicly
- Test locally first with
docker compose upbefore deploying to cloud - Monitor costs at https://console.hetzner.cloud/
- Use appropriate server sizes - start small, scale up if needed
- Document cleanup procedures for team members
Cost Examples
Based on Hetzner Cloud hourly billing:
| Scenario | Server | Duration | Cost |
|---|---|---|---|
| Quick test | ccx13 | 2 hours | ~$0.02 |
| Day of testing | ccx13 | 24 hours | ~$0.29 |
| Week demo | ccx13 | 7 days | ~$2.00 |
| Load testing | ccx23 | 4 hours | ~$0.10 |
| Client presentation | ccx13 | 3 days | ~$0.87 |
Remember: Costs accumulate while the host exists. Always terraform destroy when finished!