All articles, tagged with “system administration”


Kubuntu Karmic

I am about to start a big project for work, and I wanted to get the latest tools on my machine because I know I won’t have the opportunity for a while. Unfortunately, my install of Kubuntu Hardy 8.04 is starting to feel behind-the-times and the latest versions of my applications are getting increasingly hard to install as they depend on newer libraries. However, I have been very nervous to upgrade. I love KDE 3.5; it is a nearly perfect mix of stability, configurability, and usability; perhaps I’ve just grown very used to it. I avoided upgrading to the unfinished KDE 4.0, and have been following KDE4 closely while waiting for it to get complete enough not to drive me crazy. It looks almost there. So last week, when the project start got delayed yet again, I tackled upgrading to the freshly released Alpha 6 of Kubuntu Karmic.

Now I understand that alpha-quality software is not for production use. I also understand that the jump from KDE3 to KDE4 is a big one. However, Karmic is coming along nicely, and Alpha 6 looks almost there. My logic went like this: get the reinstall out of the way, upgrade to ext4, get used to KDE4, get the configuration file merging headache out of the way, and get everything working in the KDE4 version of my most important apps. Then it should be easy to aptitude dist-upgrade through the betas to the release even in the middle of a firestorm.

I expected this project would take a day or two, and it went more or less according to plan, but the experience was more painful than I expected. Perhaps my notes might help out others.

Before upgrading I did some due diligence. I checked the bug database, and didn’t see anything that would obviously effect me. I reviewed the development mailing list logs. Finally, I hung out on IRC for a couple of days and got opinions on the stability of the development branch. At that point I had collected enough courage to jump in.

Impressions of Karmic

For me the big change from Hardy to Karmic is KDE4. However, I did notice:

  • The installer is really fast and easy to use.
  • The system boots far faster.
  • There is no more grub screen by default.
  • I have a bunch of new folders in my home directory that I don’t need and don’t want: Documents, Pictures, Videos, Templates. The Desktop folder is being deprecated. And now they make me use a Download folder (instead of sticking it in Desktop). I’m sure this can all be configured away.

Impressions of KDE4

Summary

It is usable, but not yet as good as 3.5.

Plasma

My first impression of plasma was overwhelmingly negative. I could appreciate the configurability, but found it exceptionally painful to get things organized in a way that supported my preferred workflow. I find plasma’s interaction between panels, activities, dashboards, and virtual desktops to be too complex—especially on my dual monitor setup. It’s a lot simpler with the “one activity per virtual desktop” setting introduced in KDE 4.3, but it still isn’t intuitive. Riddle-me this: 3 virtual desktops across 2 monitors with 1 separate dashboard equals 8 activity panes. It also isn’t obvious what will happen when I disconnect a display. I suspect some of the confusion is related to inconsistent behavior as a result of bugginess.

I also find plasma to be slower than KDE 3.5. Again, it is mostly the effect of zooming out to configure my activities and desktops (the slowness contributes to the feeling of bugginess). It doesn’t seem as snappy and responsive. On the other hand, there are lots of nice effects and they run a lot faster than equivalent effects under the compiz setup I played with previously (and then turned off). The effects are well integrated into system settings and much easier to navigate and tweak than under compiz.

Perhaps the problem with plasma is just having non-intuitive defaults. Things got easier once I deciphered the nomenclature (the weirdest is how they call the “edit plasmoid bubble” a “cashew”; while figuring out the desktop I started feeling an overwhelming urge to get a snack). I started over by deleting all my activities and I let the “one activity per virtual desktop” button set everything up for me. I think I had gotten myself into a bad state while playing around. Now that I’m actually able to use the setup, plasma is really growing on me. It does make it easy to do things that were previously hard to conceive.

I think the paradigm can be just as useful and a lot simpler by merging the idea of activities and virtual desktops. There should then be an option for “virtual desktop per monitor” or “virtual desktop across all monitors”.

Scorecard

Problems with Clean Solutions

  • Kopete fails to connect to Google Talk. Workaround: aptitude install qca-tls.
  • KNetworkManager doesn’t like WPA on my access point. Workaround: use wicd. Bug#: 434342
  • Default weather widgets won’t search for my city. Workaround: use plasma-widget-weatherforecast. Bug#: 434254
  • The change monitor button (Fn-F7, a.k.a. the video button) didn’t work on my ThinkPad T61. This is the same as previous version of Ubuntu (but the monitor naming changed a little bit). Thinkwiki has a solution. Essentially, drop the script into /usr/local/bin, and create a file in /etc/acpi/events/ibmvideobtn that says:
    event=ibm/hotkey HKEY 00000080 00001007
    action=/usr/local/bin/thinkpad-fn-f7
    A copy of the script is here.

Problems with Ugly Workarounds

  • Logging out crashes X and takes the keyboard with it. Workaround: reboot. Bug#: 428662
  • Can’t unlock screen. Workaround: run killall kscreenlocker from a virtual terminal. Bug#: 434276
  • Spaces break bash tab completion. Workaround: prepend command with a slash (). Bug#: 419509
  • Kopete won’t connect to jabber through a CNAME. Workaround: Use the A record or IP address. Bug#: 434214
  • Kmail can’t pass options to GVim. Workaround: use gvim -f %f as the command and lose the options. Bug#: 434180
  • Weird cups problems where cupsctl wants a password on bootup, and then reports “unathorized”. This is easy to ignore, but I got another authorization error while trying to install one of my printers—it reported my password as incorrect. It turns out that temporarily disabling apparmor with /etc/init.d/apparmor stop allowed me to get the task done. Debian Bug#: 543468.
  • Corner actions in SystemSettings→Desktop→Screen Edges conflicts with the ones in SystemSettings→Desktop→Screen Saver→Advanced Options. I didn’t log this one.

Annoying Missing Features

  • Severity 1: It does not appear to be possible to get the Application Launcher to display under the mouse pointer through a click on the background. I use this all the time, and it drives me crazy to have to move my mouse all the way to the panel on the edge of my dual-monitor widescreen display. Typing it makes it sound petty, but it drives me nuts.
  • Severity 4: Konsole doesn’t save a default window size anymore. Whatever size my last closed window has is the size the next one will open with. It’s annoying because I like my terminals to be exactly half of my screen, but sometimes I will adjust it for a specific task. Now every time I adjust it I have to fiddle it back.

Summary

The good news is that in my judgment KDE 4.3 has only one really annoying missing feature. That means that KDE 4.3 is pretty feature complete in comparison to KDE 3.5. Now that I’ve got a usable system, I’m really happy with it. Though this is definitely a usable alpha, I am anxiously looking forward to the final release of Karmic Koala. Hopefully it will include fixes to some of these problems.

Getting Back to Work

Of course the moment I pass the no-turning-back point of the upgrade, I got notified of the start of my project. That means that messing with the alpha has put me behind schedule. I’d better stop submitting bug reports and buckle-down to put my shiny new tools to work.

[ Read More | 2 comments | 0 pingbacks | , , , , , , , ]

Transitioning to Byteflow

Banjo Six Months Later

Banjo is a good foundation for a blog engine, but it needs some work. It is certainly quicker to implement than writing your own blog engine, but it is not as finished as I had hoped. I fixed a number of bugs, and the banjo maintainer was nice enough to give me write access to contribute my changes back. However, my goal was to work with a community where I could learn from experienced Django developers, and there isn’t much of a community around Banjo right now.

Discovering Byteflow

When fireant came across my blog post on Banjo, he asked me why I wasn’t using Byteflow. My answer was that I had not heard of Byteflow. I started looking into it, and it looked like a good alternative to Banjo.

My first impression of Byteflow was very similar to Banjo: lots of features, lots of potential, but it looked like a dead project. The server wasn’t responding well, the homepage news was out of date, and the mailing lists were full of spam.

Then I looked at the IRC logs and found an active community that mostly speaks an Eastern European language (Russian or Ukrainian, based on the location of the authors). When I asked a couple of questions in English, I got very friendly and helpful responses from piranha, the main Byteflow author. Not only are the Byteflow developers active, but they are open to contributions. I helped clean up the newsgroup spam, and updated the homepage to reflect the release last spring. And as I adapted Byteflow to the specifics of my installation, they accepted my patches and got them into the code base in the same day.

So far Byteflow has exceeded my expectations. Not only has it been a reliable blog engine (for the last two days anyway), it also incorporates many of the features I was hoping to implement* in Banjo. Most of all, I’ve been learning a lot from working with the Byteflow developers (piranha already showed me a few cool Mercurial tricks). That is my biggest justification for spending time on a Django blog instead of using a mature product. I’ve been the only tech guy at my family startup for the past year, and I’ve needed to find a project where I can keep my skills fresh by working with others.

* I’m finally an OpenID provider! After almost ten years, I signed up for a Slashdot account just to test it out.

Setting up Byteflow

This week I had two free days between work projects, so I decided to migrate my blog to Byteflow. The installation went very smoothly—the best I have experienced with a Django app.

Dependencies

Byteflow has no dependencies that needed to be filled outside of a typical package management system.

Base (all from Aptitude):

  • Debian Lenny
  • Postgres
  • Django 1.1 (1.0 should work)
  • Python 2.5.2
  • Apache
  • mod_python*

* I’m convinced that I should switch to mod_wsgi, but Byteflow works fine with my existing mod_python install.

From Aptitude:

  • python-psycopg2 2.0.7-4
  • python-openid 2.2.1-2
  • python-beautifulsoup 3.0.7-1
  • python-imaging 1.1.6-3

Installation

In the past the Byteflow project has announced releases, but I don’t see them packaged for download anywhere. It would be preferable to have a known functional configuration. Since it has been a couple of weeks without a series of commits to the Mercurial repository, I decided to have faith that it’s in working condition and I cloned the repo.

hg clone http://hg.piranha.org.ua/byteflow/

It is a small repo and a clean codebase. Everything worked out of the box by copying settings_local.py.template to setting_local.py, editing it to point to a clean database, running syncdb, and pointing Apache to the Byteflow settings.py. The default template came up, and a test post through the admin interface appeared.

Very easy, very slick.

Configuring Byteflow as an App

I like to keep code maintained by other people strictly separate from code I maintain. It was as easy to do that with Byteflow as with most Django apps, but did require some tweaking. The basic idea is to keep Byteflow in my shared_django_libs directory (I’ll call this PROJECT_ROOT), and have the apps Apache sees in a completely different directory tree (I’ll call my personal site REPO_ROOT).

I’ll define a couple of variables to make this easier to follow:

  • PROJECT_ROOT: my clone of the Byteflow repository.
  • REPO_ROOT: the repository where I keep my site.
  • WEB_ROOT: the Apache web root where I keep static files, .htaccess files, and other stuff serve-able by Apache. The location is REPO_ROOT/WEB_ROOT.
  • STATIC_ROOT: the directory where Django serves static files. The location is REPO_ROOT/WEB_ROOT/static.
  • STATIC_URL: the URL where Apache can see static files. It is SITE_NAME + ‘static’.
  • MEDIA_ROOT: The Byteflow settings.py differentiates between media files and static files. I treat them the same, so my MEDIA_ROOT = STATIC_ROOT.
  • MEDIA_URL: As described above, my MEDIA_URL = STATIC_URL.
  • SITE_ROOT: the directory containing my settings.py and other local Django code. It’s at REPO_ROOT/SITE_ROOT.
  • THEMES_DIR: The directory where my local themes live. It is SITE_ROOT/THEMES_DIR.
  1. Copy the default settings.py into your app (not settings_local.py).
  2. Edit your settings.py as follows:
    • At the top of the file, just before the lines where it adds ‘apps’ and ‘compat’ to the sys.path, set PROJECT_ROOT to point at your byteflow install. Then add this line:
      sys.path.insert(0, os.path.join(os.path.dirname(PROJECT_ROOT)))
    • Add variables for SITE_ROOT and WEB_ROOT. Then use those variables to define STATIC_ROOT, MEDIA_ROOT, and THEMES_DIR.
    • Remove the loading of settings_local.py.
  3. Create a file containing your SECRET_KEY, and point your settings.py to it (I used the SITE_ROOT variable).
  4. Add these lines at the bottom of your urls.py, where it can catch any URLs you don’t already deal with:
    import byteflow.urls
    urlpatterns += byteflow.urls.urlpatterns
  5. Copy from PROJECT_ROOT/static to STATIC_ROOT these directories: css, img, js.

That’s all I remember it taking. Now Byteflow plays happily with everything I’m already running.

Creating a Custom Theme

Of course the default theme doesn’t look like _my_ ugly blog. To get my distinctive look, I had to create a custom theme. It took a while to get everything looking right, but the process wasn’t really difficult. It mostly involved me merging the important parts of Byteflow’s default base.html into my existing template, and looking at the other Byteflow themes to figure out how to make changes to the Byteflow pages.

  • In THEMES_DIR, create a directory with the name of the theme you specified in your settings.py
  • It needs a base.html in that directory. My base.html includes the contents of PROJECT_ROOT/templates/base.html, header.html, and footer.html.
  • You can over-ride any template in PROJECT_ROOT/templates by having a template with the same name and directory structure in your theme. For example, I changed the way a blog post looks by copying post_entry.html from PROJECT_ROOT/templates/blog into THEMES_DIR/my_theme/blog, and editing it. You can also override templatetags by copying them from PROJECT_ROOT/templates/templatetags into THEMES_DIR/my_theme/templatetags. I changed the way the dates looked by stealing the datelinks,html from one of the included Byteflow templates. (Thanks for the tip on that one, piranha.)
  • Create a directory in STATIC_ROOT with your theme name, and then you can override the contents of css, img, and js. Took my existing CSS file, called it main.css, and then added a couple of entries to change the look of Byteflow generated elements.

Importing the Data from Banjo

Since I only had 30 or so posts to migrate, I figured I’d just do it by hand to gain experience with Byteflow’s interface and the various markup languages. It also gave me the chance to correct some typos and formatting problems introduced during the last two migrations and the use of Banjo’s unpredictable markup engine. Though I fixed a lot, unfortunately I suspect I added some new typos.

Before I installed Byteflow, I did a pg_dump on my blog database. Then I dropped and recreated the database for Byteflow. I then used that dump to enter each post through the Admin interface.

I couldn’t bear to lose the comments on my previous blog (all two of them), but the Admin UI doesn’t allow comment creation. So I submitted the comments through the blog interface, and edited the DB to have the original timestamps. Unbeknownst to me, Byteflow sent out an email for each comment alerting the original submitter that they had just created an account on my site. One of them contacted me, worried about being blamed for something they didn’t do. If you decide to do a similar migration, disable Django’s email sending ability until you complete the migration.

Problems with reStructered Text

I couldn’t use reStructured Text out of the box. I was getting weird errors that perfectly matched the bug reported here: http://code.djangoproject.com/ticket/6681

The workaround discussed there worked for me. All you need to do is comment out this line in django/contrib/admindocs/utils.py: docutils.parsers.rst.roles.DEFAULT_INTERPRETED_ROLE = 'cmsreference'

With that change, a was able to use reStructured Text on two posts, but the third had strange docutils errors showing up in my page. I didn’t have time to turn that in to a reproducible bug report, so I just switched to Markdown.

Impressions

Banjo features not in Byteflow

There are a few things I preferred in Banjo:

  • Byteflow has no concept of a “Post Summary” and a “Post Excerpt”. The entire post shows up on the home page. I prefer this, but some people might not.
  • Byteflow has a good tagging engine, but it has no concept of hierarchical Categories. Personally, I like Categories better than tags, but I’m willing to live without them for now (I’m emulating them with tags).
  • Byteflow has no concept of a post update time. This also doesn’t bother me, but some might care.
  • Byteflow can not configure the URL to a blog post in the same way as Banjo. I set Banjo up to by YYYY/slug, but byteflow insists on YYYY/MM/DD/slug. Given how rarely I post, I don’t need such a complex URL structure.

Best things about Byteflow

There is a lot to praise, but at the top of my list is the very helpful developer community (as represented by piranha). I appreciated their willingness to accept my patches and allow me to contribute.

The code is well organized and easy to modify.

I also like the way it handles comment spam. When a person posts a comment, a site account is automatically generated and an email is sent to the comment author. The comment is not viewable until it has been approved by either the site administrator or through the email sent to the comment author. In the future the author can log in to post without needing any moderation. This scheme should eliminate the majority of comment spam which is produced by people using non-legitimate email addresses. However, anonymity is sacrificed. I’m not sure if I prefer it to reCAPTCHA—that will take some thought.

Annoyances

There are a couple of design decisions that bother me a little bit, like the lack of admin control over comments and how subscriptions are handled, but these are pretty minor.

I worry about having problems with my data during upgrade, but the author is working on South integration so I’m hoping that is addressed soon.

The Byteflow.su project server responds to me only intermittently, but I’m starting to suspect it’s DNS related and might be on my end.

I’m not sure I understand the authentication system. The default template has some buttons related to authentication that mystify me (“Close”?). But it appears to be working okay.

On the whole, I have very few annoyances with Byteflow. The only big one I had (not being able to store themes outside of the byteflow root), was quickly addressed when they incorporated my patch.

Conclusion

As usual, the migration took longer than I expected, but it was less than two days of work (including research into Byteflow, documentation work, contributing changes back, playing with the CSS of my theme, and importing data). Manually importing and formatting posts took half of a long day. A clean setup without all the additional activities would take just a couple of hours.

I like how the Byteflow authors run their project. The pace of development has slowed recently because piranha is happy with the current feature set and has largely moved on to other projects. However Byteflow is not abandoned; piranha still uses it as his primary blogging platform. Since he is readily available on IRC and active on the mailing list, it is easy to discuss the architecture with him and make contributions. I am betting that I’ll be happy with Byteflow for a long time to come.

[ Read More | 3 comments | 1 pingback | , , , , , ]

Django-cms: Not Too Shabby

Summary: Herein the author finds that Django-cms is a pretty decent content management system.

I’ve finally gone live with the site for my new initiative: coopercate.org. As part of my effort to research the Django ecosystem, I decided to give a pre-packed CMS a try. There were two contenders: django-cms and Ella. Though Ella looked good, it appeared to be less mature than django-cms. So my efforts stayed focused on deploying django-cms and I never needed to fall back to Ella. It looks like Django-cms is going to meet my needs.

Which version?

There are two branches in the django-cms repository: trunk and cms2. It looks like cms2 is getting regularly merged in the trunk as features mature. At the time of my deployment there was a note in the wiki stating that django-cms is not compatible with the latest Django releases (which I needed for a different project), so I used the older r41 version that is downloadable from a link on the top-right corner of the home page.

It should be understood that r41 is fairly old—it is the original release from September of 2008. A lot of development has occurred since then which can be viewed on their demo site. I plan to install the newer version as soon as Django compatibility has been restored.

Installation

The installation instructions were sufficient to get django-cms up and running. Now that django-cms is successfully deployed, I want to document a couple of gotchas.

Prerequisites

Two prerequisites are listed: django-tinymce and django-filebrowser. Both prerequisites are optional, and in fact I only have them partially working as of now. They add some niceness, especially when building a site for a non-technical client, but they are not essential for the CMS to function.

django-tinymce depends on the TinyMCE javascript widget that is available as part of most Linux distributions. I didn’t like the layout of the Debian package however, so I downloaded version 3.2.1.1 from the project site. I then downloaded django-tinymce 1.5 and followed the instructions. I must not have put everything in the right places, however, because the WYSIWYG editor isn’t appearing for me. I’ll look into it more later.

I got django-filebrowser from SVN. Following the instructions resulted in what looks like a working link on the admin web site, but I haven’t tested the functionality much yet.

Configuration

I symlinked cms_global_settings.py and cms_settings.py into my project directory so that I could just override the variables I cared about in settings.py. I turned off LANGUAGE_REDIRECT and USE_I18N for my site. It is also important to make sure to have the DEFAULT_TEMPLATE set correctly. It appears to be relative from my project templates directory.

Base Template

The only step left was to copy cms/templates/base.html into my project’s templates folder and customize it. Now I have a functioning site.

Confusions

There are two areas where I find django-cms’s interface to be rather confusing.

  • I don’t understand their distinction between a page and the content on the page. Each page can have multiple “contents”, but only the most recent one shows up on the live site. I am probably exposing my ignorance about content management systems in general.
  • I don’t see an easy way of making django-cms display a list of all child pages on a specific page. Third-tier pages do not show up on the site navigation, so the only way I see to link to them is by manually maintaining a menu.

Impressions

Django-cms appears to have a decent user community and active development. Deployment wasn’t as easy as a PHP CMS, but it was easy by Django community standards. Though django-cms has seen a lot of activity recently, the older version I deployed is very functional and has had few quirks once I got it set up correctly. On the whole, I like it.

[ Read More | 0 comments | 0 pingbacks | , , , , ]

Why is cron not running my script?

Summary: Cron doesn’t run files with dots or underscores in them; remove that .sh!

Did you put your file in /etc/cron.daily or /etc/cron.weekly and it doesn’t run? Does cron just skip right over your file? Check that you don’t have a period or underscore in your filename. I’m talking about the .sh or .py you always put on your scripts. Yup, take that away.

All good now? I thought so.

It seems like I learn this lesson again every couple of years. This time I’m writing it down.

Update: A little additional research says that it isn’t cron; it’s run-parts that’s causing the problem. See the comments for details.

[ Read More | 2 comments | 0 pingbacks | , , , ]

Learning Banjo

Summary: Herein the author discusses his selected blogging engine.

The Old Blog

I started blogging with a plain HTML file. I would simply append new entries to the top. The motivation was to have a place to record technical solutions that I repeatedly had to look up. The setup was functional, but didn’t look very sophisticated. It stopped being practical when I wanted to categorize entries on different topics.

I decided to upgrade a couple of years ago. I was learning python and figured that while I was at it I would brush up on my CSS+HTML skills. I chose PyBlosxom because I could actually understand the CGI script, and I created a layout with floats and divs. It worked pretty well, but due to a busy job schedule and switching hosting providers, I didn’t keep it up.

I really like PyBlosxom. It is ideal in its simplicity. It’s clear to deploy, the templates are easy to configure, and (best of all) the content is just ASCII text files in a directory. The categories come from the directory name, and the posting timestamp comes from the file name. This makes the blog very archive-able. Being able to access my data in twenty years is important if I’m going to invest any time and energy into creating it (thank goodness for the Internet Archive).

Unfortunately, PyBlosxom didn’t provide a lot of the niceties of a modern blogging platform. As my wife started using Blogger, I became envious of things like pingback support, feed subscriptions, and open-id authentication. I decided it was time to move on.

Discovering Django

I have played with a few web frameworks since learning Python. I’ve been searching for something as accessible as PHP, but better designed. I really like Spyce. It is well thought out, and I became a better engineer by tinkering with the framework. Unfortunately it doesn’t have much of a following. I missed the extensive documentation, libraries, and community I enjoyed as a young PHP coder. The enormous mindshare of PHP does bring some value.

Last year I discovered Django, and I’m hooked. It works the way I think. It is still pretty young, but it has a lot of momentum and I’m optimistic that it is maturing well. In my opinion, it is very successful at bringing the beauty of python to web application development.

Unfortunately, Django applications are very immature. Though initiatives have begun, there is not yet a central registry with ratings where good applications and plugins can gain mindshare and following. The Django community hasn’t yet developed habits like releasing code, preserving interfaces, and working off of stable versions. Though Django makes it very easy to build any application I might need, maintaining all of the nuts and bolts of my application makes it hard to compete with the PHP administrator who configures a couple of Drupal plugins and calls the site done. Most users won’t notice the difference in quality.

This realization led me to reexamine Drupal. I gave it a fair shot. Drupal does its job well, but it just isn’t elegant enough—it still feels like a PHP application. My python experience has made me finicky. Doggonit, I want a Django blogging application.

Bruce Kroeze says it well in his [blog post from 2007](http://coderseye.com/2007/banjo-blog-nearing-01-release.html]:

Blogs look simple, and stripped of everything else, they really are simple. Basically they are just reverse chronological posting of text on a page. No biggie, at least at first or second glance.

But the trick is in the phrase ‘stripped of everything else.’ Once you start considering the features commonly available in blog apps, it gets quite a bit more complex…”

The same can be said for a CMS, a shopping cart, or a photo gallery.

Getting Banjo

In the quoted blog post, Bruce Kroeze proceeds to describe Banjo: “the Django blogging application with bells and whistles”. Though immature when compared with some of the PHP blogging applications, Banjo has an impressive feature list. And being based on Django means that it should have a straightforward templating system and clean hooks for customization (this is where Drupal gave me a huge headache). It appears to be the only attempt at building a Django blog that has developed a proto–community. After mulling it over a number of months, I decided it was time to get my blog back online and give Banjo a test-drive.

Oh, The Agony

Deploying Banjo is not easy. The website is really a bunch of stub pages, and the mailing list is pretty quiet (I’ll have to save my rant about why Google Groups is awful for another post). What follows isn’t really a howto, but more of a map of the gotchas I dealt with in deploying Banjo.

I started by doing an hg clone http://hg.assembla.com/banjo and then followed the instructions here. Those instructions aren’t too bad—but the list of dependencies to install is daunting. High on the list is Satchmo—a Django shopping cart solution. It does seem odd for a blog to depend on a shopping cart, but Bruce Kroeze is a principle author of both applications and wanted to leverage some of the Satchmo libraries. Most of Satchmo is unnecessary—I’ll provide the details later. Unfortunately, Satchmo has its own daunting list of dependencies that must be installed. The dependencies are frustrating for a few reasons:

  • Some of the projects depended on by Banjo and Satchmo appear to be abandoned.
  • Some of the projects are disorganized, making it unclear which of the project source repositories is the most recent and compatible with Banjo.
  • Some of the projects depended on by Banjo and Satchmo are under active development, but Banjo hasn’t seen any commits in a while, which makes me nervous that there will be breakage.
  • I have to monitor all of these dependencies for security patches, instead of letting the Banjo community or my distribution security team do it for me.
  • It’s simply a lot of installs (16 outside of my package management system), and when you include the source histories for all of these projects it becomes a chunk of disk space (129M for a blog!).
  • Banjo usually depends on the unreleased source tips, instead of a specific released version. Making for a lot of moving developer targets.
  • Not all of the dependencies are listed on the install instructions for Banjo or Satchmo.

The list of dependencies provided here is complete as of the day of this blog post. When it was necessary to check out source tips, I found that Banjo worked with the sources as checked out in early February 2009.

A note on installing python packages: As a general rule, I don’t use Python’s setup.py functionality to install packages, nor do I use methods that call setup.py such as easy_install and pip. Python’s distutils has two major problems:

  • there is no clean uninstallation,
  • it mixes manually maintained packages with ones that the package manager will track for me.

Instead, I copy the uncompressed files into a common directory and add that directory to my sys.path at the top of my Django settings.py. Sometimes it helps to check the Python Package Index (pypi.python.org) to find the latest released version. Occasionally it is necessary to run setup.py build and copy the files out of the build directory.

My prerequisites:

  • Debian Lenny
  • PostgreSQL
  • Python 2.5
  • python-psycopg2
  • Apache
  • mod_python
  • memcached

I also had django-1.0 installed and running when I started setting up Banjo.

Dependencies:

  • python-yaml from aptitude.
  • python-simplejson from aptitude. I didn’t see this listed on the Banjo or Satchmo docs.
  • python-imaging from aptitude.
  • Django (svn tip just after version 1.1 alpha—Banjo doesn’t work with version 1.0). I wish Banjo stuck with the released version.
  • django-registration (version 0.7 from pypi). This project is under active development.
  • iso8601 (version 0.1.4 from pypi). This project appears mature but not active.
  • typogrify (v 1.0). I didn’t see this requirement listed in the docs.
  • sorl-thumbnail (svn tip). This project appears mature and maintained, though they don’t ever bundle their releases for download.
  • django-template-utils (release 0.4p2 would probably work, but I used svn trunk because the one additional change looked safe). This project looks mature, but not very active. The Banjo installation instructions need to be updated to reflect this dependency.
  • django-evolution (svn checkout). This is an active project.
  • django-extensions (svn tip). This is an active project with a large community. It must be called “extensions” for Banjo to import it.
  • django-atompub (svn checkout). The project doesn’t look active.
  • django-xmlrpc (bzr trunk—version 0.1 doesn’t work). Don’t be deceived by the link to Google Code as the project’s home page (the Google Code svn source doesn’t work); Launchpad is the right place. The Banjo instructions need to be updated as well. This project doesn’t look actively maintained, especially since the source requires a trivial edit to atom.py (add an import re) to import. A patch was reported six months ago and hasn’t been applied.
  • django-app-plugins (svn trunk). Project appears active, but has some trivial problems like missing a license notice (I just submitted the issue). The website says it’s released under the MIT license.
  • django-threaded-multihost (version 1.3-0 downloaded from www.assembla.com/spaces/threaded_multihost/ documents). This project doesn’t look used outside of Banjo and Satchmo—not much of a community. But it appears to work well. One note: the released tar.gz does not contain the license and docs that are in the hg repo.
  • django-site-skins (hg trunk). This was recently spun off of Banjo and Satchmo, and isn’t listed as a dependency in the docs.
  • django-admin-plugins (hg clone of tip at http://hg.assembla.com/adminplugins). This is another Banjo/Satchmo library.
  • Satchmo (release 0.8.1 might work because Banjo hasn’t changed much since then, but I downloaded the svn trunk). This is a Django shopping cart with a good community. However, Banjo only needs a couple of the Satchmo libraries.
  • Banjo (hg checkout of http://hg.assembla.com/banjo. I didn’t try the 0.9-1 release downloadable from assembla).

I only had to make sure that a couple of Satchmo modules were in my python system path. I got them there by symlinking them into the common directory which I appended to sys.path. The source doesn’t appear to import anything else from Satchmo, so deleting the rest should be possible.

Satchmo modules:

  • keyedcache
  • livesettings
  • satchmo_utils

After all this, I am finally able to start configuring Banjo!

Configuration

  • I uncommented django_evolution from banjo/__init__.py
  • When debugging, it is really helpful to comment out django_xmlrpc from banjo/__init__.py, and replace the line from banjo.blog.syndication import XMLRPC_METHODS in settings.py with XMLRPC_METHODS = None to eliminate a class of spurious error messages.
  • The default skin relies on an out-of-date version of yui from Yahoo APIs. If you want to use it you should change the link so that you get some CSS.

A couple things I did differently with my Banjo configuration: * I merged the Banjo settings.py with the one in my application so that none of my changes would be in the Banjo source. It was pretty straightforward. * I added this rule at the end of my urls.py so that all URLs I hadn’t already dealt with go to Banjo:
(r’^’, include(‘banjo.urls’)), * I then created my own skin using the Banjo base_root template as a starting point.

Skins

The docs on creating a skin are non-existent. Here are the steps I posted to the mailing list:

  1. I copied banjo/blog/templates/skins/default into myapp/templates/ skins/myskin
  2. I edited myapp/ templates/skins/myskin/CONFIG.json to have a different name.
  3. I added myapp/templates/skins to the SKIN_DIRS list in settings.py.
  4. I went into the admin interface and selected my skin.
  5. I then excised all the stuff that didn’t apply to my site and eliminated a couple of layers in the template inheritance hierarchy.

I found I couldn’t make all of the customizations I wanted in the skin, so I did have to edit a couple Banjo templates (_post_excerpt.html and view_post.html). I’m hoping to figure out a cleaner way in the future.

As you can see, I did eventually get everything working. It was less work than building from scratch such features as comment moderation, feed subscription, integrated search, scheduled post submission, caching, etc. And it’s higher quality as the Banjo developers included utilities I didn’t know about like Textile format and typogrify

Suggestions for Improvement

However, this process could be easier. Here are my suggestions for making Banjo more maintainable and more accessible to future users:

  • There should be a bias towards using released versions of projects. This makes it easier to install a version that works, and it makes it easier to monitor the libraries for security updates.
  • If a dependency project doesn’t have an active community, Banjo should consider folding that code into the Banjo core.
  • Even if a dependency project does have an active community, if it isn’t likely to get distributed by an OS package manager, Banjo should consider including the project with the banjo source in a libs subdirectory.
  • The maintainers should consider putting all the various Banjo and Satchmo libraries into a single package. In addition to making this easier to find and install, it also makes it easier to maintain. Currently they are scattered across various source repositories, issue trackers, and project home pages. This fragments an already small community.
  • The necessary Satchmo libraries should be factored out of Satchmo and put into the shared libraries package as soon as possible—it will only get harder with time. Banjo shouldn’t require the installation of a full blown shopping cart, and the Satchmo users will benefit from the larger community using their libraries. Satchmo and Banjo can then select which version of the libraries to depend on for each release, which will simplify both projects.
  • The project documentation can be improved with some of the information from this blog post.
  • Though the multi–site capabilities are excellent, I think the defaults can be improved so that it doesn’t get in the way of a simple single-site deployment. It doesn’t currently prevent single site deployment, but it makes it harder than it needs to be.

Conclusion

I think Banjo is pretty slick, and I hope to be able to contribute to the project. It has the potential of becoming a full featured, easy to install and yet easy to modify, blogging platform. I’m also glad I discovered Banjo because it introduced me to Satchmo, which looks like a mature Django shopping cart application which will likely come in handy some day.

My next project is going to involve testing django-cms to see if I should add it to my my web developer toolbox.

Blog, shopping cart, CMS—Django is quickly getting to where it can fulfill most of my client’s needs.

[ Read More | 2 comments | 0 pingbacks | , , , , , ]

Email: Password:
OpenID URL:
Forgot Login? Close