Developer Docs
For people working on SwarmCracker itself.
Repo Layout
Section titled “Repo Layout”cmd/├── swarmctl/ # Debug CLI (swarmctl service create, etc)├── swarmd-firecracker/ # Daemon (SwarmKit agent + executor)├── swarmcracker/ # Main CLI (cluster mgmt, service, VM, config)├── swarmcracker-agent/ # Remote deployment agent├── swarmcracker-cni/ # CNI network plugin└── get-join-token/ # Join token helper
pkg/├── apiversion/ # gRPC API versioning protocol├── executor/ # Turns SwarmKit tasks into Firecracker configs├── network/ # Bridges, TAP, VXLAN, NAT, CNI, discovery├── swarmkit/ # SwarmKit executor/controller integration├── image/ # OCI image extraction, rootfs preparation├── lifecycle/ # VM start/stop/configure logic├── jailer/ # Security sandbox (cgroups, seccomp)├── storage/ # Volumes, secrets, configs├── snapshot/ # VM state snapshots├── config/ # YAML config loading├── metrics/ # Prometheus metrics├── health/ # Health check server├── translator/ # Task → VMM config translation├── runtime/ # Runtime state management├── discovery/ # Consul/VXLAN peer auto-discovery├── types/ # Shared type definitions├── cni/ # CNI network allocator└── logging/ # Logging setup
infrastructure/├── ansible/ # Cluster deployment roles└── observability/ # Prometheus, Grafana configstest-automation/ # tests + multi-node lab (test-automation/multinode/)docs/ # Documentation (you are here)make allmake all builds the three runtime binaries:
go build -o build/swarmcracker ./cmd/swarmcrackergo build -o build/swarmd-firecracker ./cmd/swarmd-firecrackergo build -o build/swarmcracker-agent ./cmd/swarmcracker-agentThe debug CLI swarmctl is not part of make all; build it directly:
go build -o build/swarmctl ./cmd/swarmctlmake testUnit tests are in pkg/*/*_test.go. Integration tests need a cluster.
Test Cluster
Section titled “Test Cluster”make test-e2e runs the Go E2E suite against a local swarmd.
For a real multi-node cluster with microVMs placed on separate nodes, the single-host lab creates nested VMs and forms the cluster for you:
sudo test-automation/multinode/cluster-lab.sh up 2 # create + provision + clustersudo test-automation/multinode/cluster-lab.sh test # cross-host matrixsudo test-automation/multinode/cluster-lab.sh destroyAnsible remains the advanced/production option (infrastructure/ansible/).
Debugging
Section titled “Debugging”Executor Logs
Section titled “Executor Logs”sudo journalctl -u swarmcracker-worker -f # workersudo journalctl -u swarmcracker-manager -f # managerVM Issues
Section titled “VM Issues”# Check running VMsps aux | grep firecracker
# Check networkip link show swarm-br0ip link show swarm-br0-vxlanbridge fdb show dev swarm-br0-vxlanConsul
Section titled “Consul”curl http://127.0.0.1:8500/v1/catalog/service/swarmcracker-vxlanMaking Changes
Section titled “Making Changes”Network Code
Section titled “Network Code”pkg/network/manager.go handles bridge and TAP setup. vxlan.go is VXLAN-specific. Changes here affect how VMs communicate.
Executor
Section titled “Executor”pkg/swarmkit/executor.go is where SwarmKit tasks become VM configs. If you want to add new VM options, this is the spot.
cmd/swarmctl/main.go defines commands. cmd/swarmd-firecracker/main.go has daemon flags.
Testing Changes
Section titled “Testing Changes”- Build:
make all - Bring up a lab node:
sudo test-automation/multinode/cluster-lab.sh up 2 - Copy the new binary:
scp build/swarmd-firecracker root@<node-ip>:/tmp/ - Install + restart:
ssh root@<node-ip> "mv /tmp/swarmd-firecracker /usr/local/bin/ && systemctl restart swarmcracker-worker" - Check logs:
sudo journalctl -u swarmcracker-worker -f
- API Reference — gRPC API, versioning, services
- Package References — Per-package documentation
- Testing — Unit and e2e test details
- Architecture — SwarmKit integration specifics
- Contributing — PR guidelines
- Architecture Overview — System design