bosh-stemcell

Tools for creating stemcells

Building a stemcell

Once-off manual steps:

  1. Upload a keypair called "bosh" to AWS that you'll use to connect to the remote vm later
  2. Create "bosh-stemcell" security group on AWS to allow SSH access to the stemcell (once per AWS account)
  3. Add instructions to set BOSH_AWS_... environment variables
  4. Install the vagrant plugins we use:

    vagrant plugin install vagrant-berkshelf
    vagrant plugin install vagrant-omnibus
    vagrant plugin install vagrant-aws       --plugin-version 0.3.0
    

Bring up the vagrant stemcell building VM

From a fresh copy of the bosh repo:

export BOSH_AWS_ACCESS_KEY_ID=YOUR-AWS-ACCESS-KEY
export BOSH_AWS_SECRET_ACCESS_KEY=YOUR-AWS-SECRET-KEY
cd bosh-stemcell
vagrant up local

Build the stemcell from inside the VM

Substitute <current_build> with the current build number, which can be found by looking at bosh artifacts

vagrant ssh -c '
  cd /bosh
  bundle install --local
  CANDIDATE_BUILD_NUMBER=<current_build> http_proxy=http://localhost:3142/ bundle exec rake stemcell:build[vsphere,centos,ruby]
' local

Run the stemcell locally with Fusion

VMware Fusion is the preferred local virtual environment. You can purchase it here. Once you have Fusion installed:

  • Unpack the stemcell tarball.
  • Rename the new image file to image.tgz and untar that as well. You should now have an image.ovf file.
  • Start VMware Fusion and import this file (File -> Import)
  • Save the imported OVF as image.vmwarevm in the tmp folder.
  • You should see a new VM in your VM library.
  • Double click that new VM and it should be booted.

Add the NIC

Before starting the VM in VirtualBox:

  1. Add a network interface (Virtual Machine > Settings > Add Device... > Network Adapter)
  2. Select NAT networking (the default)

Run the stemcell locally with VirtualBox

Import the VM

  • The stemcell is dropped into bosh/tmp/bosh-stemcell-???-vsphere-esxi-centos.tgz.
  • Untar that file. You now have a file named image.
  • Rename that to image.tgz, and untar that file. You now have a file named image.ovf.
  • Double click on that file to open it in VirtualBox.

Add the NIC

Before starting the VM in VirtualBox:

  1. Add a network interface (Settings > Network > Adapter 1 > Enable)
  2. Select NAT networking (the default)
  3. Click on advanced
  4. Click on Port Forwarding and enable the following rule:
    • Name: SSH
    • Protocol: TCP
    • Host IP: 127.0.0.1
    • Host Port: 3333
    • Guest IP: blank
    • Guest Port: 22

Boot the VM

Save the configuration and boot the VM. Once you're booted, login as root/c1oudc0w.

Configure network locally

Fusion

$ grep subnet /Library/Preferences/VMware\ Fusion/*/dhcpd.conf
/Library/Preferences/VMware Fusion/vmnet1/dhcpd.conf:subnet 172.16.0.0 netmask 255.255.255.0 {
/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf:subnet 172.16.210.0 netmask 255.255.255.0 {
ifconfig eth0 172.16.210.30/24 up
route add default gw 172.16.210.2 eth0

VirtualBox

You'll want to pick an IP that's not in use by your stemcell building vm. 10.0.2.30 should be fine.

ifconfig eth0 10.0.2.30/24 up
route add default gw 10.0.2.2 eth0

Test the network with ping 8.8.8.8