Deploying Spring Boot Application in OpenShift.

This blog will show you, “How to deploy your Spring Boot Application in OpenShift environment with free of cost”. OpenShift is a cloud development Platform as a Service (PaaS) developed by Red Hat. It is an open source development platform, which enables the developers to develop and deploy their applications on cloud infrastructure.

What not to expect

So what not to expect out of this article is that this will teach about Spring Boot or OpenShift.

Prerequisites

  • Have one Spring Boot Application ready in git, like I have in GIT,
  • Have one OpenShift account ready. Create one here

We are given some of the cloud space free of cost in OpenShift for sometime. Around 2GBs for 60 days. Since allocation of space takes sometime but if you are lucky then you might be given the space in few minutes after successful creation of your account and verify the same.

Below is the screen appears when you create your account and that is pending for provisioned.

Once your account is ready or gets provisioned, you will receive confirmation mail from OpenShift and clicking on it will take you to the below screen.

Lets Start

Click on “Create Project” button

Fill the Form

This is project details which will appear throughout the openshift console for this application

Click on “Browse Catalog

Default dashboard page for your spring-boot-demo project

Select “Java” from “Languages” and then select “Red Hat Open JDK 8

Our Spring Application is a Java application.

Click on “Create Application” Button

Fill the details

Fill application related details, like Java Version, Name, Git Repo link. Make sure your keep the “Create route” check box clicked or you will you have to create routes your self. Will see how to do that in some other article.

Application Ready

Your application is ready to be build. The build logs can be seen by clicking on application name i.e. “spring-boot-demo” -> “View Logs

Application Ready

Logs console

Check Pods

Once you see successful logs ending. Click on “Pods” in left hand side navigation menus and you will see that your application in “Running” status

Application Pods

Check Routes

Routes are something which will provide some kind of URL that can be used to hit our application. If you click on “Routes“you will see something like below screen. Copy that “Location” column value. This is the default value given by OpenShift console.

Routes Page

Hit the application

Whats the point of deploying any application if we cant hit it. Take the routes value from above step and paste it to your POSTMAN client appending the resource names that you must have created in your rest controller(s).

Like in our case we have two resources GET /student and POST /student.

POST /student – Adding Student

GET /student – Getting Students

You must have got some idea about the steps to follow. Later you can play with your deployed application in OpenShift to learn more the same.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.