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
- 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.
Click on “Create Project” button
Fill the Form
Click on “Browse Catalog“
Select “Java” from “Languages” and then select “Red Hat Open JDK 8“
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.
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“
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
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.
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.