Appendix A: Deploy to Pivotal Cloud Foundry

The basic steps necessary to deploy a service that uses the VLINGO XOOM platform components to the Pivotal Cloud Foundry.

These are the basic steps necessary to deploy a service that uses the VLINGO XOOM platform components to the Pivotal Cloud Foundry. The final section below provides a working example.

Docker

The first thing we need to do is to generate a docker image and push it to any registry. We will use the Docker Hub registry for this example.

You can use any Docker Registry that you want, either Docker Hub, any private Docker Registry, or GCR. If you want more information about how to deploy from any of these registries, check this link.

Docker Image Publish

  1. Register to Docker Hub

  2. Once logged in, create a repository for each image. The field Name is the name of the docker image. This is the identifier along with the account name.

  3. After that, login to the registry with your docker cli by typing docker login in your shell/terminal.

  4. Now you are ready to push your image to DockerHub repository using docker-release.sh

     ./docker-release.sh <account_name/name>

Once the script finishes, the docker image is published to DockerHub and ready to be deployed.

Docker Image Implementation

The Dockerfile is implemented using MultiStage build:

  • The build stage extends FROM maven:alpine. The single responsibility of this stage is to install dependencies (caching layers) and generate the jar.

  • The runtime stage extends FROM openjdk:alpine and works executing the jar generated by build stage. It will EXPOSE the external ports to the host.

Pivotal Cloud Foundry

Now that the image is pushed to Docker Hub, push them into Pivotal Platform.

The first requirement is to create an account in Pivotal. Obtain access to the console and then create an organization manually. It's as simple as entering input inside Create an Org.

The next step is to install the CF CLI on your computer.

Once the Cloud Foundry CLI is installed on your machine, login to your Pivotal account:

$ cf login -a https://api.run.pivotal.io

A Cloud Foundry connection is established using your Pivotal account. Copy the example-manifest.yml to your project and rename it to manifest.yml. Open the manifest file and edit the three configurable variables:

  1. service_name: The name of the service inside the Pivotal Cloud Foundry platform.

  2. docker_image: The docker image name is composed of your account name and the repository name (e.g: vlingo/project1)

  3. subdomain: This is your public end-point within domain .cfapps.io

You may also configure environment variables, instances, memory, disk quota, etc. See Deploying with Application Manifests for possible manifest configurations.

Along with your configured manifest.yml, push your project:

$ cf push

This command by default checks whether a manifest.yml exists in the directory, and if so, uses it to push to the platform.

That's all it takes! The service/application is in the Pivotal Cloud Foundry, deployed and working. Use the Pivotal Console to see your services, the logs, and any other project infrastructure artifacts.

See a Working Example

See xoom-examples for a working configuration. This demonstrates how to integrate two or more services that are deployed to the Pivotal Cloud Foundry platform. View the xoom-http-frontservice and xoom-http-backservice as microservices, and the DEPLOY.md for further instructions.

Last updated