Deploy Sails.js on Openshift … app restarting over and over [duplicate]

孤人 提交于 2019-12-19 05:54:28

问题


I want to deploy sails.js (version 0.9.7) app to Openshift but after git push I get this log:

debug: Lowering sails...
DEBUG: Starting child process with 'node app.js'
.
.
.
info: Server lifted in `/var/lib/openshift/525ccaba5973caa65100002b/app-root/runtime/repo`
info: To see your app, visit http://127.7.215.1:8080
info: To shut down Sails, press <CTRL> + C at any time.
.
.
debug: --------------------------------------------------------
debug: :: Tue Oct 15 2013 03:03:56 GMT-0400 (EDT)
debug: 
debug: Environment      : development
debug: Host             : 127.7.215.1
debug: Port             : 8080
debug: --------------------------------------------------------
.
.
error: Server doesn't seem to be starting.
error: Perhaps something else is already running on port 8080 with hostname 127.7.215.1?
.
.
debug: Lowering sails...
DEBUG: Starting child process with 'node app.js'

Following a few tips from this thread on GitHub and also checked the sample config/local.js https://gist.github.com/chrisaiv/5938158

After test any of combination the Openshift server is just restarting over and over. I have also tested several ports like 8080, 80, 1337, ... and I don't think so are all busy. I've tried to run nodeapp.js and application surprisingly works on port 8080 but just till I try access to views/home/index, probably because from ssh I haven't enought rights.

Just in case, here how my config/local.js file looks like:

module.exports = {
        port: process.env.OPENSHIFT_NODEJS_PORT,
        host: process.env.OPENSHIFT_NODEJS_IP
        }

thank you for any advice;-)


回答1:


The reason your app will keep restarting over and over is because sails application create a folder called .tmp and put all assets into it. Which means your sails application will write local files. But Openshift use node-supervisor to start node application, and node-supervisor monitor all file changes after starting the application. If any file is changed, node-supervisor will restart the server.

You can try npm i supervisor -g and start your application by typing node-supervisor app.js to see the same log.

I think the solution is to make SailsJS stop writing local files, but I am not sure how to do that yet.



来源:https://stackoverflow.com/questions/19375581/deploy-sails-js-on-openshift-app-restarting-over-and-over

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!