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.
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.
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.
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.
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.
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.
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.
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.
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.
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: