I just got done installing Python 2.5 and converting the trip planner code to use it instead of 2.4. The only required change was pointing the “dispatch” file at the 2.5 executable. No other changes to the code were required to make it run on 2.5.
A few little things also got cleaned up, and I updated to the latest versions of MySQLdb (1.2.2b3) and simplejson (1.5).
Hopefully nothing will blow up.
Previously, we were using a hacked together “content management system” (CMS) to maintain this site. We had integrated WordPress for blogging, but all the pages were stored in separate files. Keeping things updated was a pain in the ass.
In order to simplify things, we wanted to move the whole site and blog into a unified CMS. We tried Mephisto, and it’s pretty nice, but we didn’t want to be tied to using Ruby on Rails, which Mephisto is built on.
We can run WordPress almost anywhere, easily, and inexpensively. There’s also a ton of info for hacking WordPress on the Web. PHP is pretty weak compared to Python or Ruby, but that doesn’t really matter for this purpose.
The theme for the site is being developed by Wyatt and is available for download via Subversion (you might need to log in with username:password guest:guest):
svn co http://svn.bycycle.org/bycycle.org/wordpress/themes/byCycle/trunk byCycle
We may have introduced some broken links or other problems during this change. If you notice anything, please let us know.
Our hosting provider moved all our files to a new server–without letting us know before hand that they were going to do so. Most things kept working. A few did not, as you may have noticed.
The reason some things stopped working is, the new server is running a newer version of the operating system and some of the software the trip planner depends on[1] had to be recompiled [reinstalled from source code].
Though I think the upgrade is a good thing overall, I hope they let us know about it before they do it next time!
[1] The MySQL bindings for Python, in case you really wanted to know. I also updated Python from 2.4.3 to 2.4.4, but I don’t know if that was strictly necessary.
Today we went to Free Geek and picked up a Grant Box. It’s a pretty sweet computer, especially for the price ($0). We received the box through their hardware grant program. Here’s a little about Free Geek from their mission page:
“FREE GEEK is a 501(c)(3) not for profit community organization that recycles used technology to provide computers, education, internet access and job skills training to those in need in exchange for community service.”
The box came with Ubuntu GNU/Linux pre-installed, which is excellent because that’s what I’m running on my development box and on our new virtual private server (which now hosts our project tracker and soon will host a new version of the trip planner).
Our plan for the box is to use it for testing purposes (e.g., browser compatibility) and/or as a staging server before pushing new versions out to production.
Thanks, Free Geek!
Today we upgraded to WordPress 2.0.4. It’s a security release. Upgrading is easy: just copy the new directory over the old (being careful to save any customizations first, although if you created new directories for your custom themes, you won’t have to do anything).
We also moved from the old default theme, Kubrick, to a new version of it called K2. This version makes a lot of things easier, and it looks better out of the box. One day we might customize it.
Today I installed Trac. “Trac is an enhanced wiki and issue tracking system for software development projects.” We plan to use it to keep track of issues with the trip planner and any other software projects we might undertake.
Issues (AKA bugs) with the trip planner can now be reported at http://trac.bycycle.org/newticket. This is somewhat developer-oriented, but users can (and should!) use it too.
Also, since Trac contains a Wiki, anyone can contribute useful information about the trip planner, which might be documentation, tips and tricks, or anything else that’s relevant.
Here is the high-level outline of our Trac installation:
- Create a directory to contain Trac projects; each project will live in a subdirectory
- Create a subdomain at trac.bycycle.org for accessing Trac projects
- The files for this will live in the html subdirectory of the main Trac directory
- Each project will have a subdirectory in the html directory that contains a simple script to make the project accessible from the Web
Dependencies
- Subversion 1.3.2
- ClearSilver 0.10.3
- SQLite 3.3.6
- PySQLite 2.3.2 (Python bindings for SQLite)
Install Subversion
- First install BDB
- cd build_unix
- ../dist/configure –prefix=$HOME
- make && make install
- ./configure –prefix=$HOME –with-berkeley-db=$HOME
- make && make install
- cd subversion/bindings/swig/
- make swig-py
- make install-swig-py
- echo ~/lib/svn-python > ~/lib/python2.4/site-packages/subversion.pth
Install ClearSilver
- ./configure –prefix=$HOME –with-python=$HOME/bin/python –disable-ruby –disable-java –disable-perl –disable-csharp
- make && make install
Install SQLite
- ./configure –prefix=$HOME
- make && make install
Install PySQLite
For some reason, this was the hardest thing to install.
- Edit setup.cfg, changing the values of these variables as shown
- include_dirs=/home/u6/bycycle/include
- library_dirs=/home/u6/bycycle/lib
- python setup.py build
- py setup.py install
Install Trac
Set Up and Configure Trac
- Create a trac subdomain at trac.bycycle.org
- Create ~/bycycle.org/trac — projects will live here
- Create ~/bycycle.org/trac/html — each project will have a Web-accessible directory here
- Create a .htaccess file in ~/bycycle.org/trac/html that points all requests to any subdirectoy of trac.bycycle.org to the index.cgi bootstrap program in the subdirectory
Create a Trac Project Environment for the Trip Planner
- cd ~/bycycle.org/trac
- trac-admin ./tripplanner initenv
- Edit tripplanner/conf/trac.ini
- cd bycycle.org/trac/html/tripplanner
- cp ~/share/trac/cgi-bin/trac.cgi .
- Edit trac.cgi, adding these two lines at the very beginning of the try clause
- import os
- os.environ['TRAC_ENV'] = ‘/home/u6/bycycle/bycycle.org/trac/tripplanner’
- Create a simple c program, index.c, that puts LD_LIBRARY_PATH=/home/u6/bycycle/lib in the environment and then calls trac.cgi; compile it to index.cgi (Questions: why can’t we use Python instead? Why can’t we add that to os.environ in trac.cgi and get rid of index.cgi)
- Visit http://trac.bycycle.org/tripplanner/ and make sure it works
TODO
- Serve static files statically instead of via CGI
- Look into authentication if necessary
- Add content!
Installing WordPress is straightforward. Since we wanted an embedded blog for news on our front page, along with a standard blog in a subdirectory, we had to go through a few extra steps.
Here’s how to reproduce our setup:
Note: The following assumes Apache, PHP, and MySQL are already installed and configured (correctly), which means, amongst other things, Apache is configured to load the PHP module, there’s a database for the WordPress tables to be installed into, and there’s a MySQL user that can access those tables.
- Download WordPress 2.0.3 from http://wordpress.org/download/
- Decompress the downloaded file into the top-level HTML directory; this will create a new directory named wordpress
- Rename the wordpress directory to blog (not strictly necessary, but looks better)
- In the blog directory, copy wp-config-sample.php to wp-config.php
- Open wp-config.php in a text editor and follow the directions in the file (this just involves a few settings for MySQL)
- Navigate to http://byCycle.org/blog/wp-admin/install.php and follow the directions
- Assuming Apache, PHP, and MySQL are installed and configured and wp-config.php is correct, the blog is now installed and ready to use at http://byCycle.org/blog/ (Styling the blog to match the rest of the site is left as an exercise)
- To embed WordPress in the home page, first rename the home page to index.php (index.html => index.php)
- Add the following PHP to the top of index.php (before anything else):
<?php
$cat = 2;
$show_how_many_posts = 2;
require('./blog/wp-blog-header.php');
?>
- Determine where the news section will be, probably in something like <div id=”news”><!– News will go here –></div>
- Inside the news div, copy The WordPress Loop; The Loop can be copied from blog/wp-content/themes/default/index.php; it consists of all the stuff inside
<div class=”narrowcolumn” id=”content”></div> (but not the div tags)
- Modify The Loop; this isn’t strictly necessary, but to use the $cat and $show_how_many_posts variables from above, a few changes need to be made; (instead of pasting our version of the loop here,
here is the source; look for the section that starts with <!– Begin Embedded WordPress –>)
- And I think that’s all; let us know if it looks like we left anything out
I should mention that even though PHP is not my favorite language, I think WordPress is pretty cool, and hacking on it is fairly easy.