About Main |

Byteflow on Ubuntu 9.10 Karmic Koala

I decided to see what Byteflow brings to the world of blogging. I borrowed heavily from a bunch of installation guides, specifically these:

But I found each frustratingly islandy (if that’s a word) in terms of source retrieval — django is a package maintained by the ubuntu community, why download it from source? I liked Richard Esplins’ explanation of byteflow installation that took the step of creating a centralized repository for the base code, but I don’t particularly like the idea of modifying the settings.py file explicitly labelled “DO NOT MODIFY.”

After several hours of playing around with but ultimately abandoning the idea of setting up byteflow in /usr/lib/pymodules/python2.6/contrib/byteflow and trying to symlink to a virtual host folder, I couldn’t get around the complication of splitting the native byteflow source files from the user-customized files without altering the sources. I decided to use nested mercurial repositories to solve the “their code/my code” segregation problem. I finally got it running on Ubuntu 9.10 Karmic Koala in a way I’m comfortable with; here is my deployment process:

Dependencies: I already had apache, mysql, mod-wsgi, and mercurial on this machine to support other sites, but I had to apt-get install the following packages for byteflow:

python-mysqldb
python-beautifulsoup
python-django
python-django-doc
python-egenix-mxtools
python-egenix-mxdatetime
python-openid
libtidy-0.99-0
python-chardet
python-feedparser
python-utidylib

Files and Folders: I keep website files in my mercurial code library along with other projects.

I went to my library, initialized a new project folder for blog with hg init blog, then created the following subfolders to the newly-created directory blog:

blog/cgi-bin
blog/public
blog/public/download
blog/public/media

I stuck a quick index.html in blog/public/. I added an empty shell script called load.sh and an empty python script called settings_local.py in blog/cgi-bin/. I loaded a few background images I was considering in blog/public/media. I then added each file with hg add and committed them to the mercurial repository in my code library with hg commit and then popped them over to the library with hg push.

I went to my vhosts location and cloned the repository I just created with sudo hg clone /hg/repos/web/blog.

That work completed, I then brought byteflow into the mix: In cgi-bin I ran sudo hg clone http://hg.piranha.org.ua/byteflow.

By the way, I love mercurial. I’ve now got a cloned repository (byteflow) within a second cloned repository (blog). If I want to pull an update from byteflow’s central repository, I can do that by going to blog/cgi-bin/byteflow/ and calling hg pull. If I want to push my own files to my personal repository, I go to blog/ and run hg push. The two repositories are intermixed, but mercurial keeps them organized separately. As the folks over at Selenic like to say, it “just works.”

cgi-bin/ files:

blog/cgi-bin/load.sh (this is admittedly quick-and-dirty and full of poorest-practices):

#!/bin/bash

sudo cp settings_local.py byteflow/
sudo byteflow/manage.py syncdb
sudo /etc/init.d/apache2 reload

blog/cgi-bin/settings_local.py (I stripped all the extraneous stuff from the templated file):

# -*- mode: python; coding: utf-8; -*-

DATABASE_ENGINE = 'mysql'
DATABASE_NAME = 'database'
DATABASE_USER = 'user'
DATABASE_PASSWORD = 'password'

TAGLINE = u'tagline'
FOOTER = u'footer'
DEFAULT_FROM_EMAIL = 'sender <email@domain.tld>'
ADMINS = (('Admin', 'email@domain.tld'), )

BLOG_URLCONF_ROOT = ''

STATIC_PAGES = (
    ('About', '/about/', u'About'),
    ('Main', '/', u'Main'),
    ('', '', u''),
    )

THEME = 'default'

MAINTENANCE_MODE = False

MySQL: I created an empty mysql database with a username (@localhost) and password permissioned to it that match those which I entered into the settings_local.py file described above.

Apache: I created a virtual host conf file called /etc/apache2/sites-available/blog with the following content:

<VirtualHost *:80>
    ServerName lukepeterson.com
    ServerAdmin admin@domain.tld

    ServerAlias http://www.lukepeterson.com
    ServerAlias http://blog.lukepeterson.com

    Alias   /media/ /<vhost root>/blog/public/media/
    Alias   /download/  /<vhost root>/blog/public/download/

    Alias   /admin-media/   /usr/lib/pymodules/python2.6/django/contrib/admin/media/
    Alias   /static/    /<vhost root>/blog/cgi-bin/byteflow/static/

    WSGIDaemonProcess lukepeterson.com maximum-requests=1000
    WSGIScriptAlias / /<vhost root>/blog/cgi-bin/byteflow/django.wsgi

    ErrorLog /var/log/apache2/blog-error_log
    CustomLog /var/log/apache2/blog-access_log combined

</VirtualHost>

…and ran sudo a2ensite blog in order to link this to /etc/apache2/sites-enabled.

So with that, I’ve got a working MySQL database, an Apache server serving up a virtual host via a WSGI script that just needs to be initialized (configured as a daemon that reloads itself with every 1000 requests so as not to crash my server).

I go to blog/cgi-bin, make load.sh executable with sudo chmod a+x load.sh and then finally run sudo ./load.sh to set everything up with byteflow and kick over apache.

Now I’ve got a basic byteflow installation up-and-running. Tuning ahead.

Add post to: Delicious Reddit Slashdot Digg Technorati Google
(already: 2) Comment post

Pingbacks

8.02.2010 21:57 LukePeterson.com: Byteflow Comments Require Django Email Values @lukepeterson.com
ers attempting to create new accounts on my system in order to post comments. If you followed my Byteflow installation write-up, you’re going to want to add a few extra lines to the settings_local.py file in order to get your stuff all up-and-running:

Comments

1.02.2010 5:42 Richard Esplin

I’m glad you got it up and running. Which theme are you using? It looks good.

The Byteflow maintainer is very open to contributions. I would suggest you patch the settings.py and remove the warning against modifying it. <grin>

Thanks for sharing your setup.

Richard

8.02.2010 22:01 Luke

Thanks!

Right now I’m just using the default template. I’m looking forward to a free weekend to do a bit of templating+CSS magic, and possibly updating the ancient version of Blueprint that Byteflow is packaged with.

It’s a really enjoyable platform so far, I’m still kicking out the bugs, though.

What would my blog be if not a work-in-progress?

Comment form for «Byteflow on Ubuntu 9.10 Karmic Koala»

Required. 30 chars of fewer.

Required.

Comment post