DEV Community

Cover image for How to deploy application using Source to Image (S2I) in OpenShift?
Sagar Jadhav
Sagar Jadhav

Posted on β€’ Edited on β€’ Originally published at developersthought.in

How to deploy application using Source to Image (S2I) in OpenShift?

Objective

  • Deploy Node JS Application using S2I
  • Update code
  • Rebuild Deployment

Step 1: Set up OpenShift environment

Go to Katacoda.com & click on start scenario

Step 2: Login with developer user

oc login -u <USER_NAME> -p <USER_PASSWORD> <SERVER_URL>
Enter fullscreen mode Exit fullscreen mode

Step 3: Create project my-project

oc new-project my-project
Enter fullscreen mode Exit fullscreen mode

Step 4: Deploy nodejs application using s2i

oc new-app -i nodejs:8 https://github.com/sagar-jadhav/node-hello --name nodejs -l app=demo
Enter fullscreen mode Exit fullscreen mode

Step 5: List pods

oc get pods --watch
Enter fullscreen mode Exit fullscreen mode

Step 6: List all resources

oc get all -l app=demo
Enter fullscreen mode Exit fullscreen mode

Step 7: Create route

oc expose service nodejs
Enter fullscreen mode Exit fullscreen mode

Step 8: List route

oc get route
Enter fullscreen mode Exit fullscreen mode

Step 9: Browse application

From browser, Browse <ROUTE_URL>
Enter fullscreen mode Exit fullscreen mode

Step 10: Clone repository

git clone https://github.com/sagar-jadhav/node-hello
Enter fullscreen mode Exit fullscreen mode

Step 11: Update code

Update "Hello World !!" string in index.js
Enter fullscreen mode Exit fullscreen mode

Step 12: Rebuild deployment

oc start-build nodejs --from-dir=./node-hello/
Enter fullscreen mode Exit fullscreen mode
oc get pods --watch
Enter fullscreen mode Exit fullscreen mode

Step 13: Browse application

From browser, Browse <ROUTE_URL>
Enter fullscreen mode Exit fullscreen mode

Image of Stellar post

Check out Episode 1: How a Hackathon Project Became a Web3 Startup πŸš€

Ever wondered what it takes to build a web3 startup from scratch? In the Stellar Dev Diaries series, we follow the journey of a team of developers building on the Stellar Network as they go from hackathon win to getting funded and launching on mainnet.

Read more

Top comments (0)

nextjs tutorial video

Youtube Tutorial Series πŸ“Ί

So you built a Next.js app, but you need a clear view of the entire operation flow to be able to identify performance bottlenecks before you launch. But how do you get started? Get the essentials on tracing for Next.js from @nikolovlazar in this video series πŸ‘€

Watch the Youtube series

πŸ‘‹ Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay