I am yelling, can you hear me? Subscribe to my feed
Subscribe to my Twitter feed

In order to prepare for the up-coming bug fixes etc of the beta release of Pieshop Invoice, I decided to set-up Capistrano with my rails app on MT. (Well, DonC suggested it.) So a quick search in MT forums brought up this How-To. After fixing some of my typos, I still was stuck. I kept getting sudo: command not found when I tried cap deploy:setup. Back to DonC, and an updated deploy.rb with the added line set :use_sudo,   false. And I was running again.

Until I got to cap deploy:migrate which breaks due to my app being a Rails 2.0 app. So after following the advice of gecko (a MT engineer), I did a SVN check out of Rails and set it as an external. So after all that and more tweaks to my deploy.rb, everything is running smooth.

Here’s the code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require "mt-capistrano"
 
# Your site number is right after the 's' in your access domain
set :site,         ""
# The name for your app within /containers/rails/
set :application,  ""
# The destination domain for you app
set :webpath,      ""
# The primary domain for your server
set :domain,       ""
# Your SSH user (serveradmin@mt-example.com)
set :user,         ""
# set up ssh keys so you don't need a password here
set :password,     ""
 
# repository on (gs)
set :repository, "svn+ssh://#{user}@#{domain}/home/#{site}/data/repo/app1/trunk"
 
# offsite repository
#set :repository, ""
 
set :deploy_via, :copy
set :copy_cache, true
set :copy_strategy, :export
 
set :use_sudo,     false
 
# which environment to work in
set :rails_env,    "production"
 
# necessary for functioning on the (gs)
default_run_options[:pty] = true
 
# these shouldn't be changed
role :web, "#{domain}"
role :app, "#{domain}"
role :db,  "#{domain}", :primary => true
set :deploy_to,    "/home/#{site}/containers/rails/#{application}"
 
# uncomment if desired
#after "deploy:update_code".to_sym do
#  put File.read("deploy/database.yml.mt"), "#{release_path}/config/database.yml", :mode => 0444
#end
 
# update .htaccess rules after new version is deployed
after "deploy:symlink".to_sym, "mt:generate_htaccess".to_sym

Download deploy.rb.
 

Share this article ...
[del.icio.us] [Digg] [Facebook] [Ma.gnolia] [Email]

Leave a Reply