Merb and Capistrano
February 15th, 2008
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 Responses to “Merb and Capistrano”
Sorry, comments are closed for this article to ease the burden of pruning spam. If you have any further comments, just send me an email.

February 16th, 2008 at 08:59 AM
vlad is better
February 16th, 2008 at 12:04 PM
@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.
February 16th, 2008 at 12:13 PM
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. :-)
February 16th, 2008 at 01:19 PM
@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. :)