V
V
veitmen2015-02-18 10:37:18
Software Deployment
veitmen, 2015-02-18 10:37:18

websocket + tornado + flask. How to use on sale?

Hello.
Raised the application flag. I launched it under a tornado locally. I use a handler to work with websocket. To run, I simply execute some code to run. The actual code to run:

from app.websocket.handler import WSHandler
from tornado.wsgi import WSGIContainer
from tornado.web import Application, FallbackHandler
from tornado.ioloop import IOLoop
from app import app

if __name__ == '__main__':
    wsgi_app = WSGIContainer(app)

    application = Application([
        (r'/echo', WSHandler),
        (r'.*', FallbackHandler, dict(fallback=wsgi_app))
    ])

    application.listen(5000)
    IOLoop.instance().start()

The question is, how can I properly place this business on the sale? Prod ubuntu 14. Can this case be hidden behind Apache2? I read that it is advised to use nginx, but I don’t know how to configure it, just like Apache, and I don’t quite understand how this server will work inside the server. Or Apache or nginx will act as a balancer.
Preferably specific. I'm not big on Ubuntu and servers.
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri Shikanov, 2015-02-18
@veitmen

Everything is very simple:

  • install Nginx (preferably the latest version)
  • configure reverse proxy for flask application
  • configure proxy for websocket

M
Michael, 2017-10-25
@mirbook

Damn, I found the answer in one of the similar questions:
copy ~/.ssh/id_rsa.pub on your LAN and give it to ~/.ssh/authorized_key already on your vps

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question