简体   繁体   中英

Deploy sails.js on Openshift

I'm trying to deploy a sails.js app (sails.js version 0.11) to Openshift.

I'm aware of the previous questions and answers in here for example; https://gist.github.com/mdunisch/4a56bdf972c2f708ccc6 I followed the steps from that post.

I also created my app via git://github.com/ryanj/nodejs-custom-version-openshift.git so I have minimum npm version required by sailsjs. Still the application doesn't start. Has anybody attempted deploy sails v0.11 app on openshift before? Thank you

I see below in the logs

DEBUG: Running node-supervisor with
DEBUG:   program 'server.js'
DEBUG:   --watch '/var/lib/openshift/55a4256b5973cadc8400000d/app-root/data/.nodewatch'
DEBUG:   --ignore 'undefined'
DEBUG:   --extensions 'node|js|coffee'
DEBUG:   --exec 'node'
DEBUG: Starting child process with 'node server.js'
DEBUG: Watching directory '/var/lib/openshift/55a4256b5973cadc8400000d/app-root/data/.nodewatch' for changes.
Listening on 127.2.103.1, port 8080
DEBUG: Sending SIGTERM to child...

My solution as explained here works. https://github.com/aug70/openshift-sails-starter If you follow the instructions to setup a OpenShift cartridge and merge with this repo, you can deploy it on OpenShift.

Couple important points;

  • OpenShift package.json file is different!
  • You would want to use forever when running application and your start script should be something like

"start": "./node_modules/forever/bin/forever -l ~/app-root/logs/forever.log --append --pidFile ~/app-root/logs/forever.pid start app.js --prod"

  • If you happen to use mongodb, your connections.js file mongodb entry would be

"url : process.env.OPENSHIFT_MONGODB_DB_URL + process.env.OPENSHIFT_GEAR_NAME "

  • Solution is based on Sails.js version 0.11.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM