2011-10-25

Installing Hatta on Windows

I’ve been trying to find a replacement for a SharePoint 2007 wiki that was foisted on my team. If you’ve ever used SharePoint’s standard wiki system, you’ll know that it’s just a cruddy wiki-like front-end for a ropey CMS. Browsers other than IE have the WYSIWYG editor disabled and the user is left to edit raw HTML. Wiki markup? What’s that?

I’ve got a number of requirements for the replacement.

Must be cross-platform

As I find myself developing in both C# and Objective-C, I need a wiki for half a dozen trusted users that works in Windows and on the Mac.

Must use a standard wiki markup

I’d prefer Markdown or Creole. As long as I’m not forced to drop into HTML or use a WYSIWYG interface I’ll be reasonably happy.

Must be easy to set up

Preferably I just want to run an installer and have the wiki running. Every dependency I need to install and set up - web server, database server, scripting language - is a mark against it.

Must be simple

I neither need nor want authentication systems, online help, sandboxes, advanced formatting, styles, drawing APIs or file uploading. Just a way to store short, linked text documents.

Must use a DVCS as its storage system

If the wiki stores its data in a DVCS I can clone it and take it home with me.

What I really want, I realised, is an open-source version of BitBucket’s wiki. I’ve looked at dozens of systems. The most promising are MoinMoin version 2, which unfortunately isn’t finished yet, and Hatta.

Hatta is a fantastic little wiki. Its features include:

  • Cross-platform (written in Python)
  • Simple but attractive interface
  • Mercurial storage system
  • Creole syntax (for the most part)
  • Built-in web server

It comes in two forms. You can download it as a pre-compiled binary, with all dependencies included, for OSX and Windows. Alternatively, you can download it as a pure Python solution, though this entails setting everything up yourself.

I started out with the binary distribution, which was very easy to get up and running, but I quickly ran into problems. The binaries are now 4 minor revisions out of date, and according to the author the chances of them being updated are slim to none. Worse, the binary regularly freezes up. That’s no use as a centralised wiki.

Trying to get the plain old Python version working in Windows is a pain as there’s no documentation for it, so here’s how to do it.

Installing Hatta in Windows

Firstly, we need to get Python set up and install Hatta’s dependencies.

  • Download Python 2.7.2 from python.org. Hatta will not (currently) work with Python 3.
  • Install Python using all of the default settings (just keep hitting “Next”).
  • Download “setuptools” from pypi.python.org. Assuming you’re using a 64-bit version of Windows you’ll need to download the “ez_setup.py” script and run it like this:
C:\Python27\python.exe .\ez_setup.py
  • Open up a command line as admin and enter the following:
cd C:\Python27\Scripts
.\easy_install-2.7.exe werkzeug
.\easy_install-2.7.exe pygments

That’s Python installed and two Python packages that Hatta is dependent on. Next we’ll need to download Hatta itself and integrate it with Mercurial.

  • Download Hatta from hatta-wiki.org. You’ll need the zipped version.
  • Unzip Hatta to C:. This should give you the following paths:
C:\Hatta\doc
C:\Hatta\examples
C:\Hatta\locale

Etc. You don’t have to put Hatta in the root of C: but it simplifies this guide.

  • Download the Mercurial source code from mercurial.selenic.com. The binary builds are of no use to us.
  • Extract the tarball.
  • Open the extracted directory and locate the “mercurial” folder.
  • Copy the “mercurial” folder to C:\Hatta\ (giving you the folder C:\Hatta\mercurial\hgweb etc).
  • Copy the “hgext” folder to C:\Hatta
  • Open the “mercurial” folder in C:\Hatta.
  • Open the “pure” folder.
  • Copy the contents of “pure” into the “mercurial” folder (giving you C:\Hatta\mercurial\bdiff.py etc).

We’re done! What we’ve done is copy the parts of Mercurial required by Hatta into the Hatta directory. Yes, this is an ugly hack, but it’s the easiest way of getting Hatta up and running. When new versions of Mercurial get released, you’ll need to delete the “mercurial” and “hgext” folders and upgrade them with the latest source (remembering to fiddle about with the “pure” folder).

You can now test the installation by opening a command line and typing:

C:\Python27\python.exe C:\Hatta\hatta.py

Point your web browser at http://localhost:8080 and, if everything has gone to plan, you’ll see the Hatta editor page.