How to run Gollum using mod_rails and Apache in a shared hosting environment (e.g. Dreamhost)?

Create the file "config.ru", add this to it:

require "gollum/frontend/app"

Precious::App.set(:gollum_path, File.dirname(__FILE__))
Precious::App.set(:wiki_options, {})
run Precious::App

There's an excellent guide on:

https://github.com/tecnh/gollum/wiki/Gollum-and-Passenger

The main points are:

  • add a config.ru to lib/gollum/frontend
  • Point your document root to lib/gollum/frontend/public
  • Use the following config.ru as a base, set wiki path accordingly (I had to add the bundler setup part)
#!/usr/bin/ruby
require 'rubygems'
require 'bundler/setup'
require 'gollum/frontend/app'

system("which git") or raise "Looks like I can't find the git CLI in your path.\nYour path is: #{ENV['PATH']}"

gollum_path = '/path/to/wiki' # CHANGE THIS TO POINT TO YOUR OWN WIKI REPO

disable :run

configure :development, :staging, :production do
 set :raise_errors, true
 set :show_exceptions, true
 set :dump_errors, true
 set :clean_trace, true
end

$path = gollum_path
Precious::App.set(:gollum_path, gollum_path)
Precious::App.set(:wiki_options, {})

run Precious::App

The answer of August Lilleaas is correct, however I needed to use an older version of gollum, so I set it up with Bundler:

Gemfile:

source 'http://rubygems.org'

gem 'rdiscount'
gem 'gollum', '1.3.0'

config.ru:

require 'rubygems'
require 'bundler'

Bundler.require

require "gollum/frontend/app"

Precious::App.set(:gollum_path, File.expand_path(File.dirname(__FILE__)))
Precious::App.set(:wiki_options, {})
run Precious::App

Also remember to create the directories public and tmp, as Passenger requires these.

However, I ran into another problem. You have to make sure that git is in the path of the webserver-user. For me this was not the case, and unfortunately there is no error message, you just always end up on the page to create a new page.