Software
Website Portfolio
Resume
Wiki
Blog
Contact

Archives

  • October 2010
  • June 2010
  • December 2008
  • February 2008
  • March 2007
  • December 2006
  • November 2006
  • September 2006

Meta

  • Log in

Installing MindTouch Deki WIki on Mac OSX Snow Leopard (10.6)

Posted on June 7th, 2010

I run mindtouch as my wiki software. It’s been a great piece of software, and I will continue running it until I can find something better. Recently, I’ve been working to overhaul all the bsd.bz sites, and bring them under one umbrella (same theme, unified header). In an effort to better develop changes to the wiki’s theme, I need to run that software locally on my dev machine (my macbook pro).

So, without further delay, this is how I got MindTouch Core v.9.12.2 installed under Snow Leopard (OSX 10.6).

This tutorial assumes you already have PHP & Apache working.

First, we’ll need to install some pre-requisite software. I’ve included direct links the the current versions of the software for your convenience. I make no guarantee these links will work in the future, but have included links to the respective download location.

Mac Ports (Currently 1.8.2) – [ Direct DL ]
MySQL (Currently 5.1.47) – [ Direct DL (Intel x86_64) ]
Mono (Currently 2.6.4) – [ Direct DL (Intel) ]

Update your hosts file.
I use wiki.localdomain so I can add other name based virtual hosts and have my mini-production replica on my dev machine. ie blog.localdomain, wiki.localdomain, etc
Open up /etc/hosts in your favorite editor (I use vi)

$ sudo vi /etc/hosts

Add this line:

127.0.0.1 wiki.localdomain

Next, we’ll need to install the pre-requisites required to run Mindtouch, and html2ps

$ sudo port selfupdate
$ sudo port sync 
$ sudo port install ImageMagick
$ sudo port install clucene
$ sudo port install p5-libwww-perl 
$ sudo port install texlive
$ sudo port install netpbm 
$ sudo port install wget

Now, we have enough to install html2ps. Run the installer, and choose “/opt/local” for the install path:

$ cd ~/Downloads
$ wget http://user.it.uu.se/~jan/html2ps-1.0b5.tar.gz
$ tar -xzf  html2ps-1.0b5.tar.gz
$ cd html2ps-1.0b5
$ sudo ./install

Next, download and install Mindtouch:

$ cd ~/Downloads
$ wget http://s3.amazonaws.com/mindtouch/MindTouch_Core_9.12.2_Source.tar.gz
$ tar xfvz MindTouch_Core_9.12.2_Source.tar.gz
$ cd MindTouch_Core_9.12.2_Source
$ mkdir ~/Sites/wiki.localdomain
$ cp -r web/*  ~/Sites/wiki.localdomain/
$ chmod a+w ~/Sites/wiki.localdomain/config/

Now, add a virtualhost to httpd.conf or an included vhosts config:

<VirtualHost *:80>
	ServerName wiki.localdomain
	DocumentRoot "/Users/YOUR-USERNAME-HERE/Sites/wiki.localdomain"
 
	RewriteEngine On
	RewriteCond %{REQUEST_URI} ^/$
	RewriteRule ^/$ /index.php?title= [L,NE]
	RewriteCond %{REQUEST_URI} ^/@gui/[^.]+$
	RewriteRule ^/@gui/(.*)$ /proxy.php?path=$1 [L,QSA,NE]
	RewriteCond %{REQUEST_URI} !^/(@api|editor|skins|config|@gui)/
	RewriteCond %{REQUEST_URI} !^/index\.php
	RewriteCond %{REQUEST_URI} !^/favicon\.ico$
	RewriteCond %{REQUEST_URI} !^/robots\.txt$
	RewriteCond %{QUERY_STRING} ^$ [OR] %{REQUEST_URI} ^/Special:Search
	RewriteRule ^/(.*)$ /index.php?title=$1 [L,QSA,NE]
 
	# deki-api uses encoded slashes in query parameters so AllowEncodedSlashes must be On
	AllowEncodedSlashes On  
	<Proxy *>
	    AddDefaultCharset off
	    Order deny,allow
	    Deny from all
	    Allow from all
	</Proxy>
 
	# mod_proxy rules
	ProxyPass /@api http://localhost:8081 retry=1
	ProxyPassReverse /@api http://localhost:8081
	SetEnv force-proxy-request-1.0 1
	SetEnv proxy-nokeepalive 1
 
 
	## Logging ##
	# Possible values: debug, info, notice, warn, error, crit, alert, emerg
	LogLevel error
	CustomLog "/var/log/apache2/wiki.access.log" combined
	ErrorLog  "/var/log/apache2/wiki.error.log"
</VirtualHost>

I encountered an error at this point when I tried to visit the website. I assume this is a string parsing bug.

Error: MySQL enabled, but client version is too old: mysqlnd 5.0.7-dev - 091210 - $Revision: 294543 $. We require at least version 5.0.0 of the PHP MySQL client.

The “fix” was a bit more heavy handed than I normally prefer, but it works.
Open up the file ~/Sites/wiki.localdomain/maintenance/install-utils.inc and comment out the MySQL check.
Mine was at lines 43-48.

/*
$client_ver = mysql_get_client_info();
if ( !version_compare($client_ver, REQUIRED_MYSQL_VERSION, ">="))
{
        echo_fail(wfMsg('Page.Install.check-mysqlc-fail', htmlspecialchars($client_ver), REQUIRED_MYSQL_VERSION));
        $return = false;
}
*/

After fixing the errors, visit http://wiki.localdomain and perform your initial setup.

Once setup is complete, you’ll need to locate your api key for use in next step:

$ cat /Users/YOUR-USERNAME/Sites/wiki.localdomain/LocalSettings.php |grep wgDekiApiKey|awk -F\" '{print $2}'

Next, edit /Library/LaunchDaemons/com.mindtouch.dekiwiki.plist and use this template:
(You’ll need to input your api key, and username into the template)

<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
            <key>Disabled</key>
            <false/>
            <key>KeepAlive</key>
            <true/>
            <key>Label</key>
            <string>com.mindtouch.dekiwiki.itasca</string>
            <key>ProgramArguments</key>
            <array>
                    <string>sudo</string>
                    <string>/usr/bin/mono</string>
                    <string>/User/YOUR-USERNAME/Sites/wiki.localdomain/bin/mindtouch.host.exe</string>
                    <string>apikey</string>
                    <string>ENTER-API-KEY</string>
                    <string>script</string>
                    <string>/etc/dekiwiki/mindtouch.deki.startup.xml</string>
                    <string>path-prefix</string>
                    <string>@api</string>
                    <string>http-port</string>
                    <string>8081</string>
                    <string>ip</string>
                    <string>localhost</string>
                    <string>notty</string>
                    <string>connect-limit</string>
                    <string>-5</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
    </dict>
    </plist>

Start the dekihost service on computer start.

$ sudo launchctl load /Library/LaunchDaemons/com.mindtouch.dekiwiki.plist

That’s it!
You should be up and running now.

Site content and design copyright 2005-2010 bsd.bz