bluemix - deploying a java web application

20
Deploying on Bluemix Cloud Foundry / Java Web App [email protected] This is not an official IBM position. The views expressed are solely my own.

Upload: craig-trim

Post on 25-Jul-2015

3.674 views

Category:

Technology


1 download

TRANSCRIPT

Deploying on BluemixCloud Foundry / Java Web App

[email protected]

This is not an official IBM position. The views expressed are solely my own.

Create the Web App• Simple JAX-RS Web app

• Given a URL in this format• <host:port>/blog/rest/get?

name=Craig

• Return a result on the screen

• The structure of the web app is explained here:• http://

trimc-jee.blogspot.com/2015/01/an-introduction-to-java-api-for-restful.html

Configure a build script• It’s going to be easier if we put our

Maven build configuration into a shell script that can be called during the CF deployment process

• My script is simple:• mvn clean install

• Remember to make your script executable• chmod +x <script>

• Make sure the script works locally first

Configure a Manifest

Configure a deployment script• The ${CF_APP} env variable is passed in

automatically

• Specify the manifest we created on the prior slide

Build and Deploy• We’re only going to add one stage that

combines both building and deploying

Input Configuration• I prefer to invoke this deploy stage

manually

Add a Job

Configure the Deploy Job• Just invoke the two scripts we previously

created

• There is nothing to prevent us from doing deep scripting within this web window

• But it’s easer to work with external files

• It’s likely I’ll only have to configure this web dialog once

Save …

Deploy: Not yet run• Here’s my pipeline

• Let’s go ahead and run the deployment and see what happens …

• The stage can be manually invoked by clicking the arrow in the upper right

Deploy: Pending• Click “View logs and history”

Deploy: Running• This is a running log file; scroll down to

view the input as the system invokes both Maven and (if the build is successful) proceeds to perform a Cloud Foundry deployment

Deploy: Successful

Deploy: Successful

Test the URL• Success!

Command Line Interaction • Install CF on the command line

• <link>

Login

View the logscf logs –recent jaxrs-simple