Send iOS Push Notifications with Node.js on Openshift

207 views Asked by At

I'm developing a website , that should send push notifications to iOS devices. I followed this tutorial to send notifications. On my localhost apnagent works fine, but when I git push it to my Openshift cloud I get the following errors in the terminal:

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://[email protected]/~/git/apnagent.git/
   bbcf2a3..87exxxx  master -> master

My package.json looks like this:

{
  "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"
}

I think i should use somehow process.env.OPENSHIFT_NODEJS_PORT as port on the server, or something like this. I'm sure, I've done some configuration mistake since on my local machine everything works fine.

1

There are 1 answers

0
Jimmy Pruitt On

Did you check the logs on the server? SSH into your app and use

less app-root/logs/nodejs.log

and press shift+g to view the recent console outputs for the server. I had a few syntax errors in my scripts and they were causing a similar error.

If that doesn't help, could you post your server script?