Cloud Foundry v2 Public Template
The Cloud Foundry v2 template includes the following virtual machines:
- A Cloud Foundry v2 node preconfigured with the Cloud Foundry v2 command line interface (CLI), a defined organization, spaces, domain and a running application.
- A Cloud Foundry v2 client VM with the Cloud Foundry v2 CLI installed, the sample application that has been preconfigured for a successful “push” to the Cloud Foundry v2 node, and an instance of the Eclipse IDE with the Spring Tool Suite plugin installed and the Cloud Foundry v2 IDE plugin.
The Cloud Foundry v2 template is available in all Skytap regions.
Working with Cloud Foundry v2
In the following few paragraphs, I’ll describe the steps we went through to configure the Cloud Foundry v2 template.
After installing the Cloud Foundry v2 CLI; the
cf command, we defined the target Cloud Foundry v2 node using the
cf target api.10.0.0.1.xip.io
A note on this definition is in order. The
xip.io domain is the “wildcard domain” that provides wildcard DNS for any IP address as explained at http://xip.io. That means that if you use an address of the form
foo.bar.192.168.1.50.xip.io, it resolves to IP address 192.168.1.50. In this way you can use such an address to access hosts on your local network with no further DNS configuration required. In the above
cf target … command, the specified target of
api.10.0.0.1.xip.io resolves to IP address 10.0.0.1, which is the IP address of the Cloud Foundry v2 node. To use a custom domain then, configure a DNS server to resolve the address appropriately.
We can confirm the target is set appropriately using the
cf target command without any parameters, as seen below:
Once the Cloud Foundry v2 target is set, you need to sign in. The user configured in this Cloud Foundry v2 instance is
firstname.lastname@example.org. The sign in command is illustrated below:
Note that we are provided with a hint on what we ought to do next, with the message There are no organizations. You may want to create one with
create-org. The following screenshot shows us creating the
Once again, we are provided with a hint on what we ought to do next, with the message There are no spaces. You may want to create one with
create-space. The following screenshot shows us using the
create-space command to create a space named development.
cf switch-space development # targets new space provides us with a hint on what we likely should do next. In the following screenshot we target the newly created “development” space as the destination for any apps we push to Cloud Foundry v2:
The Cloud Foundry v2 template is also pre-configured with 2 additional spaces if you choose to make use of them; a “test” space and a “production” space.
We also configured the domain
10.0.0.1.xip.io where published apps are available. It also uses the
xip.io wildcard DNS to resolve the domain to the Cloud Foundry v2 node at 10.0.0.1. Review the configured domain using the
cf domains command as illustrated below:
Cloud Foundry v2 Ruby application
The structure for applications in Cloud Foundry v2 has changed significantly from the previous release of Cloud Foundry. You can review the requirements for deploying applications in Cloud Foundry v2 at this URI:
We have provided an example application
testapp.rb in the
~skytap/projects/ruby directory on the Cloud Foundry v2 Dev Workstation VM:
To prepare the application to push to the Cloud Foundry v2 node, you need to process this structure with the “bundle” utility which has been installed on the Dev Workstation VM in the Cloud Foundry v2 template. Use of the “bundle” utility to this preparation is shown below:
Now we’re ready to push our ruby application to the Cloud Foundry v2 node. We do this with the
cf push command. After issuing the
cf push command, you are asked how many instances of the application you want to create, how much memory to allocate to the application, what domain to bind to the application (
testapp.10.0.0.1.xip.io), and whether to deploy any services with the application.
The following two screenshots show the result of issuing the
cf push command to deploy our ruby application:
Note above that after the application deploys we are provided with a status on the application along with the URI at which the application can be accessed.
We can now connect to our application with a web browser using the URI provided:
Cloud Foundry v2 IDE
The Dev Workstation VM in the Cloud Foundry v2 template also includes the Spring Tool Suite and the Cloud Foundry v2 IDE.
- You can start up Eclipse by double-clicking on the Eclipse Icon on the desktop:
After launching Eclipse, you’ll be asked for your workspace. Click OK to use the one that has been configured:
- Next, you’ll be asked for the Eclipse Secure Storage password. Type
ChangeMe!in the Password field and click OK.
- When Eclipse starts, you’ll see general information about the Cloud Foundry v2 connection.
testappentry in the Servers tab to open the application panel:
- From this interface you can review the status of the application as well as stop, restart and alter other application parameters.