unbit / uwsgi

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

uwsgi-emperor: vassals ini-file should take precedence over defaults-file #517

Closed mathiasertl closed 10 years ago

mathiasertl commented 10 years ago

As described in the last two comments in #383, the file passed via the vassals-include option takes precedence over the actual configuration file of a vassal. This means that if you specify e.g. the uid in both files:

$ grep ^uid vassal-defaults.ini vassals/pypiserver.ini 
vassal-defaults.ini:uid = root
vassals/pypiserver.ini:uid = pypiserver

The pypiserver instance will start as root - not as a normal user, as one might expect. The emperor-documentation does not make a clear statement over what file is supposed to take precedence, but the naming vassal-defaults.ini certainly implies that the instance-specific configuration should.

The issue can be solved (as far as I can tell) by simply reversing the order of the passed arguments. uwsgi-emperor starts the instance like this:

/usr/bin/uwsgi-core --ini pypiserver.ini --include /etc/uwsgi-emperor/vassal-defaults.ini

... which then runs as root. If you manually start the instance but with reversed order:

/usr/bin/uwsgi-core --include /etc/uwsgi-emperor/vassal-defaults.ini  --ini pypiserver.ini

... the instance starts as the user specified in pypserver.ini.

unbit commented 10 years ago

all of this usages are covered in 2.0 by --vassals-inherit-before/--vassals-include-before and in 2.0.1 by --inject-before and --inject-after (they allow to override magic vars too)

mathiasertl commented 10 years ago

I just tested --vassals-include-before, works like a charm. In that case the bugreport is a different one: None of these options are mentioned in the documentation, so it needs updating.