unbit / uwsgi

uWSGI application server container
http://projects.unbit.it/uwsgi
Other
3.45k stars 691 forks source link

Executing different uwsgi binaries per-vassal #549

Closed akx closed 10 years ago

akx commented 10 years ago

I bumped into an issue like this the other day:

However of course the emperor will run only itself, or whatever is set as binary-path in its configuration. The binary-patch options won't work, because uWSGI will then enter an infinite restarting loop as it detects the same binary-patch option over and over.

So, I propose binary-path could also be set in vassal configuration, wherein it has an immediate effect:

This would effectively make it possible for the just-starting uWSGI vassal to switch to the correct uWSGI binary.

Thoughts?

prymitive commented 10 years ago

Can't you compile python support as plugins for each python version and load the right one in each vassal? That's the most common way.

unbit commented 10 years ago

probably i would suggest the plugin approach too (with the new build system is really easy to build ad-hoc plugins as for example in uwsgi.it rvm support: https://github.com/unbit/uwsgi.it/blob/master/snippets/rvm.md#using-rvm).

Eventually give a look at the --emperor-wrapper option that will override the binary used by the Emperor for vassals. You can create an ad-hoc script for exec'ing the right binary (no idea on how to instruct it about the python version, but there are solution for sure)

unbit commented 10 years ago

in 2.1 we have introduced vassal's attributes. You can now have this kind of configuration:

[emperor]
mywrapper = /usr/local/bin/uwsgi_python34

[uwsgi]
http-socket = :9090
...

uwsgi --emperor /etc/uwsgi/vassals --emperor-collect-attr mywrapper --emperor-wrapper-attr mywrapper