[Web-SIG] Starting Web Servers using socket FDs

Tarek Ziadé tarek at ziade.org
Tue Jun 5 12:26:24 CEST 2012


On 6/5/12 11:46 AM, Roberto De Ioris wrote:
> ...
> Gunicorn can already bind (or better, accept) from file descriptors specifying an environment variable.
I don't think you can start gunicorn using a file descriptor, or I 
failed to do it. The best I was able to do was to create a small wsgi server
using Gunicorn as a lib.

Gunicorn uses an environment variable when it respawns workers but it 
does not offer it as a public option as far as I understand how it works

> uWSGI supports by-default the inheritance of file descriptor 0 for fcgi-like startup,
> and working on generic file descriptor or inet/upstart/systemd socket activation.
I did not find a way to start it using a provided fd -- they are 
plethora of options though, maybe I missed it
> The vast majority of modern systems expects the file descriptor number on an environment variable:
>
> upstart: UPSTART_FDS
> systemd: LISTEN_FDS
Yes, this seem fairly standard.
>
> Circus, could follow the same behaviour, but i do not know if a standard will be required for that.
The goal of the standard is just to be able to place any wsgi server out 
there and have it working out of the box.

So far I was not able to run an existing wsgi server like this without 
changing its code because they
all make the assumption they will be run with a host and port.


> Regarding the --fd:12:localhost:8080 syntax, is redundant as you can get the name of the socket mapped to a file descriptor
> with getsockname:
>
> http://linux.die.net/man/2/getsockname
Will look into this again, I had an issue trying to do it.

Thanks for the feedback!

>
> --
> Roberto De Ioris
> http://unbit.it
> JID: roberto at jabber.unbit.it
>



More information about the Web-SIG mailing list