Using BOSH Lite to Deploy Cloud Foundry

by Nastia ShaternikDecember 5, 2013
This blog post explains how to deploy Cloud Foundry using BOSH Lite: set up an environment, boot a virtual machine, upload a specific stemcell and CF release, etc.

Nowadays, such terms as IaaS, PaaS, and SaaS are very popular. One of them is Cloud Foundry (CF), an open-source PaaS that can work on the different IaaS clouds like AWS, OpenStack, and vSphere. You can also play with it even on a local computer using BOSH Lite.

In this article, we will explore how to deploy BOSH Lite and Cloud Foundry on your local machine. In particular, we will look into setting up an environment, booting a virtual machine (VM), uploading a specific stemcell and CF release, etc.

Don’t be afraid of the specific terms, they will be clarified later. Understanding how to deploy Cloud Foundry locally, you can do it on the real IaaS, such as OpenStack or AWS. Let’s go!

 

Setting up an environment for using BOSH Lite

Since this article is about BOSH Lite and Cloud Foundry, there are only the main steps how to prepare environment for BOSH Lite:

  • Firstly, install Virtualbox: sudo apt-get install virtualbox.
  • Download and install the Vagrant package.
  • Install Ruby(using RVM), RubyGems, and Bundler.
  • Clone BOSH Lite repo: git clone https://github.com/cloudfoundry-attic/bosh-lite.git.
  • Enter the BOSH Lite directory and run the bundle command.

 

Booting a virtual machine

Run the vagrant up command out of the BOSH Lite directory, and, voila, you have a running instance. We need to target its Director (login as admin/admin): bosh target 192.168.50.4.

Type bosh status to verify that everything is ok.

Add a set of route entries to your local route table to enable direct warden container access. Your sudo password may be required: scripts/add-route.

 

Uploading a specific stemcell

A stemcell is a VM template with an embedded BOSH Agent. Upload and verify that it was successful: bosh upload stemcell http://bosh-jenkins-gems-warden.s3.amazonaws.com/stemcells/latest-bosh-stemcell-warden.tgz and bosh stemcells.

 

Uploading a Cloud Foundry release

A bosh release currently has two distinct purposes. Final releases that can be uploaded to any BOSH: git clone https://github.com/cloudfoundry-attic/cf-release.git. Then, clone a Cloud Foundry release repo and upload the latest release: bosh upload release PATH/TO/CF-RELEASE/releases/LATEST.yml.

 

Deploying Cloud Foundry

Create the Cloud Foundry deployment manifest. You can do it manually or using the BOSH Lite make_manifest_spiff script (see this tutorial).

Set the deployment manifest: bosh deployment PATH/TO/MANIFEST.yml.

Run a command to start deployment: bosh deploy.

 

What to do with the deployed Cloud Foundry

So, after all, you will have a running Cloud Foundry environment. You can target it using your DNS, then login and upload an application.

To target a default DNS for BOSH Lite: cf target http://api.10.244.0.34.xip.io.

To login with admin/admin: cf login admin.

Then, create the organization and space on your Cloud Foundry environment: cf create_org NAME and cf create_space NAME accordingly.

And, eventually, push your application: cf push.

For more tech details, please check out the official documentation on CF CLI and BOSH CLI.

 

Further reading