-
-
Notifications
You must be signed in to change notification settings - Fork 14.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add uWSGI application server #5277
Conversation
We should probably support running more than one instance of uwsgi |
Good idea. This should look better together with systemd's |
Have you looked into uwsgi's emperor mode: This just requires starting the uwsgi in Let me know if I can help out in any way. |
The emperor mode would already work with this, but multiple uwsgi instances would be simpler for end-user if they are statically known. |
I've thought about this -- emperor mode and multiple systemd services implement the same thing, if one would describe everything in his configuration. If not, emperor mode can be more flexible, as we can state a directory and add or remove services from it. If emperor mode would be enough for everyone, we can leave this as a single systemd service -- are there any usecases where multiple services would be better? |
I use emporer mode whenever I need more than 1 uwsgi instance, but I only use it for python/django so I'm not sure about other scenarios. |
So, @iElectric , do we need to support more than one instance or emperor mode should be enough? Maybe with some additional support from the module side? |
We could use emperor mode in NixOS itself, but I'd still have configuration for multiple services as a module. |
@abbradar we could touch that later, if you feel it's too much work. |
Sorry for taking a long time, redone this -- now you can have arbitrary tree of emperors and their vassals with some sugar for configuration. |
|
available = [ (pythonPlugin python2) | ||
(pythonPlugin python3) | ||
]; | ||
needed = builtins.filter (x: lib.any (y: x.name == y) plugins) available; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The indention of this line is more than of the other lines. Is there any reason for this?
Sorry for bitching around because of this, but this stuff makes reviewing hard, at least for me... 😏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is codestyle oftenly used in Haskell, sorry for this. I'll fix this to stick to Nix standards.
So the "pure" way to use this with python would be to create a custom package for the project you're deploying and feed this to normal mode? |
@prikhi Sorry for taking a long to answer. No, you are supposed to set |
@matthiasbeyer I tried to make it look better, try this and please say what I can improve. And thanks for the criticism, in my opinion it is very important for the code to be structured as readable as possible! |
Might be a good idea to add an example configuration to documentation. |
Added example and fixed a couple of bugs while at it; now emperor mode is properly tested, too. |
Any further comments? I think of merging this tomorrow. |
I don't understand the significance of having python2/3Packages be a function instead of a list, but my nix-fu is not too superb. |
This is to enforce you to use Python packages of the same version as Python uWSGI was compiled with. Well, it's not enforcing you in reality (you can as well return your own evil package), but this way you wouldn't bother about version mismatches -- if uWSGI's Python changes, so will input to your function, and hence, versions of your packages. |
You can look at it as a way for you to write
instead of
or (unsafe! we don't know if uwsgi was built with the same Python as default!)
|
For now only Python plugins are supported (I haven't used uwsgi for anything besides Python and have no idea of needed workarounds, environs and so on).