Gollum, "a simple wiki system built on top of Git", is the system Github uses to provide a wiki along with every code repository. The data storage for a Gollum wiki is just text files formatted in one of the various supported markups styles (Markdown, AsciiDoc, Org-mode etc.) in an ordinary Git repository.

So, Gollum is really beautifully simple and elegant and easy to set up. Still I had to overcome a few minor obstacles to get it to run the way I wanted it to. That is, as a service in user space that always runs when I'm logged in. How to generally set up Gollum as a service is explained in the Gollum wiki.

Here are the specific steps I performed on my system, starting with Ruby and Git already installed.

  • Create a new Git repository:
    • $ mkdir -p /path/to/your/repo
    • $ cd /path/to/your/repo
    • $ git init
  • Install Gollum to ~/.gem/ via $ gem install gollum.
  • Add PATH="$(ruby -e 'print Gem.user_dir')/bin:$PATH" to your .bashrc as explained in the Arch Wiki. This step is not really needed to run the service but it is handy for starting Gollum manually for testing purposes and probably generally a good idea if you are using Ruby gems at all.
  • Create the user service at ~/.config/systemd/user/gollum.service with the content shown below. Contrary to the the example given in the Gollum wiki, I had to set WantedBy to default.target instead of multi-user.target.
  • I ran # loginctl enable-linger username, as proposed in the Arch wiki, but I don't know if that's really necessary.
  • You can provide a favicon.ico to be used by the browser. Put it in one these locations (I couldn't figure out which, so I put it in both and it worked...):
    • /home/moritz/.gem/ruby/2.3.0/gems/gollum-4.0.1/lib/gollum/public
    • /home/moritz/.gem/ruby/2.3.0/gems/gollum-4.0.1/lib/gollum/public/gollum
  • Enable the service via $ systemctl --user enable gollum.service.
  • Now, when booting your system and logging in, there should be a Gollum instance running and serving a Gollum wiki to http://localhost:4567.

Here's the content of my systemd service file gollum.service:

[Unit]
Description=Gollum wiki server
After=network.target

[Service]
Type=simple
User=%i
ExecStart=/home/moritz/.gem/ruby/2.3.0/bin/gollum --show-all --live-preview --allow-uploads dir --h1-title "/path/to/your/repo"
Restart=on-abort

[Install]
WantedBy=default.target

The switches used with the executable are optional. The Gollum README explains what they do.

Oh, and changing the web pages generated by Gollum is also really easy. Just edit the files in /home/moritz/.gem/ruby/2.3.0/gems/gollum-4.0.1/lib/gollum/templates.