Sat, 01 Oct 05

Instiki-AR with sqlite3 on Windows XP

I’ve used Instiki quite a bit for storing what are essentially notes.

Although it’s been a true Rails app for a while, due to it’s use of Madeleine for object persistence, it required a couple of workarounds to host it using apache. Namely, run Instiki on WEBrick and then use mod_proxy in apache to forward requests for a given url to the webrick server.

Just a couple of days ago Alexey Verkhovsky (Instiki maintainer) announced that a beta version of Instiki (Instiki-AR) running on Active Record was available. This basically means that Instiki can now be run directly via apache using fast cgi, negating the need for mod_proxy and running in ‘production’ on WEBrick.

I downloaded the beta this morning and had a quick play. Initially I created a MySQL database and ran script/create_db to create the relevant tables in the database. Everything worked as expected, although I didn’t actually try to import any existing data.

I’ve read about sqlite quite a few times but have never got round to actually playing with it. As such, I spent a short time getting Instiki-AR to use sqlite as it’s backend.

First off, I installed the sqlite3 gem (sqlite3-ruby 1.1.0 (mswin32)).

$ gem install sqlite3

This was followed by downloading the sqlite dll and placing it in a directory in my path environment variable. This was all that was actually required.

I used script/create_db to create the database files and tables as with the mysql implementation and everything just worked.

Update 17:30

I’ve just played a little further and actually imported data from an existing instiki instance to the sqlite database.

First of all, I created a copy of my original instiki with the madeleine storage in the storage directory.

In the instiki-ar version I then ran the following (from Alexey’s original email) to output a sql script that will import all of my wiki content into the database.

$ ruby script\import_storage -i d:\instiki -t d:\instiki-ar\storage\2500 -o i.sql -d sqlite

I then downloaded the sqlite3 utility to administer sqlite databases. I placed this in a directory included in my path environment variable.

Start sqlite3 with the location of the production database as the argument.

$ sqlite3 db\prod.db

Execute the i.sql script to import all of the data to sqlite.

sqlite> .read i.sql
sqlite> .quit

That’s it. My original wiki content is now in the AR version and everything seems to work great.

Note To get instiki-ar from subversion.

$ svn export --revision 397 http://svn.instiki.org/instiki/branches/instiki-ar/