Search code examples
openshifttornado

How to deploy tornado on openshift


When I start tornado application through ssh I get this error:

Traceback (most recent call last):
  File "/var/lib/openshift/54f9750d4382eca672000091/app-root/runtime/repo//app/ws_server.py", line 111, in <module>
    app.listen(8000)
  File "/var/lib/openshift/54f9750d4382eca672000091/python/virtenv/venv/lib64/python3.3/site-packages/tornado/web.py", line 1691, in listen
    server.listen(port, address)
  File "/var/lib/openshift/54f9750d4382eca672000091/python/virtenv/venv/lib64/python3.3/site-packages/tornado/tcpserver.py", line 125, in listen
    sockets = bind_sockets(port, address=address)
  File "/var/lib/openshift/54f9750d4382eca672000091/python/virtenv/venv/lib64/python3.3/site-packages/tornado/netutil.py", line 145, in bind_sockets
    sock.bind(sockaddr)
PermissionError: [Errno 13] Permission denied

I used this project as example, but it doesn't work :( How I can resolve this problem?

If I provide ip like this:

ip = os.getenv('OPENSHIFT_PYTHON_IP')
port = int(os.getenv('OPENSHIFT_PYTHON_PORT'))
app.listen(port, ip)

I get other error: [Errno 98] Address already in use

In addition I would like to deploy two independent applications with Flask and Tornado that have shared codebase.


Solution

  • This is because openshift accepts to listen only 8080 and 15000+ ports. But 8080 already used by WSGI container, so I get already in use when set 8080. If stop WSGI server tornado will work.