Articles tagged: mwfeeds

Using bzr for developing a web app

937 days ago

So I have been working on a little web app, mwfeeds, designed to provide some additional useful feeds for MediaWikis. Namely, feeds of user contribs, feeds of log events and “new section” feeds. MediaWiki already provides page history feeds (edits to a page), as well as Recent changes, New pages and watchlist feeds, but for some reason logs and user contribs don’t have their own feeds.

And as it would be harder for me to figure out how to add them to MediaWiki vs build an external application that produces them based on the API, I decided to go with the latter. Anyone who can do the former should feel free to go ahead and add such feeds directly. :)

The “new section” feed is intended for use on high-traffic talk pages and community noticeboards, where subscribing to the page history feed and getting ALL edits would be overkill.

So it’s written using web.py which is a light-weight Python framework. I got it to a state of minimal working, just running it on my laptop, and used bzr to push it up to Launchpad. I love how light-weight bzr is. Within minutes the whole world could see my code. woot!

Today my task was to figure out how to get it working as a web app that people other than me could access. So far all my webhosting (this site, and modernthings.org) is done by Dreamhost, although I can tell I’m almost ready to leap out to my own VPS. But for now — shared hosting it is.

Although Dreamhost gets a bad rap for Django, at least setting up web.py was simple. Dreamhost’s wiki has good instructions.

However the next challenge was to get the code from Launchpad to my webhost. bzr seemed the obvious way, and its install instructions on the Dreamhost wiki also worked to a T. But then there was a problem:

bzr branch lp:mwfeeds .
bzr: ERROR: Target directory "." already exists.

Hmm! But surely it must be possible to put a branch in an existing directory? I did a bit of googling and came up with naught, so I jumped on IRC to see if someone could give me an answer. And I found out that the --use-existing-dir flag was only being added to branch in 1.17. And the 1.17 release candidate was only released this month, so it will be a while before it is released as stable.

The folks on IRC seemed confused about why I would want to mix “versioned and unversioned data”. I explained what I’m doing and one of them suggested the plugin bzr-upload. As the readme explains,

bzr-upload is a plugin for Bazaar which lets you upload your working tree to a remote location using ftp/sftp. The main target audience is web developers who keep their web pages version controlled with bzr.

To install it, I just need to do

mkdir ~/.bazaar/plugins
bzr co lp:bzr-upload ~/.bazaar/plugins/upload

Oh, and install the PPA for bzr since the one provided by Hardy Heron was only 14 releases behind. :) I love PPAs. Oh and sudo apt-get install python-paramiko.

So then, to set myself up:

bzr upload ftp://[username]@[host]/mwfeeds.modernthings.org/
bzr upload --auto

(If you only use ftp, not sftp, you don’t need to install paramiko.)

And on my next commit… sure enough! FTP jumped on board as well. Sweet.

Now this just means I’ve solved my code syncing problem, mind, not the couple-dozen errors I get when I try to run it for the world… solving [default webserver?] vs Apache differences and Dreamhost idiosyncracies will have to wait for another day.

tags: , ,

Comment

---