February 15, 2008

Posted by John

Tagged merb

Older: KYTCR Part III: Automating Problem Resolution

Newer: Git and GitHub

Merb and Capistrano

In the interest of kicking my butt into posting more, I’m going to put up a sample deploy file for a merb app we launched about a month ago. Below is an example capistrano 1.4 file that I use for a merb app that runs on active record and sqlite3. It’s a small stat program that grabs analytics in the flash carousel on nd.edu.

set :application, "myapp"
set :user, "deploy"
set :domain, "yourdomain.com"
set :repository, "svn+ssh://#{user}@#{domain}/var/www/apps/repos/#{application}/trunk"
set :deploy_to, "/var/www/apps/#{application}"

role :app, domain
role :web, domain
role :db, domain, :primary => true

desc "Link in the production extras"
task :after_symlink do
	# symlink log path
  run "ln -nfs #{shared_path}/log #{release_path}/log"
	# symlink path to database, this is only needed if you are using sqlite (which is ok for little things and is really easy)
  run "ln -nfs #{shared_path}/db/#{application}_production.sqlite3 #{release_path}/db/#{application}_production.sqlite3"
end

desc "Merb it up"
task :restart do
  run "cd #{current_path};./script/stop_merb"
  # run "cd #{current_path};env EVENT=1 merb -e production -c 1" # for evented mongrel
  run "cd #{current_path}; merb -e production -c 1" # plain old mongrel
end

Once you have everything configured, deployment is as easy as cap setup and cap deploy (you’ll probably need to migrate your db as well).

We (the notre dame web group) are now using Merb for two production applications and are finding it a nice change of pace from Rails. If you want to learn more, peter cooper has a crap load of links for merb at ruby inside.

4 Comments

  1. vlad is better

  2. @john – yeah, so that comment isn’t very helpful. I gave vlad a couple months ago and it just wouldn’t work. Can’t remember why. I’ll probably try it again before too long.

  3. So yeah, until installation is sweet, easy perfection, I’m working on DataObjects to make it a golden crispy treat. :-)

    Hope to see you back again when we’ve got all that sorted in the next couple weeks.

    The new DO lives at http://github.com/sam/do

    And while I’m always under a time crunch of some sort, if I can help, don’t hesitate to ping me on IRC, by email, or GTalk. :-)

  4. @Sam – Oh, I’ll be back. I enjoy new stuff and I’m a fan of data mapper. I decided to take a break from the bleeding edge installation on linux. :)

Sorry, comments are closed for this article to ease the burden of pruning spam.

About

Authored by John Nunemaker (Noo-neh-maker), a web developer and programmer who has fallen deeply in love with Ruby. More about John.

Syndication

Feed IconRailsTips Articles - An assortment of howto's and thoughts on Ruby and Rails.

Feed IconRails Quick Tips - Ruby and Rails related links.