Derby on Heroku port binding

457 views
Skip to first unread message

Robert

unread,
Jun 3, 2012, 4:46:21 PM6/3/12
to der...@googlegroups.com
*Almost* have Derby up and running on Heroku, but I'm getting some port binding errors in the logs. Wondering where I change port info in Derby.js Only thing I'm seeing in the documentation about ports is under stores. Any info on how to set this?

Here's the error (in bold) in the Heroku logs:

2012-06-03T20:27:12+00:00 heroku[web.1]: Starting process with command `node server.js`
2012-06-03T20:27:13+00:00 app[web.1]: Go to: http://localhost:3000/
2012-06-03T20:27:13+00:00 app[web.1]: info: socket.io started
2012-06-03T20:27:13+00:00 app[web.1]: `kill -s SIGUSR2 1` to force cluster reload
2012-06-03T20:27:13+00:00 app[web.1]: Starting cluster with 1 workers in undefined mode
2012-06-03T20:27:14+00:00 heroku[web.1]: Error R11 (Bad bind) -> Process bound to port 3000, should be 6302 (see environment variable PORT)
2012-06-03T20:27:14+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-06-03T20:27:15+00:00 heroku[web.1]: Process exited with status 137
2012-06-03T20:27:15+00:00 heroku[web.1]: State changed from starting to crashed

As you can see, Heroku is telling me to check the "environment variable PORT," but I thought I'd also post this here in case anyone had any clue...Thx!

Robert

unread,
Jun 3, 2012, 5:03:53 PM6/3/12
to der...@googlegroups.com
Follow up:

Here's the Heroku error documentation. Not very helpful. :(


László Bácsi

unread,
Jun 3, 2012, 5:53:46 PM6/3/12
to der...@googlegroups.com
Here's how you can set the port in server.js:

require('derby').run(__dirname + '/lib/server', process.env.PORT || 3000)

Best,
LacKac

Robert

unread,
Jun 3, 2012, 6:39:58 PM6/3/12
to der...@googlegroups.com
Brilliant, thank you that worked. Future ref for others, the port is passed by Heroku with an environment variable: https://devcenter.heroku.com/articles/nodejs#write_your_app

Kyle Finley

unread,
Jun 5, 2012, 1:34:29 PM6/5/12
to der...@googlegroups.com
Robert,

If you need more any more guidance, here's an attempt that I made to create a blog using derby.


I was able to get it running on heroku, but I got stuck on some of the model behavior, so I temporarily abandoned it. One of the major issue I had with heroku was the "cold start" time. If the instance was shutdown it would take up to 30 seconds to restart, which didn't work for my needs.

I hope it helps,

- Kyle

Robert

unread,
Jun 6, 2012, 1:03:59 PM6/6/12
to der...@googlegroups.com
Thanks, Kyle.
Reply all
Reply to author
Forward
0 new messages