[Freedombox-discuss] uWSGI

Jonas Smedegaard dr at jones.dk
Tue Oct 8 15:36:14 UTC 2013


uWSGI 1.9 - webserver middleware framework - is now in testing, and I 
recommend exploring its use for serving web apps.

Why uWSGI?  To save memory and to isolate apps from each other!

Web apps are commonly served by extending Apache2 itself with a module 
to support PHP, Perl, Python or whatever language the app needs. Most 
often that implies the app is executed under same user ID as the httpd 
daemon itself - and same as all other served web apps!  If one app gets 
compromised, crashes or hangs, quite likely they all are affected.

Imagine if that language-support module could run separately from the 
httpd daemon, under a separate user ID and - as needed - in a chroot or 
an LXC-like container.  That's what uWSGI provides.

Imagine not preloading but only executing on-demand - like CGI but 
optimized for that pet webapp framework that happens to be used, and 
when loaded then kept in memory until other activities need the occupied 
memory.  That's provided by uWSGI as well.

uWSGI also supports a recent kernel technique for long-running webapps 
to save memory: http://uwsgi-docs.readthedocs.org/en/latest/KSM.html

uWSGI has been around for a while - it is in stable (Wheezy) - but 1.9 
now in testing includes a range of new features, including direct 
support for more environments like Perl PSGI and PHP, and support for 
Linux containers (a.k.a. LXC).

It will help FreedomBox - and Debian in general - if you (yes, you!) try 
install the Debian package for your pet web app, but disable/ignore its 
included config snippets for Apache2 and instead make an uWSGI snippet.

Here are some guides to get you started:

https://uwsgi-docs.readthedocs.org/en/latest/WSGIquickstart.html
https://uwsgi-docs.readthedocs.org/en/latest/PSGIquickstart.html

When you have a working uWSGI snippet, file a wishlist bugreport against 
the webapp package, proposing to have it support uWSGI officially.

If you maintain Debian packages and want to include some of the cool 
snippets now reported by FreedomBox developers, then have a look at e.g. 
the ciderwebmail package in experimental.

Plinth, specifically, uses WSGI but via the CherryPy framework which 
isn't specifically listed in above quickstart.  Maybe the very barebones 
setup below "01-welcome" of https://bitbucket.org/akorn/helloworld/src 
is helpful.

NB! As a sidenote, if you code in Python and wonder which framework to 
use for your next project, then you may find inspirational those 
articles referenced from https://bitbucket.org/akorn/helloworld/src - or 
perhaps provocative ;-)


 - Jonas

-- 
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: signature
URL: <http://lists.alioth.debian.org/pipermail/freedombox-discuss/attachments/20131008/89b53cba/attachment.sig>


More information about the Freedombox-discuss mailing list