It seems that the teams over at Cloud Foundry give us too much credit. I spent days trying to get Cloud Foundry up and running because of minor snags and glitches. In addition, the documentation to make this all work doesn't exist in a single place, it's all outdated, or isn't descriptive enough. Hopefully this spoon feeding series tutorial will help get you there.
This tutorial will go over the steps it takes to deploy Cloud Foundry on vSphere. Here are the proper steps:
1. Install these core packages. I added the mysql and postgresql development libraries to make sure headers work successfully on deployment.
sudo apt-get update
sudo apt-get -y install libsqlite3-dev genisoimage libxml2-dev libxslt-dev libpq-dev libmysqlclient15-dev git
2. Install RVM with the latest Ruby and Ruby 2.0.0-p481. We are going to use Ruby 2.0.0 because I read on another blog post about the deploy having issues with Ruby 2.1. I never tested it out for myself, so I'm doing this to be safe.
\curl -sSL https://get.rvm.io | bash -s stable --ruby source /home/administrator/.rvm/scripts/rvm rvm install 2.0.0 rvm use 2.0.0 rvm --default use 2.0.0
If you do ruby -v, you should see the following:
administrator@originalbosh:~$ ruby -v ruby 2.0.0p481 (2014-05-08 revision 45883) [x86_64-linux]
3. Install the BOSH deployer Ruby gems
gem install bosh_cli gem install bosh_cli_plugin_micro
4. Create 2 folders within the vSphere Web Client. Name them bosh_vms and bosh_templates. Move your Ubuntu image to the bosh_vms folder
5. For a production deployment, I would create a brand new set of datastores. Especially if you want to do persistent and non-persistent disks. Since this is a lab, I'm going to do it my way. Go to one of your datastores and create a new folder and call it bosh_disk_storage.
6. We have to create a resource pool. I named mine bosh. I couldn't figure out how to make this deployment work without a resource pool but it does successfully run with a resource pool mentioned. Documentation says to remove resource_pool and the : after the cluster in the micro_bosh.yml, but it didn't work for me.
7. We need a few different directories created for our folder structure. I found this to be easiest by creating a bosh folder at root and doing everything inside of there. Change out administrator:administrator with your ubuntu user
cd / sudo mkdir bosh sudo chmod 755 bosh
sudo chown administrator:administrator bosh cd bosh mkdir deployments mkdir releases mkdir stemcells
8. Create a new deployment. Go to the deployments directory and make a new folder called micro01. We also need to create a micro_bosh.yml file and paste the next step into it.
cd deployments mkdir micro01 nano micro01/micro_bosh.yml
9. Now you should be sitting at an editor screen ready to copy and paste the pieces below (or download the yml below). The yml is very picky about indentation, so don't screw this up. A single space can break your deployment. If you want to use different datastore patterns, read here.
--- name: MicroBOSH01 network: ip: 192.168.50.166 #IP Address to assign to micro BOSH netmask: 255.255.255.0 #netmask gateway: 192.168.50.1 #gateway for microBOSH dns: # The micro-bosh VM has the following DNS entries in its /etc/resolv.com, allowing it to resolve, for example, IaaS FQDNs. - 192.168.50.5 #your internal DNS Server. add another line with a '-' for multiple entries cloud_properties: name: Servers #this is the PORTGROUP name on your vSwitch or VDS resources: # this seems like good sizing for microbosh persistent_disk: 16384 cloud_properties: ram: 8192 disk: 16384 cpu: 4 cloud: plugin: vsphere properties: agent: ntp: - 192.168.50.5 #NTP servers can be internal or external - 0.north-america.pool.ntp.org vcenters: - host: kcvcenter.kendrickcoleman.c0m #IP or FQDN of the vCenters you want microBOSH to know about user: kcoleman #username or do DOMAIN\username password: mypassword #your secret password datacenters: - name: LouisvilleLab #datacenter name vm_folder: bosh_vms #first folder we created template_folder: bosh_templates #second folder we created disk_path: bosh_disk_storage #the diskpath we created under the datastore datastore_pattern: DS411_NFS_1 #the datastore that holds the diskpath persistent_datastore_pattern: DS411_NFS_1 #choose a different datastore for persistant disks allow_mixed_datastores: true clusters: - ShuttleXPC: #your cluster name resource_pool: bosh #the resource pool name apply_spec: properties: vcenter: host: kcvcenter.kendrickcoleman.c0m #this is the vCenter where microBOSH will be deployed to user: kcoleman password: mypassword datacenters: - name: LouisvilleLab vm_folder: bosh_vms template_folder: bosh_templates disk_path: bosh_disk_storage datastore_pattern: DS411_NFS_1 persistent_datastore_pattern: DS411_NFS_1 allow_mixed_datastores: true clusters: - ShuttleXPC: resource_pool: bosh dns: # The BOSH powerDNS contacts the following DNS server for serving DNS entries from other domains. recursor: 192.168.50.5 logging: # If needed increase the default logging level to trace REST traffic with IaaS providers. Default is info level: debug # Default location is <deployment_dir>/bosh_micro_deploy.log # file :
10. Download some bosh stemcells. go to your stemcells directory and download some that say vSphere, we really only need 1 and I'll grab the ubuntu image. Note, your ubuntu image name and version may differ.
cd .. cd stemcells bosh public stemcells bosh download public stemcell bosh-stemcell-2427-vsphere-esxi-ubuntu.tgz
11. Go to the deployments directory and set the deployment.
cd .. cd deployments bosh micro deployment micro01
you should see a successful message such as
WARNING! Your target has been changed to `https://192.168.50.166:25555'! Deployment set to '/bosh/deployments/micro01/micro_bosh.yml'
12. deploy our ubuntu stemcell
bosh micro deploy /bosh/stemcells/bosh-stemcell-2427-vsphere-esxi-ubuntu.tgz
13. type yes to continue and you should see the following output
administrator@originalbosh:/bosh/deployments$ bosh micro deploy /bosh/stemcells/bosh-stemcell-2427-vsphere-esxi-ubuntu.tgz Deploying new micro BOSH instance `micro01/micro_bosh.yml' to `https://192.168.50.166:25555' (type 'yes' to continue): yes Verifying stemcell... File exists and readable OK Verifying tarball... Read tarball OK Manifest exists OK Stemcell image file OK Stemcell properties OK Stemcell info ------------- Name: bosh-vsphere-esxi-ubuntu Version: 2427 Started deploy micro bosh Started deploy micro bosh > Unpacking stemcell. Done (00:00:03) Started deploy micro bosh > Uploading stemcellat depth 0 - 20: unable to get local issuer certificate at depth 0 - 20: unable to get local issuer certificate. Done (00:01:03) Started deploy micro bosh > Creating VM from sc-45d2f9bd-fc1e-4c5e-85e6-a33b7bbd56e3at depth 0 - 20: unable to get local issuer certificate at depth 0 - 20: unable to get local issuer certificateat depth 0 - 20: unable to get local issuer certificate. Done (00:01:08) Started deploy micro bosh > Waiting for the agent. Done (00:00:19) Started deploy micro bosh > Updating persistent disk Started deploy micro bosh > Create disk. Done (00:00:00)at depth 0 - 20: unable to get local issuer certificate at depth 0 - 20: unable to get local issuer certificate at depth 0 - 20: unable to get local issuer certificate Started deploy micro bosh > Mount disk. Done (00:00:09) Done deploy micro bosh > Updating persistent disk (00:00:15) Started deploy micro bosh > Stopping agent services. Done (00:00:01) Started deploy micro bosh > Applying micro BOSH specat depth 0 - 20: unable to get local issuer certificate. Done (00:00:16) Started deploy micro bosh > Starting agent services. Done (00:00:00) Started deploy micro bosh > Waiting for the director. Done (00:00:16) Done deploy micro bosh (00:03:22) Deployed `micro01/micro_bosh.yml' to `https://192.168.50.166:25555', took 00:03:22 to complete at depth 0 - 20: unable to get local issuer certificate
14. Verify it. type bosh micro deployments and bosh micro status you should see a similar output
administrator@originalbosh:/bosh/deployments$ bosh micro deployments +-------------+-----------------------------------------+-----------------------------------------+ | Name | VM name | Stemcell name | +-------------+-----------------------------------------+-----------------------------------------+ | MicroBOSH01 | vm-4c12ab2e-1d73-4bc0-8903-354014b58fe1 | sc-45d2f9bd-fc1e-4c5e-85e6-a33b7bbd56e3 | +-------------+-----------------------------------------+-----------------------------------------+ Deployments total: 1
administrator@originalbosh:/bosh/deployments$ bosh micro status Stemcell CID sc-45d2f9bd-fc1e-4c5e-85e6-a33b7bbd56e3 Stemcell name bosh-stemcell-2427-vsphere-esxi-ubuntu VM CID vm-4c12ab2e-1d73-4bc0-8903-354014b58fe1 Disk CID disk-60d57628-87f9-4eeb-8c82-2d9c41b3b617 Micro BOSH CID bm-c1b7927b-c59b-4434-ac99-dd0d17feb505 Deployment /bosh/deployments/micro01/micro_bosh.yml Target https://192.168.50.166:25555
15. To login to the micro BOSH vm, type bosh target 192.168.50.166 and use admin/admin, but this isn't necessary. If you want to change the un/pw combo, with bosh create user <username>. This will over ride admin/admin.
Now it's set up and on to step 2!