Implement stackbox down to stop and clean up the environment. With fully containerized libvirt, cleanup is simple: stop containers and optionally remove volumes. VMs inside the libvirt container are automatically removed when the container is removed.
Containerized Benefit: No need to manually clean up host VMs - everything is in containers!
Implementation
@cli.command()
@click.option('--volumes', is_flag=True, help='Also remove volumes (deletes all data including VMs)')
@click.confirmation_option(prompt='Stop the environment?')
def down(volumes):
"""Stop and remove environment.
With containerized libvirt, VMs are inside the libvirt container and are
automatically removed when the container is removed. No manual VM cleanup needed!
"""
config_dir = Path('.stackbox')
if not config_dir.exists():
click.echo("❌ No StackBox environment found in .stackbox/", err=True)
sys.exit(1)
orchestrator = compose.DockerComposeOrchestrator(config_dir)
click.echo("🛑 Stopping containers...")
orchestrator.down(remove_volumes=volumes)
if volumes:
click.echo(" Removed volumes (including VM disks)")
click.echo("✅ Environment stopped")
click.echo("\nTo restart: stackbox init ...")
Acceptance Criteria
Implement
stackbox downto stop and clean up the environment. With fully containerized libvirt, cleanup is simple: stop containers and optionally remove volumes. VMs inside the libvirt container are automatically removed when the container is removed.Containerized Benefit: No need to manually clean up host VMs - everything is in containers!
Implementation
Acceptance Criteria