DEV Community

Cover image for Deploy Java Application To Cloud Foundry In Less Than An Hour
Skand Purohit
Skand Purohit

Posted on

Deploy Java Application To Cloud Foundry In Less Than An Hour

Introduction:

This article talks about setting up PCF on your Local Workstation with PCF Dev and deploy a Java application.

Time : 45 mins

Prerequisites

• Virtual Box 5.0 or higher
• Java JDK 7 or higher
• 4GB Memory
• 10GB Space
• Create account on PCF

Install The CLI

Download and Install Cloud Foundry Command Line Interface (cf cli):

MAC OSX
https://packages.cloudfoundry.org/stable?release=macosx64-binary&source=github

Windows
https://packages.cloudfoundry.org/stable?release=windows64-exe&source=github

Linux
https://packages.cloudfoundry.org/stable?release=linux64-binary&source=github

Install The PCF Dev

Download the latest version of PCF Dev, navigate to https://network.pivotal.io/products/pcfdev

Here I have used v0.28.0 for PCF 1.11.0

Alt text of image

Unzip the downloaded zip file

Alt text of image

Install the PCF Dev Plugin

Alt text of image

Start PCF Dev

Alt text of image

This Process takes somewhere from 10-20 mins depending on the workstation.

Deploy Java Application

Now that you have PCF Dev Virtual Machine running on your workstation, next step is to deploy the sample Java application.

GIT Clone

$ git clone https://github.com/cloudfoundry-samples/spring-music

$ cd spring-music

Alt text of image

Login to PCF Dev

Alt text of image

Use Gradle to Assemble the app locally

$ ./gradle assemble

Alt text of image

Push the App

$ cf push --hostname spring-music

Alt text of image

While App gets deployed you would see the route which would be used to access the app from your local browser.

Alt text of image

requested state: started
instances: 1/1
usage: 512M x 1 instances
routes: spring-music.local.pcfdev.io

Alt text of image

To View Logs

$ cf logs spring-music –recent

To Check Running App Details

Alt text of image

Top comments (0)