Services.uwsgi usage / uwsgi + radicale?

Is there any (complete) documentation or example for how to use services.uwsgi?
Or is uwsgi simply broken?

I’ve tried to set up lighttpd + uwsgi + radicale, but nothing worked. And even trying to run uwsgi manually via uwsgi --wsgi-file ... as described in the uwsgi-quickstart-documentation failed, because uwsgi does not know the --wsgi-file parameter…

Hi @rkoe,

you can have a look at my home server configuration at https://github.com/azazel75/giskard-configuration/blob/b59497357d9ba69dd658d87a03d804ae09af5624/containers/nextcloud/default.nix

It uses uwsgi ( with php-plugin but it’s similar for python) + nginx. I don’t have any example with lighthttpd though.

With python, you have to build an environment that contains your package with all its dependencies and then specifiy the wsgi object to uwsgi in its module option, like specified here: https://radicale.org/wsgi/

I hope it helps

Thanks for your example.

Currently, I’ve moved away from uwsgi, because (a) although it’s described as “developer/sysadmin-friendly”, it’s not and (b) the uwsgi-package in NixOS seems useless when not used via services.uwsgi, because it does not include any plugins and so nothing works, even --wsgi-file fails.

(I’m now using a systemd-user-service and flup as scgi-wsgi-wrapper, which is easy to set up and works well.)

I do not know what you mean for developer/sysadmin-friendly it is a service that is completely configurable using services.uwsgi subtree, I don’t understand why one shouldn’t use it. and btw, it is compiled with python2, python3, ruby, php and cgi plugins, see https://github.com/NixOS/nixpkgs/blob/195f8ac5ac62c7d11fe43bb077b91c184df931a5/pkgs/servers/uwsgi/default.nix#L21

The Nixpkgs-package-description of uwsgi says “A fast, self-healing and developer/sysadmin-friendly application container server coded in pure C”. And that’s simply not true. I can explain why I don’t use it:

  • The package itself (without services.uwsgi) does not really work: Everything from the uwsgi-quickstart-documentation fails, and there’s no documentation for making it work. It looks like uwsgi even needs a wsgi-plugin, which is missing (wtf?).

  • The uwsgi-documentation says: “When you start learning uWSGI, try to build from official sources: using distribution-supplied packages may bring you plenty of headaches.” So, I shouldn’t use the distribution-packages, but do everything myself. Great.

  • services.uwsgi is not well documented. You probably need some previous experience with uwsgi and have to guess how to use it.

No matter what I tried, I did not get radicale (or any other custom service) to run with uwsgi. I would probably have to completely ignore the NixOS-uwsgi-package/service, download the uwsgi-source and setup a user-service using this uwsgi-instance. Before I do this, I rather use a simple scgi-wsgi-wrapper instead, which is much easier to use than all this uwsgi-hassle.

Thanks @azazel75 - your example was really helpful to me!

I’m glad it worked for you!

There’s also a nixos test with a minimal example. nixpkgs/uwsgi.nix at a5c3e147855db4439c59f8c5320895509687c73c · NixOS/nixpkgs · GitHub

Ooo that is really cool too. Thanks!

FWIW I also found it difficult to understand uwsgi configuration which in the end resulted in using gunicorn to run my wsgi script instead.

@b42 I’m porting my existing ansible deployments to Nix. They use and configure uwsgi already so I don’t have to learn / build these pieces when writing apps modules. On the other hand I’ve never done any deployment on gunicorn so it is hard for me to compare :wink: