#Running custom node on openshift
Because there are two ways of managing the node version!
- read-marker-file branch
- will read the marker file which is the "normal" way for openshift
- read-package-json
- based on ryanj's work, will parse the package.json in your app root and read the 'enginge' key and install the corresponding node version
It does not matter which branch you select, the point is that developers are used to manage dependencies via package.json file
- Openshift account
- GIT
- NPM
- RHC Client
- NODE
- Sign in to your openshift account, head over to applications and create a new one
- Select the
node.js 0.10
cartridge - Name your application
- In the source code field put:
https://github.com/DavidReinberger/openshift-custom-nodejs.git
- In the second field put the branch you have chosen to suit your needs:
read-marker-file
orread-package-json
- Watch magic happen!
- Go to http://yourappname-yourdomain.rhcloud.com
- At the top of the page you should see v0.10.33
If anything goes wrong do:
rhc tail yourapp
this should give you the error log
- Decide wheter you want your app to scale and what gear to use
- Install your app
- If you want to use other gear than small add
-g
at the end recommended - non-scaling -
rhc app create YOURAPPNAME nodejs --from-code=https://github.com/DavidReinberger/openshift-custom-nodejs.git#branch-name
- scaling -
rhc app create YOURAPPNAME nodejs --from-code=https://github.com/DavidReinberger/openshift-custom-nodejs.git#branch-name -s
- Watch magic happen!
- Go to Go to http://yourappname-yourdomain.rhcloud.com
- At the top of the page you should see v0.10.33
- If you installed from web clone your repo
- Copy your code over to the cloned repo
- Check
package.json
- see if there is the desired node version
"engines": {
"node": "0.10.33",
"npm": "1.4.8"
}
- git add, commit and push
- Right now you should see a lot of npm install depending on the size of your app
- Check http://yourappname-yourdomain.rhcloud.com
If anything goes wrong do:
rhc tail yourapp
this should give you the error log
YES! This is Meteor ready! (almost)
If you take a look at server.js
, some might point out that is just a renamed meteorshim.js and YES you are absolutely correct!
- Demetorize your app
- sudo
demeteorizer -o ../_build/app
- use sudo to avoid errors!
- Copy the demeteorized app to your cloned openshift repo
- Open package.json and change
"main": "main.js",
"scripts": {
"start": "node main.js"
},
To
"main": "server.js",
"scripts": {
"start": "node server.js"
},
- git add, commit and push
- Right now you should see a lot of npm install depending on the size of your app
- Check http://yourappname-yourdomain.rhcloud.com
If anything goes wrong do:
rhc tail yourapp
this should give you the error log