Terraphim GitHub Runner - Setup Guide
Complete guide for setting up and deploying the Terraphim GitHub Runner.
Table of Contents
- Prerequisites
- Installation
- Configuration
- GitHub Integration
- Firecracker Setup
- LLM Configuration
- Testing
- Deployment
- Troubleshooting
Prerequisites
System Requirements
- OS: Linux (Ubuntu 20.04+ recommended)
- RAM: 4GB+ minimum
- CPU: 2+ cores recommended
- Disk: 10GB+ free space
Software Dependencies
# Rust toolchain
|
# Firecracker (via fcctl-web)
# See Firecracker Setup section below
# Ollama (optional, for LLM features)
|
# GitHub CLI (optional, for setup)
|
|
Installation
1. Clone Repository
2. Build Server
# Build with Ollama support (recommended)
# Or build without LLM features
3. Verify Installation
Configuration
Environment Variables
Create /etc/terraphim/github-runner.env:
# Server Configuration
PORT=3000
HOST=0.0.0.0
# GitHub Integration
GITHUB_WEBHOOK_SECRET=your_webhook_secret_here
GITHUB_TOKEN=ghp_your_github_token_here
# Firecracker Integration
FIRECRACKER_API_URL=http://127.0.0.1:8080
FIRECRACKER_AUTH_TOKEN=your_jwt_token_here
# LLM Configuration
USE_LLM_PARSER=true
OLLAMA_BASE_URL=http://127.0.0.1:11434
OLLAMA_MODEL=gemma3:4b
# Repository
REPOSITORY_PATH=/var/lib/terraphim/reposLoad Environment
GitHub Integration
1. Create Webhook Secret
# Generate secure secret
2. Configure GitHub Repository
# Set webhook
3. Create Test Workflow
Create .github/workflows/test.yml:
name: Terraphim Test
on:
pull_request:
branches:
push:
branches:
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Environment
run: |
echo "Running in Terraphim Firecracker VM"
uname -a
- name: List Workspace
run: ls -la /workspace
- name: Run Commands
run: |
echo "✓ Step 1 passed"
echo "✓ Step 2 passed"Firecracker Setup
Option 1: Using fcctl-web (Recommended)
# Clone fcctl-web
# Build and run
Option 2: Direct Firecracker
# Install Firecracker
# Test Firecracker
Verify Firecracker API
Expected response:
LLM Configuration
Option 1: Ollama (Local, Free)
# Install Ollama
|
# Start Ollama service
&
# Pull model
# Verify
Option 2: OpenRouter (Cloud, Paid)
# Get API key from https://openrouter.ai/keys
# Configure environment
Test LLM Integration
# Start server with LLM
USE_LLM_PARSER=true \
Testing
1. Start Server
GITHUB_WEBHOOK_SECRET=test_secret \
2. Send Test Webhook
= b
=
=
=
3. Check Logs
# Should show:
# ✅ Webhook received
# 🤖 LLM-based workflow parsing enabled
# 🔧 Initializing Firecracker VM provider
# âš¡ Creating VmCommandExecutor
# 🎯 Creating SessionManager
# Allocated VM fc-vm-<UUID>
# Executing command in Firecracker VM
# Workflow completed successfullyDeployment
Systemd Service
Create /etc/systemd/system/terraphim-github-runner.service:
[Unit]
Description=Terraphim GitHub Runner Server
After=network.target fcctl-web.service
Requires=fcctl-web.service
[Service]
Type=simple
User=terraphim
Group=terraphim
WorkingDirectory=/opt/terraphim-github-runner
EnvironmentFile=/etc/terraphim/github-runner.env
ExecStart=/opt/terraphim-github-runner/terraphim_github_runner_server
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.targetEnable and start:
Docker Deployment
Create Dockerfile:
FROM rust:1.75 as builder
WORKDIR /app
COPY . .
RUN cargo build --release -p terraphim_github_runner_server --features ollama
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /app/target/release/terraphim_github_runner_server /usr/local/bin/
EXPOSE 3000
ENV PORT=3000
ENV HOST=0.0.0.0
ENTRYPOINT ["terraphim_github_runner_server"]Build and run:
Nginx Reverse Proxy
Create /etc/nginx/sites-available/terraphim-runner:
server {
listen 443 ssl http2;
server_name your-server.com;
ssl_certificate /etc/ssl/certs/your-cert.pem;
ssl_certificate_key /etc/ssl/private/your-key.pem;
location /webhook {
proxy_pass http://localhost:3000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}Enable:
Troubleshooting
Server Won't Start
# Check logs
# Common issues:
# - Port already in use: Change PORT variable
# - Missing environment: Check all required vars are set
# - Firecracker not running: Start fcctl-web firstWebhook Returns 403
# Verify secret matches
# Check GitHub webhook settings
# Test signature manually
LLM Parsing Fails
# Check Ollama is running
# Pull required model
# Test LLM directly
Firecracker VM Fails
# Check Firecracker logs
# Verify API accessibility
# Check available resources
High Memory Usage
# Monitor processes
# Check VM count
|
# Release stuck VMs
Monitoring
Logs
# Real-time logs
# Last 100 lines
# Logs from current boot
Metrics
Consider adding Prometheus metrics:
use ;
lazy_static! Alerts
Configure alerts for:
- Server down (heartbeat failure)
- High error rate (>5% failures)
- Slow execution (>60s per workflow)
- VM exhaustion (no available VMs)
Support
- Issues: https://github.com/terraphim/terraphim-ai/issues
- Docs: https://github.com/terraphim/terraphim-ai/tree/main/docs
- Discord: Join our Discord
Next Steps
- ✅ Install Firecracker and Ollama
- ✅ Build and configure server
- ✅ Set up GitHub webhook
- ✅ Test with sample workflow
- 🔄 Deploy to production
- 🔄 Configure monitoring
- 🔄 Optimize performance
See Architecture Documentation for deep dive into system design.