Recently during one of the hackathon which I attended I was looking for a place where i can host my NodeJS application and make it available to public.I found OpenShift to be very good place to host your App.
What is OpenShift?
OpenShift is a cloud based PAAS (Platform as A service) platform built to host your application.It has been developed by Red Hat.The Free-version offers you to select any three gear and upto 1GB of data. It directly takes you code from your GIT Repository. It is a great platform for creating an App though collaboration as each member of team can directly push there code to the common GIT Repository and see there changes live on the public url for your app.
OpenShift offers lot of languages like java,python,MongoDb to work upon. I am going to state here on how to host your NodeJs application on OpenShift.
Steps to install a NodeJS app on OpenShift
Now your app will be live.The Url and git repository details of the app will be displayed when the rhc app create command is executed.You can clone the repository using git clone in your local machine.To upload your changes just do a git push and all your changes will be updated.
Your team will have to a rhc setup first in their local machine and then do a git clone to create the repository in their local machine.They also have to do a git push whenever they want to push their changes to OpenShift.
What is OpenShift?
OpenShift is a cloud based PAAS (Platform as A service) platform built to host your application.It has been developed by Red Hat.The Free-version offers you to select any three gear and upto 1GB of data. It directly takes you code from your GIT Repository. It is a great platform for creating an App though collaboration as each member of team can directly push there code to the common GIT Repository and see there changes live on the public url for your app.
OpenShift offers lot of languages like java,python,MongoDb to work upon. I am going to state here on how to host your NodeJs application on OpenShift.
Steps to install a NodeJS app on OpenShift
- Install Ruby 1.9 from this link here http://rubyinstaller.org/downloads
Add ruby to your system path name
To check if Ruby is successful type following in CMD prompt
c:\>ruby -e 'puts "welcome to Ruby"'
welcome to Ruby
- Install GIT from here http://msysgit.github.io/
while installing git select the below option
To check if Git installation is successful type following in Cmd prompt
c:\>git --version
git version 1.9.4.mysysgit.1
- Installing OpenShift Ruby gems
Type following in CMD prompt
c:\> gem install rhc
You may get some issues while running in corporate network Please find the solution
https://github.com/oneclick/rubyinstaller/wiki/Troubleshooting#network_drive_home - Change the package.json file in your app to make it OpenShift compatible
"scripts": { "start": "node app.js" }, "main": "app.js"
- Change the ports number in your app to openshift port and server host
var server_port = process.env.OPENSHIFT_NODEJS_PORT || 3000 var server_ip_address = process.env.OPENSHIFT_NODEJS_IP || '127.0.0.1' http.createServer(app).listen(server_port, server_ip_address, function () { console.log( "Listening on " + server_ip_address + ", server_port " + port ) });
- Using the below syntax you can upload and create your App in OpenShift execute the below command from your rhc command line tool
rhc app create <GIVE YOUR APP NAME> nodejs-0.10 --from code=<GIVE YOUR GIT REPOSITORY>
Now your app will be live.The Url and git repository details of the app will be displayed when the rhc app create command is executed.You can clone the repository using git clone in your local machine.To upload your changes just do a git push and all your changes will be updated.
Your team will have to a rhc setup first in their local machine and then do a git clone to create the repository in their local machine.They also have to do a git push whenever they want to push their changes to OpenShift.
No comments:
Post a Comment