I'm not sure if this is a good idea in the least, but it just occurred to me
and it might just work:
For each deferred vassal config file, have a secondary file for the socket
containing just the
activation socket spec:
/etc/uwsgi/vassals/awesome-app.ini
[uwsgi]
blah = blahblah
/etc/uwsgi/vassals/awesome-app.ini.socket-def (not .sock to disambiguate from
UNIX sockets)
127.0.0.1:8080
/etc/uwsgi/vassals/i-like-xml.xml
<uwsgi>...</uwsgi>
/etc/uwsgi/vassals/i-like-xml.xml.socket-def
/run/sock/xml-is-awesome.sock
etc.
- Aarni
-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Roberto De Ioris
Sent: Monday, March 18, 2013 6:45 PM
To: uWSGI developers and users list
Subject: Re: [uWSGI] on demand vassals
> On Mon, Mar 18, 2013 at 9:48 AM, Roberto De Ioris <[email protected]>
> wrote:
>>
>> Hi, i have just committed (in 1.9) support for "on demand" vassals.
>>
>> Basically when you add a vassal, the Emperor will start tracking it, but
>> it will spawn the processes only at the first connection to the
>> specified
>> socket.
>>
>> The system already works for configurations stored in postgresql,
>> mongodb
>> and for zeromq messages:
>>
>> import zmq
>> c = zmq.Context()
>> s = zmq.Socket(c, zmq.PUSH)
>> s.connect('tcp://127.0.0.1:5252')
>> s.send_multipart(['touch','foo.ini',"[uwsgi]\nhttp-socket=fd://0\nmodule=werkzeug.testapp:test_app",
>> '0', '0', ":9090"])
>>
>> as you can see the socket is mapped as the fd 0, so in addition to
>>
>> socket/http-socket/fastcgi-socket/scgi-socket fd://0
>>
>> you can simply use:
>>
>> protocol = uwsgi|http|fastcgi|scgi
>>
>>
>> I would like to add the same system to configurations based on simple
>> files and globs. Some idea on how to specify the socket ? (please do not
>> suggest xattr as they are a mess to maintain on different servers, at
>> least for me...)
>
> why define the socket out-of-band/out-of-file? how will the app know
> what port it is really on?
This is the case i am referring to:
http://blog.pythonanywhere.com/36/
(i have customers with more complex scenarios, but pythonanywhere has made
their config public, so let's use it as prototype ;)
basically what they do in "The world of pain I've glossed over" is really
overkill, but honestly without writing a lot of code i do not see (for the
time) better solutions.
With "on demand" vassals, they simply register the list of socket
(domains) to bind on, and then instances will be spawned when needed (and
more important the emperor will get rid of fork borbing for free)
Regarding the Emperor parsing config files, that will require lot of
effort, and i suppose lot of ISPs do not want to show where the sockets
are (or leave the user the freedom to choose them [in Unbit for example,
users do not choose the socket, they inherit descriptor 0 like in
fastcgi]).
I suppose we could make thing simple and let the admin define a pattern like:
/etc/uwsgi/foobar__(.+)__.ini
with $1 being the socket to wait for. But how to wait for tcp sockets
wihout having crazy filenames ?
/etc/uwsgi/foobar__127.0.0.1_8080.ini
seems a bit foolish to me (or not?) ...
--
Roberto De Ioris
http://unbit.it
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi