Il giorno 05/giu/2012, alle ore 12:26, Tarek Ziadé ha scritto: > 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
benoit has already answered about that > >> 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 it is automatic if the fd is the zero one, otherwise you have to "authenticate" it adding a --socket/--http-socket/--fastcgi-socket directive mapping to the address (this is required for avoiding uWSGI inheriting unrelated sockets, like the ones created by ssh-agents and whatever you want). For example if you map fd 17 to 192.168.1.1:4040 you have to run uwsgi with --socket 192.168.1.1:4040 it will find fd 17 mapped to a socket, and it will know the socket is authorized to be used. Other components take the special fd://<n> syntax (like the various routers) but i do not think you are intersted in them >> 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. if this is your objective i suggest you to follow the inetd/fastcgi style approach and use file descriptor 0 as the communication socket. Flup and uWSGI will work over this automatically. Gunicorn will work simply adding GUNICORN_FD=0 Adding another env-var will mean each server will need to add a condition for that (like upstart and systemd) -- Roberto De Ioris http://unbit.it JID: robe...@jabber.unbit.it _______________________________________________ Web-SIG mailing list Web-SIG@python.org Web SIG: http://www.python.org/sigs/web-sig Unsubscribe: http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com