0

IBM Bluemix, Cloud Foundry, DevOps, and Spring Boot

In this post, we’ll show how to build, and deploy Spring Boot applications in IBM Bluemix using DevOps,

Requirements

Stuffs used.

  1. IBM Bluemix Account
    • Cloud Foundry App
      • Using Tomcat Build Pack
    • DevOps
  2. IntelliJ IDEA or Spring Initialzr
    • For generating the Spring Boot Web application
  3. Java 8 – SDK
  4. Fast Internet connection

Create Cloud Foundry App

Step 1: Choose underlying platform for application

Go to Catalog and click Cloud Foundry Apps. Choose Tomcat. Alternatively, we can choose Liberty for Java which uses IBM WebSphere Liberty Profile – a version of WebSphere Application Service designed for the cloud.

Step 2: Create a Cloud Foundry App

Provide App name. The rest of the fields should default to appropriate values. If our Region is Sydney, the deployment region defaults to Sydney.  Also, the domain defaults to au-syd-mybluemix.net.

Click Create to proceed.

Wait until the creation process completes.

Go to Overview. Scroll down to Continuous delivery section.

Click Enable.

Step 3: Configure Continuous Delivery

Scroll down. The Organization and ToolChain Name fields are displayed. We may choose to change organization and decide another name for the ToolChain we are creating.

Scroll down again. Notice the “Git Repos and Issue Tracking” is selected. Choose New for Repository type and specify an appropriate name for the Git repository.

Click Create.

Go to the newly created Git repository by click Git widget.

Step 4: Check in our Spring Boot Web Application

Step 4.1 Create our initial Spring Boot Web Application

Please follow the steps in this post Create a Spring Boot Application using IntelliJ.

Step 4.2 Convert Spring Boot to Deployable WAR for Tomcat

Please follow these steps in this post Convert Spring Boot to Deployable WAR for Tomcat.

Step 4.3 Clone empty Git project using SourceTree

Please follow these steps in this post Clone Bluemix Git Projects using SourceTree.

Step 4.4 Check in our Spring Boot Web Application

Copy the src folder and pom.xml to our local Git directory.

These files are then reflected in our SourceTree.

Commit and push the changes.

Step 5: Additional Code changes

We need a manifest.yml. For our post, we need the following settings:

Step 6: Configure Build Stage in Delivery Pipeline

Click the Delivery Pipeline widget. We need to use Maven to build our application.

Scroll down to the very bottom.

Configure as follows.

Click Save.

Run the build process again.

Step 7: Configure Deploy Stage in Delivery Pipeline

Click the Delivery Pipeline widget.

Scroll down to the very bottom.

Modify the cf push command as shown on the screenshot.

Click Save.

Redeploy our war file.

Test

Click the link in the Deploy Stage widget.

Remember we have the HiController mapped to /hi URI.

References

  1. Deploy and manage Bluemix Java applications from IntelliJ
  2. Bluemix Liberty Java does not build with Java 8

Download the Codes

https://github.com/Turreta/IBM-Bluemix-Cloud-Foundry-DevOps-and-Spring-Boot

Karl San Gabriel

Karl San Gabriel

Java and Enterprise Technologies Expert