OpenShift是Red Hat的平台即服务(PaaS),允许开发人员在云环境中快速开发,托管和扩展应用程序。使用OpenShift,您可以选择各种产品,包括在线,内部部署和开源项目选项。 我试图在openshift中托管我的应用程序。当我向请求添加git存储库时,它会出错。
HAProxy instance is started
HAProxy instance is started
The initial build for the application failed: Shell command '/sbin/runuser -s /bin/sh 56540dff7628e1120c000006 -c "exec /usr/bin/runcon 'unconfined_u:system_r:openshift_t:s0:c5,c81' /bin/sh -c \"gear postreceive --init >> /tmp/initial-build.log 2>&1\""' returned an error. rc=255
.Last 10 kB of build output:
Stopping NodeJS cartridge
Repairing links for 1 deployments
Saving away previously installed Node modules
Building git ref 'master', commit a601415
Building NodeJS cartridge
npm info it worked if it ends with ok
npm info using npm@1.4.28
npm info using node@v0.10.35
npm info preinstall JsFBApps@0.0.0
npm info build /var/lib/openshift/56540dff7628e1120c000006/app-root/runtime/repo
npm info linkStuff JsFBApps@0.0.0
npm info install JsFBApps@0.0.0
npm info postinstall JsFBApps@0.0.0
npm info prepublish JsFBApps@0.0.0
npm info ok
Preparing build for deployment
Deployment id is 023a0c45
Activating deployment
HAProxy already running
Starting NodeJS cartridge
Tue Nov 24 2015 02:15:34 GMT-0500 (EST): Starting application 'jsfbapps' ...
Waiting for application port (8080) become available ...
Application 'jsfbapps' failed to start (port 8080 not available)
-------------------------
Git Post-Receive Result: failure
Activation status: failure
Activation failed for the following gears:
56540dff7628e1120c000006 (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/56540dff7628e1120c000006/nodejs
#<IO:0x00000000ebd2a0>
#<IO:0x00000000ebd228>
)
Deployment completed with status: failure
postreceive failed
答案 0 :(得分:1)
您能告诉我您的代码如何设置ip和端口以供收听。
如果您使用快速框架,请使用以下代码:
var ipaddress = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1";
var port = process.env.OPENSHIFT_NODEJS_PORT || 8080;
app.listen(port, ipaddress, function() {
// Do your stuff
});
您需要使用由OpenShift定义并在其环境变量中指定的IP和端口。
process.env.OPENSHIFT_NODEJS_IP
process.env.OPENSHIFT_NODEJS_PORT
https://developers.openshift.com/en/node-js-environment-variables.html