12 herbs & spices :: django & capistrano

December 10 2007

Web operations have been described as the secret sauce of 2.0. It’s not an area that I deal with at work but I keep up to date with architectural decisions that impact web ops - especially around caching. I found Artur Bergman’s talk on the LiveJournal approach to architecture at Kiwi Foo both entertaining and informative. The LJ approach is being leveraged by many in both the Rails and Django community, with memcached, perbal or nginx being used as building blocks for scaling 2.0 operations. For more background on web operations/architecture check out the O’Reilly Radar Operations blog for more of Artur’s and others wisdom. O’Reilly are running a conference on the subject next year. High Scalability is another source of information on scalable web architecture.

With this in mind, when I was asked this weekend for some advice from a friend looking to put together a web play together I stressed the need for them to get the combo of a decent architecture, an ops machine in place before going crazy with feature development. Once this is in place they can get a minimal release up, then push out new functionality quickly and reliably - well at least from the web ops side of the equation. The less effort they have to focus on deployment and admin the more they can spend on developing the functionality that matters for their users.

So after dispensing this advice I thought that I should walk the talk myself and implement some of my own advice for this blog’s system. This blog was the typical ‘my first django project’. It was rapidly constructed around Christmas last year, porting existing content from the Rails based Typo system I had previously used.

I don’t make many changes to the code, arguably I don’t make that many changes/additions to the content either. However I’ve now placed the code under Subversion control and have installed Capistrano to automate admin tasks, specifically the deployment of new code onto my production server. Version control is mandatory for projects with more than one person working on them and highly desirable even if there is just one. For more information/explanation - should it be required - check out this visual guide to version control.

Simply put, Capistrano is a tool for automating tasks on one or more remote servers. It executes commands in parallel on all targeted machines, and provides a mechanism for rolling back changes across multiple machines. It is ideal for anyone doing any kind of system administration, either professionally or incidentally.

Capistrano is a Rails related tool. It’s primarily used for deployment but can be used to automate any set of tasks. And whilst it has come out of the Rails community and is written in Ruby it can be used in association with any language/web framework. Tasks to be automated are described in its own domain specific language (DSL) so there’s no requirement to learn Ruby. Capistrano is now at 2.1 and whilst there is a chapter on version 1.0 in the online Rails book there is little on 2.0, though improved 2.0 documentation can be expected. So here’s the sources I used to grok it for for deploying a non-Rails web application.

Prerequisites:

  1. ssh and client certificates setup to provide password-less access to your production server from your workstation
  2. knowledge of how your production environment works
  3. a version control system, such as subversion setup and accessible from your production server

Timothee Peignier has written up the best description on how one can utilise Capistrano with Django. However I would qualify that by saying that you will get more, or get it quicker, if you first read up on Capistrano generally. Start with the minimal getting started doco, then read through the slides by Jamis Buck from the RailsConf. Test things out with some of the small examples. Understand how Capistrano is typically used with Rails, via the capify command that produces a Capfile and an associated config file. Find and read through the source (deploy.rb) for the Capistrano default tasks. Then read through Timothee’s post. You’ll almost certainly have to tweak the tasks to get things working for your own environment.

Unless you have a compelling reason to do otherwise I would go with the flow and use Capistrano’s method for organising releases. This approach lets you get the most from what Capistrano provides for free, with you only having to refine the tasks specific to your environment.

update:
Django added auto escaping of HTML in the version that I installed when putting Capistrano in place. I missed addressing that in the feed's templates.
Fixed now.


Filed under: django  start_up  tech  python 

hyperlocal

February 20 2007

Part 1

Part 2

Here’s a couple of interviews with Mark Whitaker, former Newsweek editor, who is now VP and Editor in Chief of New Ventures Washingtonpost.Newsweek Interactive (WPNI). He speaks with Jeff Jarvis about hyperlocal publishing. If that concept sounds familiar it may be because Rob Curley ex-Lawrence Journal-World is also at WPNI. Along with Django lead developer Adrian Holovaty.

Whitaker sees local bloggers providing “good solid reporting around the country” taking the place of the local papers. Many of which are closing in the US.
Supporting this move WPNI is creating an ad marketplace for local bloggers - which also provides WPNI with a way of participating in the more targeted models of advertising.
He also sees video as a key element for online newspapers. He suggests that although broadcasters should have the natural advantage in exploiting video online they are limited by self imposed assumptions over production values and what works on TV.

update 20 Feb 07:
Cory Bergman at Lost Remote is also pondering why local TV is losing out online.

update 26 Feb 07:
Washington Post feature as a case study on the Apple Pro site where they focus on the video production occurring within the digital forms of the paper. Including the video interview series onBeing by Jenn Crandall.


Tip of the hat: http://www.beet.tv

Filed under: media  django 

the first post

January 1 2007

This is the first post of 2007.

But more importantly, it is the first post I've made using the new blog system.

I have built the new system using Django. In reality Django makes things so easy that it's more accurate to describe what I've done as configuration. It has taken three days of mixed effort to port the blog from the Rails based typo to the new system. This included reading the draft of the forthcoming Django Book.

The benefit to users of this blog is the addition of keywords. Now you can navigate by keyword and subscribe to specific keyword feeds (rss and atom).

Going forward I'd like to add related media feeds, music, books, podcasts and videos.

Update 02/01/07: I've just added comments.

Filed under: django 

Read 1 Comment