Overview

Tutorial

Get Started

Before we dive in, let’s make sure you are ready. What do you need? You need to be able to install software on your computer. This is so you can install the CLI, or Command Line Interface, a program used to interact with Cloud Foundry.

Pick a Provider

You need a Cloud Foundry instance to use. If your company has a Cloud Foundry instance, you should use that. Of course you can run Cloud Foundry yourself, but in the interest of time, you can also pick one of the hosted solutions below.

Installing the CLI

The CLI, or Command Line Interface, is the tool you will use to interact with Cloud Foundry. The CLI runs in a terminal window on your computer and makes REST calls to the Cloud Foundry API.

Login and Target

When using Cloud Foundry, the first thing you need to do is log in to a Cloud Foundry instance. To log in, you will run the following: cf login -a <CLOUDFOUNDRY_API_ENDPOINT> -u <USERNAME> Let’s break it down.

Deploy an App

In Cloud Foundry, deploying an app is achieved via a cf push. There is nothing special about the app you will be deploying. It is just a simple go application written for training purposes.

Provisioning a Database

Your app is now running, but it doesn’t have a database. If you view your application in a browser, you will see the database is missing. Let’s add a database.

Binding a Database

Now that you have a database instance, you need to tell your application about the instance so the app can use it. In Open Service Broker API terms this is called binding.

Scaling

Now that you have the application data moved to an external service, we can safely scale our application up to more than one instance. After all, running a single instance of something is a recipe for an outage.

Resiliency

By performing cf scale in the last exercise, you asked Cloud Foundry to ensure you have two instances of the app running. Behind the scenes, Cloud Foundry is ensuring this is so.

Cleanup

Cleaning up with Cloud Foundry is simple. # delete the app and the route cf delete -f -r first-push # delete the database instance cf delete-service -f first-push-db Congratulations! You just: