Add FastCGI support

Bug #447609 reported by Mark Lee
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fix Released

Bug Description

Loggerhead should come with a FastCGI script, for the users whose webhosts will not let them proxy a serve-branches/loggerheadd instance.

I currently have a proof-of-concept working, but in order to configure it, it requires a configuration file with a format different from loggerheadd. (Basically, it maps the config keys to the relevant command-line arguments of serve-branches.) There are two options to move forward:

* figure out a way to have both configuration formats coexist in the branch/tarball
* handle configuration directly in the FastCGI script (much like the bzr FastCGI script in the docs)

Related branches

Changed in loggerhead:
status: New → Triaged
importance: Undecided → Medium
Revision history for this message
Denis Martinez (deuns-martinez) wrote :

I have managed to get SCGI working with trivial changes to the 1.17 startup script (
It uses flup, which supports SCGI and FastCGI equally, so it's nearly the same.

I replace the line: httpserver.serve(app, host=host, port=port)

    from flup.server.scgi import WSGIServer
    WSGIServer(app, bindAddress=(host, int(port))).run()

just use "from flup.server.fcgi import WSGIServer" if you want FastCGI.
I can confirm this script works great in the Cherokee web server.

This lack of feature is stupid to fix but annoying, I hope it gets mainline quickly.

Revision history for this message
Denis Martinez (deuns-martinez) wrote :
Revision history for this message
Martin Albisetti (beuno) wrote :

Hi Dennis, thanks for working on this.
Is there any chance you could create a branch with this, and submit it as a merge proposal?
It's hard for me to see the changes.

Also, to submit code to loggerhead, we will need you to sign the copyright assignment:
It's a bit of a pain for such a small patch, but it's a formality we've been asked to follow.

Revision history for this message
Mark Lee (malept) wrote :


Is config handled via the "command line" arguments? If so, this does not help for my use case (although I'm sure it will be useful in the loggerhead distribution). My current webhost runs .fcgi files via whatever mod_* Apache module that they use, e.g. <>. In the case of bzr's smart server, I used the example code from the user guide and mapped the resulting .fcgi file to .bzr/smart.


Perhaps loggerhead should follow the example of bzr, and have a function which automatically generates a WSGI app based on the parameters given, and also have an example .fcgi file in the tree?

Revision history for this message
Denis Martinez (deuns-martinez) wrote :

Martin: I have sent you the form, and created a merge proposal.

The new patch adds fcgi, scgi and ajp, I have made it clean so I hope it's good enough for inclusion.
It introduces a --protocol argument which takes one of these protocol names. The default behavior remains the same.

Mark: It takes arguments from the global config object, so maybe. I don't know because I haven't tried.

Revision history for this message
Denis Martinez (deuns-martinez) wrote :
Revision history for this message
Matt Nordhoff (mnordhoff) wrote :

Now that lp:~deuns-martinez/loggerhead/flup has landed, is that enough, or is there more work to be done, like adding a "serve-branches.fcgi" script to make it more obvious for users to get up and running?

Revision history for this message
Mark Lee (malept) wrote :

That'd probably be helpful for people who aren't too familiar with WSGI and/or FastCGI.

Revision history for this message
Max Kanat-Alexander (mkanat) wrote :

I think that simply having the flup branch landed is enough.

Changed in loggerhead:
status: Triaged → Fix Committed
Changed in loggerhead:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.