The right port number for Heroku?

1,694 views
Skip to first unread message

aliane abdelouahab

unread,
Jul 7, 2014, 9:26:37 PM7/7/14
to python-...@googlegroups.com
hi,
i have finally (after a big struggle) deployed the application on Heroku, (that happened on OpenSuse because on windows it was a mess -_- ), but now Heroku hates my application, because for him, it is so slow to start:

2014-07-07T21:17:29.728450+00:00 heroku[web.1]: Process exited with status 137
2014-07-07T21:17:33.443235+00:00 heroku[web.1]: Starting process with command `python app.py`
2014-07-07T21:18:00.068431+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=essog.herokuapp.com request_id=30630578-4332-40e4-b586-c2660b441028 fwd="197.202.137.127" dyno= connect= service= status=503 bytes=
2014-07-07T21:18:33.938581+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2014-07-07T21:18:33.938815+00:00 heroku[web.1]: Stopping process with SIGKILL
2014-07-07T21:18:35.488536+00:00 heroku[web.1]: Process exited with status 137
2014-07-07T21:18:35.511862+00:00 heroku[web.1]: State changed from starting to crashed
2014-07-07T21:18:38.123764+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=essog.herokuapp.com request_id=823d5f2f-c859-4ed2-8759-7dd61140ed7e fwd="197.202.137.127" dyno= connect= service= status=503 bytes=
2014-07-07T21:18:55.477270+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=essog.herokuapp.com request_id=b537a2d1-ef6d-46b4-b176-2d8a7eefd1eb fwd="197.202.137.127" dyno= connect= service= status=503 bytes=


is there any hack to espetially upload an application on Heroku?
here is the code: is use the 8000, and i guess they bind a port from their numbers?

aliane abdelouahab

unread,
Jul 7, 2014, 9:30:19 PM7/7/14
to python-...@googlegroups.com
I found this:
on Node.js they put :
var port = process.env.PORT || 5000;
so how to make this hack on Tornado? 

Ben Darnell

unread,
Jul 8, 2014, 12:38:53 AM7/8/14
to Tornado Mailing List
If you're using tornado.options, the simplest way is to add "--port=$PORT" to your Procfile, as seen here: https://devcenter.heroku.com/articles/procfile#process-types-as-templates.  Otherwise, you can use `app.listen(int(os.environ.get('PORT', '5000')))`.

-Ben 

--
You received this message because you are subscribed to the Google Groups "Tornado Web Server" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python-tornad...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

aliane abdelouahab

unread,
Jul 8, 2014, 1:17:43 AM7/8/14
to python-...@googlegroups.com, b...@bendarnell.com
I think i will forget Heroku :D
i tried it on CloudControl and it works! without any break head :D

avi

unread,
Jul 8, 2014, 6:08:23 PM7/8/14
to python-...@googlegroups.com, b...@bendarnell.com
In heroku they make port number make available by env variables $port. and also you need have to have a 'procfile' where you would mention how the app is run. In that you can run it via a port. 

sample procfile: 

web: python main.py --port=$PORT

if you want example of deploying a Tornado app in Heroku, here you go: https://github.com/avinassh/heroku-tornado-starter and that of openshift: https://github.com/avinassh/openshift-tornado-starter

aliane abdelouahab

unread,
Jul 8, 2014, 7:02:45 PM7/8/14
to python-...@googlegroups.com, b...@bendarnell.com
i tried CloudControl and i liked it, what i like espetially that i dont have to recompile the whole image when i make changes on code, it only compile what it has to do.
i like it! 
Reply all
Reply to author
Forward
0 new messages