When I was searching for a platform to run my personal blog, I made a list of requirements for this platform:
- The application should run on Cloud Foundry. In fact, I want to install Ghost using Dr. Nic's tutorial on Deploying Ghost blog on Cloud Foundry
- I want to run Cloud Foundry on my own hardware so I know how it works under the hood (and because I don't want to pay anyone to run it).
- There should be no licensing costs (again - pay as little as possible).
- Installing and administering OpenStack seems like overkill for this project.
It turns out this was a fairly restrictive list. Requirement 2 ruled out AWS and Pivotal Web Services. Requirement 3 ruled out vCenter (plus BOSH just doesn't work with bare ESXi anyway). Requirement 4 is fairly obvious.
Then I got to thinking:
bosh-lite is a great way to get BOSH and Cloud Foundry running quickly so you can dig in. It works with VirtualBox, VMWare Fusion, and AWS. It does this by using a pre-baked stemcell that these platforms just boot up and run.
vSphere Hypervisor (a.k.a. ESXi) is an easy to use and robust platform for running virtual machines. It's easy to install, runs on consumer-grade hardware, and requires very little maintenance.
VirtualBox has the ability to take an existing image and convert its back-end virtual disk to various formats - including an ESXi VMDK file.
Given these facts, we can actually get bosh-lite to run on ESXi Free in a few easy steps:
- Follow the instructions in the [bosh-lite](https://github.com/cloudfoundry/bosh-lite) README to get bosh-lite running in VirtualBox - right up to the point where you run "vagrant up".
- Log into the virtual machine and shut it down.
vagrant@bosh-lite:~$vagrant ssh vagrant@bosh-lite:~$sudo shutdown -h now
- Clone the virtual hard disk, converting it into a fixed ESXi VMDK:
sudo vboxmanage clonehd /data/jbudnack/VirtualBox\ VMs/bosh-lite_default_1401468204242_17042/boshlite-virtualbox-ubuntu1204ds-disk1.vmdk /data/jbudnack/VirtualBox\ VMs/cloned/bosh-lite-esxi.vmdk --format=VMDK --variant=Fixed,ESX
- On Your ESXi box, enable SSH: ![ESXi SSH](http://i.imgur.com/efYVW70.png)
- Using SFTP, upload the VMDK file to one of the datastores on your ESXi box.
jbudnack@Pegasus:/data/jbudnack/VirtualBox VMs/cloned$ sftp email@example.com Password: Connected to 10.150.0.50. sftp> cd /vmfs/volumes/ENTERPRISE\ 750\ L_DS1/ sftp> mput *.vmdk
- Create a new Virtual Machine, using the newly uploaded file as the back-end disk. **Important**: Ensure that this Virtual Machine has 2 virtual NICs. Also, you may want to put the 2nd adapter on its own virtual switch. ![ESXi VM](http://i.imgur.com/CEDVn8D.png)
- Start the virtual machine. Log into its console as vagrant (password: vagrant)
- Configure the network cards as follows in /etc/network/interfaces:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 10.150.0.70 #STATIC IP FOR YOUR ESXi VM NETWORK netmask 255.255.255.0 gateway 10.150.0.1 #DONT FORGET THE DEFAULT GATEWAY # # The primary network interface pre-up sleep 2 #VAGRANT-BEGIN # The contents below are automatically generated by Vagrant. Do not modify. auto eth1 iface eth1 inet static address 192.168.50.4 #DO NOT CHANGE THIS IP. netmask 255.255.255.0 #VAGRANT-END
- Restart the virtual machine. Once it is finished rebooting, try targeting your new bosh-lite vm:
jbudnack@Pegasus:/data/jbudnack/VirtualBox VMs/cloned$ bosh target https://10.150.0.70 Target already set to `Bosh Lite Director' jbudnack@Pegasus:/data/jbudnack/VirtualBox VMs/cloned$ bosh login Your username: admin Enter password: ***** Logged in as `admin' jbudnack@Pegasus:/data/jbudnack/VirtualBox VMs/cloned$ bosh status Config /home/jbudnack/.bosh_config Director Name Bosh Lite Director URL https://10.150.0.70:25555 Version 1.2200.0 (f71e2276) User admin UUID 1283c62e-8e7b-43c2-8f97-f42bf8aba812 CPI warden dns disabled compiled_package_cache enabled (provider: local) snapshots disabled Deployment not set
And there you go! If you plan on using this for a while, you might want to change the "vagrant" user's password, as well as the password of your director. You may also want to take this opportunity to snapshot this VM, in case you ever want to roll back to a clean bosh-lite instance.