Installing Mephisto 0.8 on Rails 2

MephistoFinally I'm done with installing and running mephisto for ExpressionLab. ExpressionLab now is powered by mephisto. However, It was not that easy so I thought documenting it may help me in the future and may save someone else's time. Actually, a lot of time.

Well, if you don't know, mephisto is a simple, elegant and free Ruby on Rails blogging system that can run fantastic websites like the one you are reading now :)

Unfortunately, due to the lack of documentation, especially after releasing mephisto 0.8 that supports Rails 2, it took me a long time to get it installed and running. The good news is that I will show you how I did it. So, to the tutorial...

  1. First of all, you should know that mephisto 0.8 has some issues with Ruby 1.8.7. So you will have to downgrade to Ruby 1.8.6 if already upgraded. Actually, Rails itself recommends Ruby 1.8.6.
  2. To download mephisto 0.8, I tried github but it did not install successfully. Finally, I found a working version at RailsPlayground. So, go to your hosting shell and download it from http://downloads.railsplayground.net/mephisto-0.8-railsplayground.zip
  3. Now, extract the file you downloaded:
    unzip mephisto-0.8-railsplayground.zip
    Then, rename the folder:
    mv mephisto-0.8 mephisto
  4. Log in to your hosting control panel and create a database, say mephisto_db, and a database user, say mephisto_dbuser. Then, make sure to assign the user to the databse with all privileges.
  5. Rename the file database.example.yml to database.yml:
    mv mephisto/config/database.example.yml mephisto/config/database.ym
  6. Edit the config/database.yml and update the production database definition to match the database and database user you created:
    vi mephisto/config/database.yml
    production:
      adapter: mysql
      database: mephisto_db
      username: mephisto_dbuser
      password: yourpassword
      host: localhost
      
  7. Update your application with latest Rails:
    cd mephisto
    rake rails:update
  8. Create mephisto's database tables:
    rake db:bootstrap RAILS_ENV=production
  9. To install mephisto on your main domain, yoursite.com for example, you will need to create a symbolic link from your public_html direcotry to mephisto’s public directory. Remember to backup your public_html first:
    mv public_html public_html_backup
    ln -s ~/mephisto/public ~/public_html
    Congratulations! You can access your blog using this URL (the slash at the end is a MUST):

    yoursite.com/mephisto/

    And the admin site is:

    yoursite.com/mephisto/admin/

  10. To install mephisto on a subdomain, blog.yoursite.com for example, just login to your hosting control panel and create a new subdomain that points to mephisto/public. Now, you can access your blog using this URL (the slash at the end is a MUST):

    blog.yoursite.com/

    And the admin site is:

    blog.yoursite.com/admin/

  11. To access the admin site, use the username:admin and password:test

Now, click the "Create new article" at the top to create your first article. You may get an error

Invalid encoding... bla bla bla

Don't worry, I've made the search for you. The solution is to edit the vendor/plugins/permalink_fu/lib/permalink_fu.rb as follows:

  1. Change line 9 to:
    s = Iconv.iconv(translation_to, translation_from, str).to_s
  2. Change line 90 to:
    PermalinkFu.translation_to = 'ascii//ignore//translit'

Now, with your second try to add your first article, you may get another error:

Define INLINEDIR or HOME in your environment and try again

The solution is to edit the mephisto/config/initializers/custom.rb to add this:

ASSET_IMAGE_PROCESSOR = :none

Now, the third trial should work.

Congratulation! You've just created your first article on mephisto.

Now, you should change your password. And I recommend you also change your login name as it will appear as the author name for your articles.

Next time, I may talk about some useful plugins that you can install on your mephisto.

Did you like this article? Bookmark it:

Related Articles

6 Comments

  • I just want to demo the Mephisto interface... I have Ruby 1.8.7 on my host PrecisionEffect... I would get a new host for Mephisto, but I don't even know how it works yet... never tried it out!

  • The official demo is here http://demo.mephistoblog.com/ but I think it is closed now. You can find some screenshots here: http://mephistoblog.com/screenshots. Regarding the hosting, I'm using A Small Orange and their support is fantastic.

  • It looks to me you really haven't installed mephisto using rails 2.1. Mephisto's code base is frozen at rails 2.0.2. Your instructions do not point to changing the config/environment.rb to change the rails version. Once you do that, all sorts of things break... You'll have to update your rails engines plugin and also your liquid plugin. At that point you'll hit this: /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method': undefined method `initialize_schema_information' for module `ActiveRecord::ConnectionAdapters::SchemaStatements' (NameError) from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/module/aliasing.rb:31:in `alias_method_chain' from /Users/enrico/src/mephisto-0.8/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb:131:in `included' from /Users/enrico/src/mephisto-0.8/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb:131:in `class_eval' from /Users/enrico/src/mephisto-0.8/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb:131:in `included' from /Users/enrico/src/mephisto-0.8/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb:155:in `include' from /Users/enrico/src/mephisto-0.8/vendor/plugins/engines/lib/engines/rails_extensions/migrations.rb:155 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require' ... 47 levels... from /Library/Ruby/Gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39 from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require' from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require' from ./script/server:3

  • Oops, sorry wrong stack trace: here's where I'm stuck now...

    /Library/Ruby/Gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:1297:in `respond_to?': wrong number of arguments (2 for 1) (ArgumentError)
            from /Library/Ruby/Gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:1297:in `respond_to?'
            from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.1/lib/active_support/core_ext/class/inheritable_attributes.rb:125:in `inherited_without_mixins'
            from /Users/enrico/src/mephisto-211/vendor/plugins/aaa/init.rb:60:in `inherited'
            from /Library/Ruby/Gems/1.8/gems/activerecord-2.1.1/lib/active_record/observer.rb:50:in `inherited'
            from /Library/Ruby/Gems/1.8/gems/activerecord-2.1.1/lib/active_record/base.rb:369:in `inherited'
            from /Users/enrico/src/mephisto-211/app/models/content.rb:1
            from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:216:in `load_without_new_constant_marking'
            from /Library/Ruby/Gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:216:in `load_file'
             ... 70 levels...
            from /Library/Ruby/Gems/1.8/gems/rails-2.1.1/lib/commands/server.rb:39
            from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
            from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require'
            from ./script/server:3
    

  • @Enrico:

    You are right, the mephisto-0.8-railsplayground.zip contains this: RAILS_GEM_VERSION='2.0.2'. Keep it as is and the tutorial should work. Sorry for that. It must be due to the many trials I made.

    I'll need to change it to Rails 2.1 and solve the new problems :(

  • This guy is trying to make Mephisto 2.1 compatible: http://github.com/jsl/mephisto/tree/master It's still not working for me, but he at least has a monkey patch that fixes Enrico's problem.

Leave a Comment

If you want to post code, do this:
<pre><code class="ruby|javascript|css|html"> your code here </code></pre>