Setting up Gollum on Ubuntu

Introduction

Gollum is a Wiki-like engine that allows different kinds of formatting, mainly Markdown but also MediaWiki.

Quick Start (server/bare mode)

root

apt install -y ruby ruby-dev build-essential libicu-dev zlib1g-dev
gem install gollum rdiscount
#gollum-auth
which gollum
gollum -v #Gollum 4.1.4

user

cp /var/lib/gems/2.5.0/gems/gollum-4.1.4/config.rb config.rb.dist
mkdir repo.git
git init --bare repo.git/

vi repo.rb

wiki_options = {
  :live_preview => false,
  :allow_editing => false,
  :allow_uploads => false,
  :h1_title => true,
  :universal_toc => true
  :show_all => true
}

Precious::App.set(:wiki_options, wiki_options)

Precious::App.set(:environment, :production)

gollum --config gollum.rb --bare repo.git/

Privilege Separation

Unless you are already inside a container, create a dedicated user for running gollum,

which git-shell
groupadd -g 32765 gollum
useradd -u 32765 -m -g gollum -s /usr/bin/git-shell gollum
usermod -p '*' gollum

and eventually move the repo to some accessible place for remote usage (while keeping the user permissions),

mv /home/gollum/repo/ /

otherwise if you were a dirty bastard doing everything as root, you need to fix the perms

chown -R gollum:gollum /repo.git/

Shared UI User

Unless you go for Omniauth, setup the GIT profile that corresponds to the non-authenticated Gollum WUI: try to use some mailing-list address and shared name. You will be able to setup binding to some Directory Server afterwards anyway.

git config --global user.email "project@example.com"
git config --global user.name "ACME Project"

Ready & Testing

Enable it at boot time as user gollum,

vi /etc/rc.local

#!/bin/bash
echo Starting Gollum.
/usr/bin/chsh -s /bin/dash gollum
su - gollum -c "nohup gollum --config gollum.rb --bare repo.git/ > /home/gollum/repo.log 2>&1 &"
/usr/bin/chsh -s /usr/bin/git-shell gollum

chmod + /etc/rc.local

Apply and check,

/etc/rc.local
ps auxw | grep ^gollum
tail -F ~gollum/repo*.log
lynx -dump localhost:4567
http://SERVER_ADDRESS:4567/

git clone ssh://gollum@SERVER_ADDRESS:PORT/repo.git

Proxy Ready

Only listening to localhost to be reverse proxied locally,

--host 127.0.0.1

Misc

More Options

Show everything in Files UI view,

  :show_all => true

More Features

Optionally, add mediawiki formatting,

gem install wikicloth

Replacing rdiscount

gem install github-markdown

You can then omit --bare when launching Gollum, as it is only required by GRIT.

Replacing GRIT Adapter

apt -y install cmake pkg-config libcurl3-dev libssl-dev
gem install gollum-rugged_adapter

--adapter rugged

Note. With sate-of-the-art markdown formatting with better tables, and with the rugged adapter,

FROM SCRATCH

install the needed packages to build the thing,

#apt -y install build-essential git ruby ruby-dev libicu-dev zlib1g-dev

problem is I did not figure out how to install some addons,

#apt -y install git ruby ruby-dev zlib1g-dbg zlib1g-dev libicu-dev make build-essential
#gem install bundle
#git clone https://github.com/gollum/gollum.git
#git clone https://github.com/sekhmeth13/gollum-tweaked.git
#cd gollum/
#git pull
#bin/gollum -v
#bundle install

References

Auth


Nethence | Doc | Pub | Lab | Pbraun | SNE Russia | xhtml