Version 9 (modified by unbit, 5 years ago) (diff)


Packaging the uWSGI server

Starting from version 0.9.7, the uWSGI platform is fully modular.

Packagers should try to split all the component in various packages.

The core profile in buildconf directory will build a uWSGI server without plugins.

This server will search for plugins in the current directory. This is not very practical for a distribution package, so the first step would be defining a plugin_dir in your build profile

inherit = default
plugin_dir = /usr/lib/uwsgi
embedded_plugins = null

/usr/lib/uwsgi is a good choice for most of the os/system but feel free to change it to something better. Save the file to a new profile (buildconf/package.ini for example) and build it:

python uwsgiconfig --build package

(if you have not called the file package.ini change the --build argument)

Now we have the core server. Package it in a system path directory (/usr/bin is a good choice) and eventually add your init scripts.

Building the plugins

There are a lot of plugins available, you should make a package for each one.

The most useful example is the python one.

Python has different version available, and probably you would want to allow users to load the specific version on demand.

The objective is having all of these packages available:


Let's build each one

python uwsgiconfig --plugin plugins/python24 package
python uwsgiconfig --plugin plugins/python25 package
python uwsgiconfig --plugin plugins/python26 package
python uwsgiconfig --plugin plugins/python27 package
python uwsgiconfig --plugin plugins/python31 package
python uwsgiconfig --plugin plugins/python32 package

Pay attention to the last arg, it is the name of the build profile used for the core

Now in /usr/lib/uwsgi we will have the plugins. Put each one in the specific distro package

Loading plugins

The standard way for loading uwsgi plugins is using the

--plugins plugin1,plugin2,...pluginN

directive (you can put it in configuration files, ldap entry or environment variables)

But there is a 'magic' way for loading plugins.

Make a series of symbolic links to the uwsgi binary

ln -s uwsgi uwsgi_python24
ln -s uwsgi uwsgi_python25
ln -s uwsgi uwsgi_python26
ln -s uwsgi uwsgi_python27
ln -s uwsgi uwsgi_python31
ln -s uwsgi uwsgi_python32

Calling one of those symbolic links will automatically load the specific plugin

Starting apps

Probably the best way for auto-starting apps is using the Emperor. It allows you to monitor directory for the presence of uWSGI config files and to automatically pass configuration parameters to all the instances.

An auto-deploy system could be based on the admin linking approved app config files in /etc/uwsgi.

The apps will be auto spawned if the emperor is running like this

uwsgi --emperor /etc/uwsgi

Feel free to experiment various way of startup scripts.


Auto-loading plugins, based on option passed to uWSGI would be awesome. We are working hard for it.

The idea is something like this

  • option parser found a unavailable option
  • uWSGI scan the plugin_dir and load all the unloaded ones
  • If the plugin export the specific option it will remains loaded
  • If the plugin does not export the option it will be unloaded