Instiki
Instiki On Dreamhost

Instiki 0.13 Installation on Dreamhost with Passenger

Running Instiki on Dreamhost has gotten much easier since they have added Passenger (mod_rails).

Create a new fully hosted domain on dreamhost. Something like wiki.domain.com.
  • Check the “Ruby on Rails Passenger (mod_rails)” box.
  • In the Specify your web directory enter “wiki.yourdomain.com/instiki/public”

This will create the wiki.domain.com folder in the user’s home directory. Login to your shell account and do the following:


cd wiki. yourdomain.com
svn checkout svn://rubyforge.org/var/svn/instiki/instiki/trunk/ instiki
cd instiki
rake db:migrate RAILS_ENV=production

Open wiki. yourdomain.com in your browser and set up the wiki.

Chuckle.

Instiki 0.11 installation on Dreamhost

Get the source

With Subversion:


svn co http://instiki.rubyforge.org/svn/instiki/trunk/ yourWebDirectory

OR

1. Download the source tarball from http://www.instiki.org
OR
2. Unpack it into your web directory
3. Rename it as instiki

Create the databases

You have the choice between the different backends supported by Rails : sqlite3, mysql, postgresql...

In this tutorial we will use sqlite3, which is the Instiki default. sqlite3 is bundled with Instiki, so you won’t need to install it separately. If you use sqlite3, you won’t need to change config/database.yml from the defaults.

Go to the root of the instiki directory, and type:


rake db:migrate RAILS_ENV=production

You should now have the production database created in the db directory.

Edit the configuration

Open public/.htaccess and change the following line :


RewriteRule ^(.*)$ dispatch.cgi [QSA,L]

to:


RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

Make sure you enabled FCGI in your Dreamhost domain settings.

Securing your install

In order to protect your database password (and other config information), you must prevent http access to directories other than public in the install tree. Do this in two steps:

  1. Deny access by default Create an .htaccess file in the Instiki root directory containing only Deny from all
  2. Override this protection in public/.htaccess, adding the phrase Allow from all

Help preventing 500 errors

Then you can edit the file public/dispatch.fcgi to add the following at the end of it (taken
from http://work.alexyoung.org/archives/102/dreamhost-and-rails-500-errors ) :


RailsFCGIHandler.process! nil, 10

class RailsFCGIHandler
  private
  def frao_handler(signal)
    dispatcher_log :info, "asked to terminate immediately" 
    dispatcher_log :info, "frao handler working its magic!" 
    restart_handler(signal)
  end
  alias_method :exit_now_handler, :frao_handler
end

NOTE: Newer versions of Instiki use require ‘fcgi_handler’, which is a better option than above for dealing with 500 errors.

Make it work in production mode

NOTE: I was able to get it to work on Dreamhost in production mode by adding this as the top line in environment.rb:


RAILS_ENV  = ENV['RAILS_ENV'] || 'production'

Clean the dispatcher

You can do the following from the root of your installation directory in order to be sure to start Instiki in a clean environment :


touch public/*
killall dispatch.fcgi
rm -f /tmp/ruby_sess.*

Run Instiki

Go to http://www.yourdomain.com/instiki/public/

You should see the Instiki Setup page.

Sometimes it helps to chmod your entire directory to 755 on Dreamhost.

Troubleshooting

Fast CGI?: comm with (dynamic) server and Fast CGI?: incomplete headers server errors for dispatch.fcgi

I had to use PHP 4.4.7 setting in the Manage Domains area, as opposed to PHP 5.2.2. Also, i’m hosting this as a subdomain. ie: wiki.domain.com

Constant error for Export

When I try to use the Export feature, I get a uninitialized constant error due to the presence of a test on OPTIONS[:pdflatex] in the export template. One dirty workaround is to delete this portion of the test by editing line 8 of app/views/wiki/export.rhtml to :


<% if @web.markup == :textile %>

Missing latex extensions

Some extensions needed to produce the PDF export are missing on the Dreamhost server. The workaround is to edit the views app/views/wiki/tex.rhtml and app/views/wiki/tex_web.rhtml to make them compatible.

400 Bad Request

You may run into trouble if you try to access your instiki using http://www.yourdomain.com/instiki/public instead of http://www.yourdomain.com/instiki/public/ (mind that slash!)

NOTE – just set the target for your web directory to

/home/username/yourdomain.com/instiki/public
from the Dreamhost Hosting Panel – that way you can use something nicer like:
wiki.yourdomain.com
to access instiki.