在Openshift ...应用程序上反复部署Sails.js [英] Deploy Sails.js on Openshift ... app restarting over and over

查看:62
本文介绍了在Openshift ...应用程序上反复部署Sails.js的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 sails.js (版本0.9.7)应用程序部署到 Openshift ,但是在git push之后,我得到了以下日志:

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'

遵循该线程在GitHub上的一些提示,并检查了示例config/local.js https://gist.github.com/chrisaiv/5938158

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

在对任意一种组合进行测试之后, Openshift 服务器将一遍又一遍地重启.我还测试了8080、80、1337等几个端口,但我不认为它们都很忙.我尝试运行node app.js,应用程序意外地在端口8080上运行,但直到尝试访问views/home/index为止,可能是因为ssh我没有足够的权限.

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.

以防万一,这是我的config/local.js文件的外观:

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;-)

推荐答案

您的应用将不断重启的原因是,Sails应用程序创建了一个名为.tmp的文件夹并将所有资产放入其中.这意味着您的sails应用程序将写入本地文件.但是 Openshift 使用node-supervisor启动节点应用程序,并且node-supervisor在启动应用程序后监视所有文件更改.如果任何文件被更改,node-supervisor将重新启动服务器.

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.

您可以尝试npm i supervisor -g并通过键入node-supervisor app.js来启动应用程序以查看相同的日志.

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

我认为解决方案是使SailsJS停止编写本地文件,但是我不确定该怎么做.

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

这篇关于在Openshift ...应用程序上反复部署Sails.js的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆