On August 28, 2013, Skytap announced the availability of the Cloud Foundry v2 template in the Skytap Cloud Public Template Library. This 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 and can be used by customers to create and configure your own Cloud Foundry v2 environment.
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 ‘target‘ command: 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 will resolve 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‘ will resolve to IP address ‘10.0.0.1‘, which is the IP address of the Cloud Foundry v2 node in our configuration. If you want to use a custom domain, then you will need to 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 log in. The user configured in this Cloud Foundry v2 instance is ‘firstname.lastname@example.org‘. The login 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 ‘micro_org‘ organization:
Once again, we are provided with a hint about 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‘.
The note ‘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‘ at which published apps will be available; note that it, too, uses the ‘xip.io‘ wildcard DNS to resolve the domain to the Cloud Foundry v2 node at ‘10.0.0.1‘. You can 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 URL: http://docs.cloudfoundry.com/docs/using/deploying-apps/.
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 or not 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 URL at which the application can be accessed.
We can now connect to our application with a web browser using the URL 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 the general information about the Cloud Foundry v2 connection:
Double-click the ‘testapp‘ entry 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.
Skytap Cloud now has a Cloud Foundry v2 template available for our customers to use. This template contains both a Cloud Foundry v2 node as well as a Cloud Foundry v2 client. The template is preconfigured with a working Cloud Foundry v2 environment, a running application, the Cloud Foundry v2 command line, and the newly released Cloud Foundry v2 Eclipse IDE.
You can use this Cloud Foundry v2 template to create your own Skytap Cloud configurations and configure your own Cloud Foundry v2 environment for evaluation and use. To discover more ways to interact with and use Cloud Foundry v2, you can visit http://www.cloudfoundry.com.