Spring Boot is certainly an interesting framework for the development of microservices and other lightweight Java based applications. I spent some time recently working with a plethora of Java microframeworks to determine which one I would like to use for some personal projects that I have been working on. Namely, I have tried out spark, WildFly Swarm, and Spring Boot.
This post is not to declare which one I like the best as that isn’t really relevant to why you are probably reading this post and depends greatly on the specific project. I am not from the one framework to rule them all camp but more of use the right framework for the job.
That being said, in my exploration of these frameworks my goal was to be able to deploy them on OpenShift 3 using the recently released WildFly 10 application server. I really enjoy using WildFly for my projects and the benefits provided from a full application server. Therefore, this blog will focus on deploying a Spring Boot application packaged as a .war file to WildFly on OpenShift 3 as a docker based container.
Not what you are you looking for? If you want to learn how to deploy a Spring Boot application to the current version of OpenShift Online, refer to the official Spring Boot documentation that provides details on how to do that.
First things first, how do I get OpenShift 3
You may be asking yourself how you get your hands on OpenShift 3 at this point. I am happy to report that the OpenShift team provides an up to date version of the upstream project that is very simple to install on your local machine. If you don’t currently have access to an OpenShift 3 environment, point your browser to the following post I wrote that explains how to get it up and running in Windows, OS X, or linux:
https://blog.openshift.com/using-openshift-3-on-your-local-environment/
If you are not familiar with the basics of the OpenShift Container Application Platform, head on over to this post that walks through the project:
https://blog.openshift.com/openshift-3-walkthrough/
Step 1: Authenticate and create a new project
The first thing we need to do is authenticate to the OpenShift 3 web console and create a new project to hold all deployments related to our application. In the spring boot world, this could include many containers running that same microservice all being load balanced. Once you have authenticated to the platform, click on the New Project button as shown in the following image: