Starting geddy on heroku fails with Error R11 (Bad bind). What is wrong with the deployment? What am I missing?

StackOverflow https://stackoverflow.com/questions/10145960

  •  31-05-2021
  •  | 
  •  

Pregunta

I'm trying out a new deployment into heroku, can't seem to get geddy to run without issues.

I keep getting this error

Error R11 (Bad bind) -> Process bound to port 5768, should be 41113 (see environment variable PORT)

Procfile

web: geddy -p 5768

package.json

{
  "name": "oskalisti",
  "version": "0.0.1",
  "dependencies": {
    "geddy": "0.3.20",
    "jake": "0.2.31"
  }
}

Full Log:

2012-04-13T17:47:26+00:00 app[web.1]: [Fri, 13 Apr 2012 17:47:26 GMT] INFO Server starting with config: {
2012-04-13T17:47:26+00:00 app[web.1]:   "environment": "development",
2012-04-13T17:47:26+00:00 app[web.1]:   "workers": 1,
2012-04-13T17:47:26+00:00 app[web.1]:   "port": "5768",
2012-04-13T17:47:26+00:00 app[web.1]:   "debug": true,
2012-04-13T17:47:26+00:00 app[web.1]:   "rotateWorkers": false,
2012-04-13T17:47:26+00:00 app[web.1]:   "rotationWindow": 7200000,
2012-04-13T17:47:26+00:00 app[web.1]:   "rotationTimeout": 300000,
2012-04-13T17:47:26+00:00 app[web.1]:   "logDir": "/app/log",
2012-04-13T17:47:26+00:00 app[web.1]:   "gracefulShutdownTimeout": 30000,
2012-04-13T17:47:26+00:00 app[web.1]:   "heartbeatInterval": 5000,
2012-04-13T17:47:26+00:00 app[web.1]:   "heartbeatWindow": 20000,
2012-04-13T17:47:26+00:00 app[web.1]:   "staticFilePath": "/app/public",
2012-04-13T17:47:26+00:00 app[web.1]:     "store": "memory",
2012-04-13T17:47:26+00:00 app[web.1]:     "key": "sid",
2012-04-13T17:47:26+00:00 app[web.1]:   "sessions": {
2012-04-13T17:47:26+00:00 app[web.1]:     "expiry": 1209600
2012-04-13T17:47:26+00:00 app[web.1]:   "cookieSessionKey": "sdata",
2012-04-13T17:47:26+00:00 app[web.1]:   "metrics": null,
2012-04-13T17:47:26+00:00 app[web.1]:   },
2012-04-13T17:47:26+00:00 app[web.1]:   "i18n": {
2012-04-13T17:47:26+00:00 app[web.1]:     "defaultLocale": "en-us",
2012-04-13T17:47:26+00:00 app[web.1]:     "loadPaths": [
2012-04-13T17:47:26+00:00 app[web.1]:       "/app/config/locales"
2012-04-13T17:47:26+00:00 app[web.1]:     ]
2012-04-13T17:47:26+00:00 app[web.1]:   },
2012-04-13T17:47:26+00:00 app[web.1]:   "ssl": null,
2012-04-13T17:47:26+00:00 app[web.1]:   "model": {
2012-04-13T17:47:26+00:00 app[web.1]:     "useTimestamps": false,
2012-04-13T17:47:26+00:00 app[web.1]:     "forceCamel": true
2012-04-13T17:47:26+00:00 app[web.1]:   },
2012-04-13T17:47:26+00:00 app[web.1]:   "detailedErrors": true,
2012-04-13T17:47:26+00:00 app[web.1]:   "hostname": null
2012-04-13T17:47:26+00:00 app[web.1]: }
2012-04-13T17:47:26+00:00 app[web.1]: [Fri, 13 Apr 2012 17:47:26 GMT] INFO Creating 1 worker process.
2012-04-13T17:47:26+00:00 app[web.1]: [Fri, 13 Apr 2012 17:47:26 GMT] INFO Server worker running in development on port 5768 with a PID of: 6
2012-04-13T17:47:26+00:00 app[web.1]: [Fri, 13 Apr 2012 17:47:26 GMT] DEBUG LOGGING STARTED ============================================
2012-04-13T17:47:26+00:00 app[web.1]: [Fri, 13 Apr 2012 17:47:26 GMT] DEBUG ============================================================
2012-04-13T17:47:27+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 5768, should be 22421 (see environment variable PORT)

Any help would be greatly appreciated. Thanks.

¿Fue útil?

Solución

OK, found the issue, stupid me.

On the Procfile I shouldn't have used the port number, heroku will provide that port for me with the $PORT variable.

So I made the Procfile look like this:

web: geddy -p $PORT

And that worked. I also modified the production.js environment configuration file to use the heroku port as well, like so:

var config = {
  detailedErrors: false
, hostname: null
, port: process.env.PORT
, sessions: {
    store: 'memory'
  , key: 'sid'
  , expiry: 14 * 24 * 60 * 60
  }
};

module.exports = config;

Notice the port: process.env.PORT line there.

Then, if you change your file that way, instead of using the $PORT variable on the Procfile file, you can just start geddy like this:

web: geddy -e production

Just better practice, that way your production configuration gets loaded, and you can truly support different environments.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top