在Openshift上发送带有Node.js的iOS推送通知

时间:2015-08-13 14:22:03

标签: ios node.js push-notification openshift apnagent

我正在开发一个应该向iOS设备发送推送通知的网站。我跟着this tutorial发送了通知。在我的localhost apnagent上工作正常,但当我git push到我的Openshift云时,我在终端中收到以下错误:

remote: Waiting for application port (8080) become available ...
remote: Application 'apnagent' failed to start (port 8080 not available)
remote: -------------------------
remote: Git Post-Receive Result: failure
remote: Activation status: failure
remote: Activation failed for the following gears:
remote: 55c3344c89f5cf720xxxxxxx (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' for /var/lib/openshift/55c3344c89f5cf720xxxxxxx/nodejs
remote: #<IO:0x00000000f1c278>
remote: #<IO:0x00000000f1c200>
remote: )
remote: Deployment completed with status: failure
remote: postreceive failed
To ssh://55c3344c89f5cf720xxxxxxx@apnagent-xxxxxxx.rhcloud.com/~/git/apnagent.git/
   bbcf2a3..87exxxx  master -> master

我的package.json看起来像这样:

{
  "private": true,
  "name": "apnagent",
  "version": "0.0.0",
  "dependencies": {
    "apnagent": "1.0.x"
  },
  "engines": {
    "node": ">=0.10.22",
    "npm": ">=1.3.14"
  },
  "scripts": {
    "start": "node agent/_header.js"
  },
  "main": "agent/_header.js"
}

我认为我应该以某种方式使用process.env.OPENSHIFT_NODEJS_PORT作为服务器上的端口,或类似的东西。我确定,我已经完成了一些配置错误,因为在我的本地机器上一切正常。

1 个答案:

答案 0 :(得分:1)

您是否检查过服务器上的日志? SSH进入您的应用程序并使用

less app-root/logs/nodejs.log

并按shift + g查看服务器的最新控制台输出。我的脚本中有一些语法错误,它们导致了类似的错误。

如果这没有帮助,您可以发布服务器脚本吗?