Deploying Cloud Foundry on Virtualbox using BOSH CLI v2


The BOSH CLI v2 greatly enhances the interaction and deployment of Cloud Foundry and other BOSH releases. The new release, at time of writing still in beta, is now written in Golang, which allows it to be distributed by a simply binary without dependencies. There is even support for Windows planned, though binaries are currently not distributed. There are quite a few changes in the CLI commands, check them out here. The CLI now also includes a mechanism to bootstrap the BOSH Director, which was done previously by using bosh-init or for bosh-lite with a Vagrantfile.

This post will walk you through the required steps to deploy bosh-lite on Virtualbox and deploy Cloud Foundry. Bosh-lite is a single VM development environment which deploys bosh releases in garden containers.

Prerequisites

  • git
  • Virtualbox
  • 8GB memory recommended
  • Linux or Mac
    • Windows is coming
  • cf cli

BOSH CLI v2

First of all we need to download the latest BOSH CLI v2. You can find the latest version here.
After than we make the CLI globally accessible:

BOSH Director Deployment

We need the  bosh-deployment repository which holds a collection of BOSH manifests. Furthermore we are creating a dirctory to hold some deployment specific configuration files.

The next step is already to bootstrap the bosh-lite director to your local Virtualbox installation. You can modify the network information if you like.

Lastly we are creating an bosh environment alias and a few environmental variables to reduce the amount to type. You also want to recreate these variables if you create a new shell.

Cloud Foundry Deployment

We are going to use cf-deployment for deploying Cloud Foundry. The repository is still in its early stages but allows us to easily deploy Cloud Foundry, using Diego, in one simple step. It looks like it will be the successor of cf-release and diego-release .

First we are cloning the repository:

The next step is to upload the required bosh-lite stemcell., which is referenced at the bottom of  cf-deployment.yml .
At the time of writing:

Using  bosh interpolate we can extract the stemcell version and upload it:

We are using newer cloud config  model, which allows the separation of IaaS specific configuration from the deployment manifest.

The last step is to create and deploy our cloud foundry release. This may take long time, mostly depending on your internet connection.

If nothing failed, you have successfully deployed Cloud Foundry! Yey!

The last step is to create a local route, to be able to access the Cloud Foundry Environment from your host.

Linux:

Mac:

Configure Cloud Foundry

First we need to log-in into cloud foundry. The default username is  admin and the password can be found in the deployment-vars.yml , which was generated by  bosh deploy  in the previous steps.
The following command will log you in and read the password from the file.

Lastly we have to create an organization and a space:

You are now ready to deploy your first app!

Deploy to Cloud Foundry

I’ve created a very simple python application which can be used for testing.

You should now be able to access the app locally via  http://cf-helloworld.bosh-lite.com .

To try out Docker  support, we first need to enable docker support and push a docker image.

Suspend Environment

Please do not reboot or shutdown your BOSH Director VM, it won’t come up properly again!

To be able to save your state, you can can suspend and resume your BOHS Director with following commands:

Delete Environment

Your BOSH environment can be removed with following command:

SSH into BOSH Director

If you would like to get a console on the BOSH Director, you can use following commands:

Conclusion

It is straight forward and easy to deploy Cloud Foundry with  BOSH CLI v2  and  cf-deployment  to your localhost. The new cli greatly enhances the usability and deployment efforts.

Happy pushing!


Leave a comment

Your email address will not be published. Required fields are marked *

9 thoughts on “Deploying Cloud Foundry on Virtualbox using BOSH CLI v2

  • Gordon

    Thanks for this very handy guide. I found one minor mistake in the Configure Cloud Foundry section, the path to bosh interpolate should be ~/deployments/vbox/deployment-vars.yml instead of the cf-deployment path.

  • Alexander Widak

    Hi, thank you for the article – I tried it but I get always “Error: Timed out pinging to xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx after 600 seconds” for all vms during deploy step “Compiling packages” … do you have tips to pin down the error?
    I thought it is my environment: proxy and mitm but also with direct internet access there are the same errors …

  • Hrishikesh

    Hi Christopher Banck,

    Thanks for such great doc,
    one thing is updated in BOSH CLI-v2, that the password for login to cf is updated to field name cf_admin_password instead of uaa_scim_users_admin_password.

    So the command will be now :

    cf login -a https://api.bosh-lite.com –skip-ssl-validation -u admin -p $(bosh interpolate ~/deployments/vbox/deployment-vars.yml –path /cf_admin_password)

  • BaoYun

    Nice post.

    I followed all the steps with default settings, but failed when updating cf instances at last. The error messages are as below:

    17:39:06 | Updating instance api: api/7329016e-eb99-4793-bc8e-ef6360f6cd55 (0) (canary) (00:26:46)
    L Error: ‘api/0 (7329016e-eb99-4793-bc8e-ef6360f6cd55)’ is not running after update. Review logs for failed jobs: cloud_controller_ng, routing-api
    17:50:12 | Updating instance uaa: uaa/a8980f34-30cd-4d8c-9939-f8f71551d02e (0) (canary) (00:37:53)
    L Error: Action Failed get_task: Task 00f0f09b-dcad-4b78-7381-e9593e70c5f3 result: 1 of 1 post-start scripts failed. Failed Jobs: uaa.

    17:50:12 | Error: ‘api/0 (7329016e-eb99-4793-bc8e-ef6360f6cd55)’ is not running after update. Review logs for failed jobs: cloud_controller_ng, routing-api

    After checking, it looks like a uaa problem:
    uaa post-start.stderr.log :
    Failed to connect to 127.0.0.1 port 8989: Connection refused
    uaa monit.log:
    ‘uaa’ failed, cannot open a connection to INET[localhost:8989/healthz] via TCP

    Is there any advises?
    Thanks a lot.