Manage your 7 little bosh-lites with snowwhite

bosh-lite is a wonderful part of the BOSH toolchain – you provision a single VM one time and then bosh deploy creates Linux containers rather than full IaaS VMs. Super fast for development and super fast for CI pipelines for BOSH releases.

bosh-lite is popularly used locally via vagrant/virtualbox; but can also run on any AWS region thanks to the vagrant-aws plugin. This is great for people with smaller laptops, and great for sharing a running bosh-lite within your team or your CI system.

But then your team starts loosing track of who created each vagrant-based bosh-lite, which SSH keys let you SSH into the VM, and into which AWS account the bosh-lites are running (if you want to poke holes in its security groups, etc). Heck, you might just want to know "how many bosh-lites are we running here?"

We created snowwhite to coordinate all your bosh-lite deployments into a shared private git repo.

Getting started

snowwhite is a CLI that manages a communal git repo. To get started and create the initial git repo bosh-lites in the current folder:

curl https://raw.githubusercontent.com/cloudfoundry-community/snowwhite/master/installer.sh | bash

(see the README for other getting started options)

Next, edit the bosh-lites/.envrc to setup your AWS credentials and VPC/subnet info:

export PATH=$PATH:${PWD}/bin
export BOSH_CONFIG="${PWD}/.bosh_config"
export BOSH_AWS_ACCESS_KEY_ID=FIXME
export BOSH_AWS_SECRET_ACCESS_KEY=FIXME
export BOSH_LITE_SECURITY_GROUP=FIXME-sg-123456
export BOSH_LITE_KEYPAIR=FIXME-keypair
export BOSH_LITE_PRIVATE_KEY=sshkeys/bosh-lite.pem
export BOSH_LITE_SUBNET_ID=FIXME-subnet-123456
export BOSH_LITE_INSTANCE_TYPE=m3.2xlarge

Once you’ve commited changes and pushed your private bosh-lites git repo, other members of your team need to clone it to their machines.

If you use Github and the handy hub cli to create a private repo:

hub create -p
git push origin master

Usage

Inside the shared bosh-lites git repo is a bin/snowwhite script. Once you’ve added the bin/ folder to your $PATH you get a range of handy subcommands.

To create a new bosh-lite on AWS you simply run:

snowwhite new tutorial

It will create a subfolder deployments/tutorial and run the standard vagrant up --provider=aws command there. It will commit the .vagrant files and run git push automatically to ensure the new files are shared.

That’s right – it is sort of using your new bosh-lites repo as a database of bosh-lite/vagrant deployments.

If you look in your AWS console you’ll see a bosh-lite-tutorial VM.

To target the new bosh-lite and login for the first time, run:

snowwhite target tutorial

The output is as follows, and the default username/password is admin and admin:

+ bosh target 54.167.106.255 tutorial
Target set to `Bosh Lite Director'
Your username: admin
Enter password: [admin]
Logged in as `admin'

Your new bosh-lite needs a stemcell so next run:

bosh upload stemcell https://bosh.io/d/stemcells/bosh-warden-boshlite-ubuntu-trusty-go_agent --skip-if-exists

Hmm, probably could automate that. So in future perhaps you won’t need to do that. Seems silly to make you do it manually. But at least its a quick confirmation that your bosh-lite is working!

Bonus commands

You can SSH into the bosh-lite machine:

snowwhite ssh tutorial

You can see a list of all available bosh-lites within your shared bosh-lites repo:

snowwhite list

And finally, when you’ve had enough fun you can destroy it:

snowwhite destroy tutorial

This will also remove the deployments/tutorial folder, git commit, and git push the change.

Spread the word

twitter icon facebook icon linkedin icon