Welcome Guest | Login

Mephisto Hosting: How to deploy Mephisto on HostingRails.com



This is a wiki article created by HostingRails users. Please login or signup to make edits.


Here is what not to do when installing Mephisto
Don't get mephisto working on your local box then upload the files. It doesn't work.
I didn't upload the whole Mephisto rails app, just followed the tutorials, got the .htaccess and dispatcher.fcgi files right. But for some reason rails wasn't finding gems and plugins in the vendor directory. Tried a whole lot of things to move forward but it didn't work.



Here is what did work:
At the command line at root:
git clone git://github.com/technoweenie/mephisto.git
OR
wget http://github.com/technoweenie/mephisto/tarball/master.tar.gz
tar -zxvf  technoweenie-mephisto-22dab17c881f9db136194243844d8ace37536099.tar.gz
mv technoweenie-mephisto-22dab17c881f9db136194243844d8ace37536099 mephisto

cd mephisto


Create a database and database user (i did this thru cpanel).
Add the database name, user and password to config/database.yml and remove everything but 'production'.

Uncomment this line in config\environment.rb
ENV['RAILS_ENV'] ||= 'production'


Add the following line below the RAILS_ENV line
ENV['HOME']='/home/username'   #Replace username with your account-name.


Also edit the secret key variable in the "config.action_controller.session" line to something random.
config.action_controller.session = { :session_key => "_mephisto_session", :secret => "edit_here" }


no need to change routes.rb

Freeze rails 2.0.2. This is necessary for Mephisto to install/operate correctly.
rake rails:freeze:edge RELEASE=2.0.2


To update the boot.rb file copy the boot.rb of rails 2.0.2 to app's config section.
mv config/boot.rb config/boot.rb.bak
cp vendor/rails/railties/environments/boot.rb config/boot.rb


At the command line in ~/mephisto create your database tables and data (it copies themes as well). Like this
rake db:bootstrap RAILS_ENV=production


Create a public/.htaccess file using the following contents
# General Apache options
AddHandler cgi-script .cgi
Options +FollowSymLinks +ExecCGI

# If you don't want Rails to look in certain directories,
# use the following rewrite rules so that Apache won't rewrite certain requests
#
# Example:
#   RewriteCond %{REQUEST_URI} ^/notrails.*
#   RewriteRule .* - [L]

# Redirect all requests not available on the filesystem to Rails
# By default the cgi dispatcher is used which is very slow
#
# For better performance replace the dispatcher with the fastcgi one
#
# Example:
#   RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]
RewriteEngine On

# If your Rails application is accessed via an Alias directive,
# then you MUST also set the RewriteBase in this htaccess file.
#
# Example:
#   Alias /myrailsapp /path/to/myrailsapp/public
#   RewriteBase /myrailsapp

RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ dispatch.fcgi [QSA,L]

# In case Rails experiences terminal errors
# Instead of displaying this message you can supply a file here which will be rendered instead
#
# Example:
#   ErrorDocument 500 /500.html

ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly"


Change shebang line in the file public/dispatch.fcgi to
#!/usr/local/bin/ruby


You can make sure that you are using the correct path to ruby as the shebang line by checking output of the following command.
which ruby


All done! Browse to your new Mephisto app.

I setup mephisto as an addon domain so i also did the symlinking from this tutorial
http://www.hostingrails.com/forums/wiki_thread/6

and here is the mephisto install i loosely followed
http://mephisto.stikipad.com/help/show/Installing+Mephisto

I didnt freeze rails to edge as mephisto runs on rails 1.2 and rails 1.2 is now out and installed on HostingRails.com accounts.

I hope your mephisto install is hair pulling free :)



If you are looking for themes, I ported a bunch and can be downloaded from http://railsgrunt.com/mephisto-themes
just download, unzip, and upload the folder to your themes directory. thanks.



There is a problem with Mephisto comments when combined with Apache. The problem being you can add a maximum of only 1 comment per blog post. The reason is described here.
The solution described is to add
DirectorySlash Off
to the end of your public/.htaccess file.
" " "


Changes for Mephisto 0.8.1 +
As of v0.8.1, Mephisto runs on Rails 2.2.2, so freeze Rails accordingly.

Also, Mephisto has moved from plugins to gems, so you'll have to let Mephisto know where to find them.  First, run
gem environment
and copy the GEM PATHS section.  Then, add this to config/environment.rb:
ENV['GEM_PATH']='<PATH TO MEPHISTO>/vendor/gems:<PATHS FROM GEM ENVIRONMENT>'
For example, my ENV['GEM_PATH'] line is:
ENV['GEM_PATH']='/home/<USERNAME>/mephisto/vendor/gems:/home/<USERNAME>/.gems:/home/<USERNAME>/.gem/ruby/1.8:/usr/local/lib/ruby/gems/1.8'
Good luck!





Hello Guest! In order to edit this article you must be an active client with us, please log in or sign up today!






Contributing Author(s):
Nolemon
Mixplate
William
Imsodef
Vinayan
Thatnick