BOSH Lite v2 is a Director VM running in VirtualBox (typically locally). It is managed via CLI v2. Internally CPI uses containers to emulate VMs which makes it an excellent choice for:
- General BOSH exploration without investing time and resources to configure an IaaS
- Development of releases (including BOSH itself)
- Testing releases locally or in CI
Follow below steps to get it running on locally on VirtualBox:
Check that your machine has at least 8GB RAM, and 100GB free disk space. Smaller configurations may work.
Install CLI v2
Known working version:
$ VBoxManage --version 5.1...
Note: If you encounter problems with VirtualBox networking try installing Oracle VM VirtualBox Extension Pack as suggested by Issue 202. Alternatively make sure you are on VirtualBox 5.1+ since previous versions had a network connectivity bug.
Install Director VM
$ git clone https://github.com/cloudfoundry/bosh-deployment ~/workspace/bosh-deployment $ mkdir -p ~/deployments/vbox $ cd ~/deployments/vbox
$ bosh create-env ~/workspace/bosh-deployment/bosh.yml \ --state ./state.json \ -o ~/workspace/bosh-deployment/virtualbox/cpi.yml \ -o ~/workspace/bosh-deployment/virtualbox/outbound-network.yml \ -o ~/workspace/bosh-deployment/bosh-lite.yml \ -o ~/workspace/bosh-deployment/bosh-lite-runc.yml \ -o ~/workspace/bosh-deployment/jumpbox-user.yml \ --vars-store ./creds.yml \ -v director_name="bosh-lite" \ -v internal_ip=192.168.50.6 \ -v internal_gw=192.168.50.1 \ -v internal_cidr=192.168.50.0/24 \ -v outbound_network_name=NatNetwork
Alias and log into the Director
$ bosh alias-env vbox -e 192.168.50.6 --ca-cert <(bosh int ./creds.yml --path /director_ssl/ca) $ export BOSH_CLIENT=admin $ export BOSH_CLIENT_SECRET=`bosh int ./creds.yml --path /admin_password`
Confirm that it works
$ bosh -e vbox env Using environment '192.168.50.6' as '?' Name: ... User: admin Succeeded
Optionally, set up a local route for
bosh sshcommands or accessing VMs directly
$ sudo route add -net 10.244.0.0/16 192.168.50.6 # Mac OS X $ sudo ip route add 10.244.0.0/16 via 192.168.50.6 # Linux (using iproute2 suite) $ sudo route add -net 10.244.0.0/16 gw 192.168.50.6 # Linux (using DEPRECATED route command) $ route add 10.244.0.0/16 192.168.50.6 # Windows
Deploy example Zookeeper deployment¶
Run through quick steps below or follow deploy workflow that goes through the same steps but with more explanation.
Update cloud config
$ bosh -e vbox update-cloud-config ~/workspace/bosh-deployment/warden/cloud-config.yml
$ bosh -e vbox upload-stemcell https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-trusty-go_agent?v=3468.17 \ --sha1 1dad6d85d6e132810439daba7ca05694cec208ab
Deploy example deployment
$ bosh -e vbox -d zookeeper deploy <(wget -O- https://raw.githubusercontent.com/cppforlife/zookeeper-release/master/manifests/zookeeper.yml)
Run Zookeeper smoke tests
$ bosh -e vbox -d zookeeper run-errand smoke-tests
- In case you need to SSH into the Director VM, see Jumpbox.
- In case VirtualBox VM shuts down or reboots, you will have to re-run
create-envcommand from above with
--recreateflag. The containers will be lost after a VM restart, but you can restore your deployment with
bosh cckcommand. Alternatively Pause the VM from the VirtualBox UI before shutting down VirtualBox host, or making your computer sleep.