Skip to content

Commit 4a58f16

Browse files
committed
Initial commit: Runner Codes - Secure code execution with Firecracker
- Unified CLI (infra.operator) with host, guest, rootfs, snapshot, api commands - Support for 45+ programming languages - Vsock communication between host and guest - S3-backed rootfs and snapshot storage - HTTP API for code execution - Docusaurus documentation site
0 parents  commit 4a58f16

344 files changed

Lines changed: 96700 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Binaries
2+
bin/
3+
*.exe
4+
*.exe~
5+
*.dll
6+
*.so
7+
*.dylib
8+
9+
# Test binary
10+
*.test
11+
12+
# Output of go coverage tool
13+
*.out
14+
15+
# Dependency directories
16+
vendor/
17+
18+
# Go workspace file
19+
go.work
20+
21+
# IDE
22+
.idea/
23+
.vscode/
24+
*.swp
25+
*.swo
26+
27+
# OS
28+
.DS_Store
29+
Thumbs.db
30+
31+
# Firecracker artifacts (large files)
32+
rootfs/*.ext4
33+
rootfs/vmlinux
34+
rootfs/guest-runner
35+
rootfs/guest-runner-*
36+
37+
# Runtime files
38+
/tmp/
39+
*.sock
40+
*.log
41+
42+
# Snapshots
43+
snapshots/
44+
45+
# Local config
46+
.env
47+
.env.local
48+
49+
# AWS artifacts (SENSITIVE - never commit)
50+
aws/keys/
51+
aws/.instance-id
52+
aws/.public-ip
53+
aws/.ami-id
54+
aws/.sg-id
55+
*.pem
56+
57+
# Node modules
58+
node_modules/
59+
60+
# Docusaurus
61+
docs/docusaurus/.docusaurus/
62+
docs/docusaurus/build/
63+
docs/mintlify/node_modules/
64+
65+
# Coverage
66+
coverage.out
67+
68+
# Claude instructions (may contain secrets)
69+
CLAUDE.md
70+
71+
# Scripts with credentials
72+
scripts/benchmark-on-demand.sh

Makefile

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# LLM-FireSandbox Makefile
2+
# Build automation for host-agent, guest-runner, vsock-proxy and infra.operator
3+
4+
.PHONY: all build clean test help
5+
.PHONY: build-host-agent build-guest-runner build-proxy build-cli
6+
.PHONY: build-guest-runner-amd64 build-guest-runner-arm64
7+
8+
# Directories
9+
BIN_DIR := bin
10+
ROOTFS_DIR := rootfs
11+
12+
# Go build flags
13+
GO := go
14+
GOFLAGS := -ldflags="-s -w"
15+
16+
# Architecture detection
17+
ARCH := $(shell uname -m)
18+
ifeq ($(ARCH),x86_64)
19+
GUEST_GOARCH := amd64
20+
else ifeq ($(ARCH),aarch64)
21+
GUEST_GOARCH := arm64
22+
else ifeq ($(ARCH),arm64)
23+
GUEST_GOARCH := arm64
24+
else
25+
GUEST_GOARCH := amd64
26+
endif
27+
28+
# Default target
29+
all: build
30+
31+
# Help
32+
help:
33+
@echo "LLM-FireSandbox Build System"
34+
@echo ""
35+
@echo "Usage: make [target]"
36+
@echo ""
37+
@echo "Targets:"
38+
@echo " all Build all components"
39+
@echo " build Build all components"
40+
@echo " build-host-agent Build host-agent for current OS"
41+
@echo " build-guest-runner Build guest-runner for detected guest arch ($(GUEST_GOARCH))"
42+
@echo " build-guest-runner-amd64 Build guest-runner for x86_64"
43+
@echo " build-guest-runner-arm64 Build guest-runner for ARM64"
44+
@echo " build-proxy Build vsock-proxy"
45+
@echo " build-cli Build infra.operator CLI"
46+
@echo " build-cli-linux Build infra.operator CLI for Linux"
47+
@echo " clean Remove built binaries"
48+
@echo " test Run tests"
49+
@echo " deps Download Go dependencies"
50+
@echo ""
51+
@echo "infra.operator CLI commands:"
52+
@echo " infra.operator rootfs create --lang python"
53+
@echo " infra.operator snapshot create --lang python"
54+
@echo " infra.operator run --lang python --code 'print(1)'"
55+
@echo " infra.operator api --port 8080"
56+
@echo " infra.operator benchmark --all"
57+
@echo ""
58+
@echo "Detected guest architecture: $(GUEST_GOARCH)"
59+
60+
# Create directories
61+
$(BIN_DIR):
62+
mkdir -p $(BIN_DIR)
63+
64+
$(ROOTFS_DIR):
65+
mkdir -p $(ROOTFS_DIR)
66+
67+
# Build all
68+
build: $(BIN_DIR) $(ROOTFS_DIR) build-host-agent build-guest-runner build-proxy build-cli
69+
@echo "Build complete!"
70+
@echo ""
71+
@echo "Binaries:"
72+
@ls -la $(BIN_DIR)/
73+
@echo ""
74+
@echo "Guest runner (for rootfs):"
75+
@ls -la $(ROOTFS_DIR)/guest-runner 2>/dev/null || echo " Not built yet"
76+
77+
# Build infra.operator CLI
78+
build-cli: $(BIN_DIR)
79+
@echo "Building infra.operator CLI..."
80+
$(GO) build $(GOFLAGS) -o $(BIN_DIR)/infra.operator ./cmd/infra.operator
81+
@echo "Built: $(BIN_DIR)/infra.operator"
82+
83+
# Build infra.operator for Linux (for deployment)
84+
build-cli-linux: $(BIN_DIR)
85+
@echo "Building infra.operator CLI for Linux/amd64..."
86+
GOOS=linux GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(BIN_DIR)/infra.operator-linux-amd64 ./cmd/infra.operator
87+
@echo "Built: $(BIN_DIR)/infra.operator-linux-amd64"
88+
89+
# Build host-agent (runs on host)
90+
build-host-agent: $(BIN_DIR)
91+
@echo "Building host-agent..."
92+
cd host-agent && $(GO) build $(GOFLAGS) -o ../$(BIN_DIR)/host-agent .
93+
@echo "Built: $(BIN_DIR)/host-agent"
94+
95+
# Build guest-runner for detected architecture
96+
build-guest-runner: $(ROOTFS_DIR)
97+
@echo "Building guest-runner for Linux/$(GUEST_GOARCH)..."
98+
cd guest-runner && GOOS=linux GOARCH=$(GUEST_GOARCH) $(GO) build $(GOFLAGS) -o ../$(ROOTFS_DIR)/guest-runner .
99+
@echo "Built: $(ROOTFS_DIR)/guest-runner ($(GUEST_GOARCH))"
100+
101+
# Build guest-runner for x86_64
102+
build-guest-runner-amd64: $(ROOTFS_DIR)
103+
@echo "Building guest-runner for Linux/amd64..."
104+
cd guest-runner && GOOS=linux GOARCH=amd64 $(GO) build $(GOFLAGS) -o ../$(ROOTFS_DIR)/guest-runner-amd64 .
105+
@echo "Built: $(ROOTFS_DIR)/guest-runner-amd64"
106+
107+
# Build guest-runner for ARM64
108+
build-guest-runner-arm64: $(ROOTFS_DIR)
109+
@echo "Building guest-runner for Linux/arm64..."
110+
cd guest-runner && GOOS=linux GOARCH=arm64 $(GO) build $(GOFLAGS) -o ../$(ROOTFS_DIR)/guest-runner-arm64 .
111+
@echo "Built: $(ROOTFS_DIR)/guest-runner-arm64"
112+
113+
# Build vsock-proxy
114+
build-proxy: $(BIN_DIR)
115+
@echo "Building vsock-proxy..."
116+
cd proxy && $(GO) build $(GOFLAGS) -o ../$(BIN_DIR)/vsock-proxy .
117+
@echo "Built: $(BIN_DIR)/vsock-proxy"
118+
119+
# Download dependencies
120+
deps:
121+
@echo "Downloading dependencies..."
122+
cd host-agent && $(GO) mod download
123+
cd guest-runner && $(GO) mod download
124+
cd proxy && $(GO) mod download
125+
@echo "Dependencies downloaded"
126+
127+
# Run tests
128+
test:
129+
@echo "Running tests..."
130+
cd host-agent && $(GO) test -v ./...
131+
cd guest-runner && $(GO) test -v ./...
132+
cd proxy && $(GO) test -v ./...
133+
134+
# Clean
135+
clean:
136+
@echo "Cleaning..."
137+
rm -rf $(BIN_DIR)
138+
rm -f $(ROOTFS_DIR)/guest-runner
139+
rm -f $(ROOTFS_DIR)/guest-runner-amd64
140+
rm -f $(ROOTFS_DIR)/guest-runner-arm64
141+
@echo "Cleaned"
142+
143+
# Tidy go modules
144+
tidy:
145+
cd host-agent && $(GO) mod tidy
146+
cd guest-runner && $(GO) mod tidy
147+
cd proxy && $(GO) mod tidy

0 commit comments

Comments
 (0)