h1ghlevelb1ts

My precious wiki

Ever wanted a simple wiki, which you can edit on- or offline? A wiki which is easy to back up
and does versioning. And what's about some free hosting as well?

I am a big proponent of running a personal wiki to capture and organize thoughts. In case you don't agree, I recommend you read Any Hunt's "Pragmatic Thinking and Learning".

Self I have been running Tiki Wiki for a long time, but it is quite heavy weight, requires a database and constant upgrading. I was always looking for something more lightweight and now I found it - gollum. A lightweight racks app which works either via a webinterface or by simple text file editing on the file system.

Running gollum locally is as easy as:

$ gem install gollum
$ gollum

However, how can I host this without spending any money. One way might be Heroku, but I recently became a fan of RedHat's OpenShift. The Express version is free and offers a range of different hosting catridges, including a racks one. Let's see how easy it is to get your wiki hosted on OpenShift.

First you need to sign up for an account. Once that is done you install the command line tools for OpenShift Express via:

$ gem install rhc

Now let's create a domain and app for your wiki:

$ rhc-create-domain -n  -l 
$ rhc-create-app -a wiki -t rack-1.1 -l 

Once you ran this commands you should have a local git checkout in the directory wiki and a running application under http://wiki--rhcloud.com.

Next we need to install gollum. Let's change into the wiki directory. First open .openshift/action_hooks/build and just add the line

export 

Now commit this change and push the change to origin:

git commit -a -m "Adding 'export' in order to display environment settings"
git push origin master  

You will see that on top of the usual git commit messages there are several OpenShift things happening.The export command will be run after bundler and dump a whole bunch of settings.We will need some to complete the gollum configuration.Next create a Gemfile and add the following:

source 'http://rubygems.org'

gem 'rack', '1.1.0'
gem 'gollum' 

Then open config.ru and change to this (delete the current content):

require "rubygems"
Bundler.require(:default)

require "gollum/frontend/app"

use Rack::Auth::Basic, "My wiki - authenticate!" do |username, password|
  [username, password] == ['wiki', 'wiki']
end

Precious::App.set(:gollum_path, '')
Precious::App.set(:wiki_options, {})
run Precious::App

You need to replace with the actual path you see in the environment dump.
Currently it the line you are after looks like this:

remote: declare -x PWD="/var/lib/whatever/whatever/git/wiki.git"

/var/lib/whatever/whatever/git/wiki.git is the part you are after. As you can see I am using Rack::Auth::Basic for basic authentication, but you can plug something elsein if you like.Now lets lock the gems using bundler and also package them: 

bundle install
bundle package

Add everything to the repo, commit and push.
Enjoy your wiki,
Hardy

 

Old comments

2011-11-06Fredrik Rubensson
Sweet! (Ruby got lots of nice things!) I never felt I needed my own wiki. What do you put in it?
2011-11-09Hardy Ferentschik
Well, I keep a page for one liners or other work arounds. This way I can find things easily and once in a while there is enough material for a blog. Also other general blog/presentation ideas are kept in the wiki initially where they are refined until released into the wild :-)
2011-11-09Fredrik Rubensson
Sweet. Oneliners can be handy - I should do that too. The other stuff I keep in a basecamp project nowadays.
2013-02-06SweetyHeadvi
Howdy! I'm at work surfing around your blog from my new iphone 4! Just wanted to say I love reading your blog and look forward to all your posts! Keep up the fantastic work! http://google.cox
comments powered by Disqus