[Labs-l] Migrating a web app from Toolserver to Labs (Python, WSGI/flup)

Johannes Kroll johannes.kroll at wikimedia.de
Tue May 14 06:38:09 UTC 2013


Hi!

As a first test how hard it would be to port RENDER tools to Labs, I
migrated the Limes Map beta:
http://tools.wmflabs.org/render-tests/limes/web/
This is some information about a few minor problems I encountered and
how to solve them. 

A very helpful getting started guide has been written by Magnus Manske:
http://wikitech.wikimedia.org/wiki/User:Magnus_Manske/Migrating_from_toolserver

Creating SQL databases is not (yet?) supported or allowed for tool
accounts, so I had to change the scripts to use the default DB, which
is named like the tool account.

The tool data directory contains an access.log file, but no error log
yet. Per-project error logs will hopefully be added soon, which will
make it easier to figure out problems.

One of the scripts had a hash-bang like
	#!/usr/bin/env python
which worked on the Toolserver but made the script fail to start on
Labs with a 503 error. Removing the 'env' and using only the
interpreter path made it work.

I had a .htaccess file with the lines
	Options +ExecCGI
	AddHandler cgi-script py
These are not required on Labs and made scripts fail to start with a
503 error, so I removed them. 

.htaccess authentication using AuthType Basic + AuthBasicProvider file
is supported, but the web server can only read the AuthUserFile if it
is owned by www-data, so page loading fails after prompting for a
password. Non-root users cannot chown the file themselves; Coren did it
for me. As I understand it this is going to be fixed with an upgrade of
apache.

CGI/WSGI Scripts, as well as the directory containing them, need to be
owned by the tool account to be able to start. There is a utility
available, 'take DIRECTORY', which recursively changes the owner of
DIRECTORY to the calling user (without requiring root).

The people on #wikimedia-labs are helpful, so if you encounter
problems, it is a good idea to ask somebody there.

 - J.

-- 
Johannes Kroll
Softwareentwickler

Wikimedia Deutschland e.V. | NEU: Obentrautstr. 72 | 10963 Berlin
Tel. (030) 219 158 26-0

http://wikimedia.de

Wikimedia Deutschland - Gesellschaft zur Förderung Freien Wissens e.V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg
unter der Nummer 23855 B. Als gemeinnützig anerkannt durch das
Finanzamt für Körperschaften I Berlin, Steuernummer 27/681/51985.



More information about the Labs-l mailing list