I’ve recently taken a fancy to Mephisto, a blogging-platform written in Rails. I have nothing against WordPress, but being in Ruby and using Liquid for themes, Mephisto is far easier (and more fun) to tweak and configure, especially when I want to migrate my sites away from the “blog look” and make them more dynamic.
It’s unfortunate development isn’t as active as say, Typo (also a Rails app, but I haven’t tried it), but I find that Mephisto at its current level makes a simple and fast starting point for most of my projects.
The point of this post is to address numerous problems with the installation. These are present in the tarball release of 0.8 Drax, and in trunk (as of 10/21).
Git The Code
Get the files, either the compressed archive or from edge (recommended).
git clone git://github.com/technoweenie/mephisto.git
You’ll need to freeze rails 2.0.2, and have the latest tzinfo gem installed:
gem install tzinfo cd mephisto/ rake rails:freeze:edge RELEASE=2.0.2
The file it downloads should be named rails_2.0.2.zip and NOT rails_edge.zip.
Copy the “new” boot.rb into the config/ folder, overwriting the existing one:
cp vendor/rails/railties/environments/boot.rb config/boot.rb
Now rename the database sample file in config/ to database.yml and edit it to fit your own DB settings. You’ll probably only be using production.
rake db:bootstrap RAILS_ENV=production
If it works, GREAT. But you’ll probably get an error or two. If you’re getting the following error:
Error message: undefined method `initialize_schema_information' for module `ActiveRecord::ConnectionAdapters::SchemaStatements' Exception class: NameError
You forgot to copy over boot.rb from vendor/rails/ – scroll up. If you’re getting an error that redcloth is missing (no such file to load—RedCloth-3.0.4/lib/redcloth), even though it’s in vendor/, it’s because the path to RedCloth is relative in config/environment.rb. Change it from:
require '../vendor/RedCloth-3.0.4/lib/redcloth' unless Object.const_defined?(:RedCloth)
require File.join(File.dirname(__FILE__), '../vendor/RedCloth-3.0.4/lib/redcloth') unless Object.const_defined?(:RedCloth)
After the bootstrap, you may either start the server (ruby script/server, thin, mongrel, etc), or go with mod_rails (Phusion Passanger). I recommend the latter – Passenger is amazing, and the error screen is pretty.
Just point your Apache2 vhost to Mephisto’s PUBLIC/ dir. Here’s an example:
ServerAdmin mrEman@domain.com ServerName domain.com ServerAlias www.domain.com # DocumentRoot must be rails_app/public/ DocumentRoot /home/kiwi/www/domain.com/public/public Railsenv production DirectoryIndex index.html index.htm index.php ErrorLog /home/blue/www/domain.com/log/error.log CustomLog /home/blue/www/domain.com/log/access.log combined
Restart Apache2, and you’re done. The site should work right away. If you get the following error:
No such file or directory - /tmp/mysql.sock
It’s because the socket file resides somewhere else on your (host’s) distro. Just find (man find, locate, etc) and add a symlink to it. Here’s an example (Debian):
ln -s /var/run/mysqld/mysqld.sock mysql.sock
If you’re getting an error that gems you know you have aren’t found, like:
no such file to load -- tzinfo (MissingSourceFile)
it is due to the fact that Gems are not located anywhere Ruby checks. You’ll have to explicity pass Ruby -rubygems or require ‘rubygems’ — what a nuisance. Open config/environment.rb and add the latter line:
# requires vendor-loaded redcloth require 'rubygems'
This will be global. Now either restart the server you ran (i.e., thin), or tell mod_rails to restart the app. To do so, just create a file named “restart.txt” in the tmp/ folder of the RAILS app:
cd mephisto_root/ touch tmp/restart.txt
and refresh the page. Passenger will restart the app and restart.txt will vanish.
The default login for the /admin page is admin/test. Wasn’t that a blast?