I've a Django app inside a docket that uses uwsgi. Since we have several Dockers running on different machines we have haproxy as load balancer.
My question is: should I use uwsgi with http
or http-socket
?
From here https://uwsgi-docs.readthedocs.io/en/latest/HTTP.html
It seems http
The http-socket option will make uWSGI natively speak HTTP. If your web server does not support the uwsgi protocol but is able to speak to upstream HTTP proxies, or if you are using a service like Webfaction or Heroku to host your application, you can use http-socket. If you plan to expose your app to the world with uWSGI only, use the http option instead, as the router/proxy/load-balancer will then be your shield.
The last part suggest that http
is what to do if there's a load balancer
But here https://uwsgi-docs.readthedocs.io/en/latest/ThingsToKnow.html
The http and http-socket options are entirely different beasts. The first one spawns an additional process forwarding requests to a series of workers (think about it as a form of shield, at the same level of apache or nginx), while the second one sets workers to natively speak the http protocol. TL/DR: if you plan to expose uWSGI directly to the public, use --http, if you want to proxy it behind a webserver speaking http with backends, use --http-socket.
It seems to infer that http-socket
if not exposed directly to public
So, what the way to do it with haproxy?