Skip to content

Scale-to-zero QEMU lab environment with Docker, Caddy, and Sablier. Automatically generates dynamic routes and session-based access for 1 to 100+ virtual machines.

License

Notifications You must be signed in to change notification settings

ncr-no/qemu-scale-to-zero-lab

Repository files navigation

QEMU Scale-to-Zero Lab

A scalable QEMU container deployment with scale-to-zero functionality using Sablier.

📁 Project Structure

├── render.py              # Template rendering script
├── Dockerfile            # Caddy with Sablier plugin
├── templates/            # Jinja2 templates
│   ├── docker-compose.j2 # Docker Compose template
│   └── Caddyfile.j2     # Caddy configuration template
└── output/              # Generated configuration files
    ├── docker-compose.yml
    └── Caddyfile

🚀 Usage

  1. Install dependencies:
pip install -r requirements.txt
  1. Generate configuration:
# Use defaults (6 containers, legacy boot, kali image, 2G RAM, 2 CPU cores)
python render.py

# Custom configuration
python render.py -n 10 --boot-image ubuntu --ram-size 4G --cpu-cores 4 --prefix vm
  1. Deploy:
cd output
docker-compose up -d

⚙️ Configuration Options

  • -n, --num-containers: Number of QEMU containers (default: 6)
  • --boot-mode: QEMU boot mode (legacy/uefi, default: legacy)
  • --boot-image: QEMU boot image (default: kali)
  • --ram-size: RAM size per container (default: 2G)
  • --cpu-cores: CPU cores per container (default: 2)
  • --prefix: Custom container name prefix (default: boot image name)

🔧 Features

  • ⚙️ Dynamically generated docker-compose.yml and Caddyfile for 1–100+ QEMU VMs
  • 💻 Per-container terminal access via Sablier and web browser
  • 🔁 Auto-scaling via sablier session lifecycle
  • 🔐 Secure routing with Caddy reverse proxy
  • 📦 Easy deployment with a single command

About

Scale-to-zero QEMU lab environment with Docker, Caddy, and Sablier. Automatically generates dynamic routes and session-based access for 1 to 100+ virtual machines.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published