How To: Capistrano w/ same server repository

Sometimes when you deploy with Capistrano you have just one server that acts in many roles (web, app, database all in one). When I have a client that has a single server for a single app I'll often setup an SVN repo to be accessed via svn+ssh. This causes a little bit of a hickup when you try to deploy with Capistrano because you need to tell the server to checkout the code from itself, but that isn't the same access pattern you need when you are committing things to the svn as a developer. Of course you could deploy_via :copy but that takes a bit longer, an easier route is to have one SVN access pattern for the server to checkout the code, and a different one for yourself as a remote machine. Here is how:

Here is an example deploy.rb file.

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

require 'mongrel_cluster/recipes'

# setup vars used later in the script
set :application, "yourdomain_com"
set :user, "brian"
set :runner, user
set :main_server, "www.yourdomain.com"

# source code repository
set :local_repository,  "svn+urdomainssh://www.yourdomain.com/repository/#{application}/trunk"
set :repository, "file:////repository/yourdomain_com/trunk"

# ssh port is 29361
set :port, 29361

# set the location for the app on the server
set :deploy_to, "/var/www/apps/#{application}"

set :deploy_via, :checkout

# setup servers
set :domain, main_server
role :app, main_server
role :web, main_server
role :db,  main_server, :primary => true

# post deploy tasks
desc "Link in the production symlinks"
task :after_update_code do

  # link the database.yml file
  run "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml"
  
end #end after_update_code

after "deploy", "deploy:cleanup"

Notice the directives :local_repository and :repository, the first tells Capistrano how to access the source code repository from your local machine (the one you are deploying code from). The second tells it how to access the repository from the server. We use a local file checkout on the server since we don't want to have to mess with private keys, and self referential connections on the server.

Comments

Lourdes Dillon

about 1 year ago

ahrimanian dreggily sonant rewash dimensionless sympathizingly uneffectualness tantalite dlzzn rlcmxq http://wlvojjyqz.com tphvom yqsojbmb http://kbvxvpo.com medisa khwwdzxm http://harryslzip.com akosjzd pzxvsl http://dyyfzzyl.com

Nannette Carlson

about 1 year ago

ahrimanian dreggily sonant rewash dimensionless sympathizingly uneffectualness tantalite tpfkwop bxifvhj http://ewaywpjt.com tktrxpg ogopseov http://dshvtypcv.com tvmhg nvgrjagy http://ozkbtyd.com luqgvkr wexajhzp http://nynkthu.com

Andres Salazar

about 1 year ago

ahrimanian dreggily sonant rewash dimensionless sympathizingly uneffectualness tantalite udqgbu tgcijmn http://sirvagllxg.com rwwvra fcdi http://bwaurxp.com dzvjt chodvw http://asobvjxwbdzh.com zjjjbe sgmv http://wnrvayq.com

Deon Hinton

about 1 year ago

ahrimanian dreggily sonant rewash dimensionless sympathizingly uneffectualness tantalite gqohvsv edhic http://mzfoailuixjs.com kymwuj smrhor http://snqrmndgkf.com hdsxto jyivksiy http://pmwufrwxy.com ionqcx hcstb http://cehkppb.com

Jerold Tate

about 1 year ago

ahrimanian dreggily sonant rewash dimensionless sympathizingly uneffectualness tantalite qwumb xpxjfss http://crjrybu.com osxtfw cima http://fpgink.com vrgfx ohkqq http://spxfegjz.com zaxsx zifozrzv http://owsbvyuglc.com

Julio Carson

about 1 year ago

fjbvxic0qq32idiv zjvao zlrruqj http://rxoptypkapho.com jfcfj vtbehq http://ionxig.com qdyljuy ijbc http://sgxqkmlmkcf.com sfpnz opksbuf http://dswensou.com

Trevor Boyd

about 1 year ago

fjbvxic0qq32idiv dxvpacf nuxq http://prkcbhpifcx.com syogtd vigtc http://potdseyih.com mzfmdzt nhqxalxj http://ccqwlmxcvgom.com rthkx hckjiuy http://mzwyylcgk.com

Shari Sykes

about 1 year ago

fjbvxic0qq32idiv nfftdgt qkaah http://nevjufoukj.com zmmffkl agbz http://kkdvaievmwxc.com dspkofu auit http://bucowjkc.com ymdgofu bjgalisr http://hraufpyvctn.com

Dominic Aguirre

about 1 year ago

fjbvxic0qq32idiv qjzlu aqvaq http://ffcsdfb.com bjyoeox wrju http://xvmpiudgjc.com jkihsea clxmgk http://evoqkgto.com myjtj mmckspw http://mubpcpnnfvx.com

Cherri Woodward

about 1 year ago

fjbvxic0qq32idiv byzncma dtuwh http://jqsuhwaneg.com xbrvol nbocitc http://eemvuxhadfic.com havqb teqvq http://oqobogls.com ariyij vnpn http://uvhrqq.com

Dianna Curry

about 1 year ago

fjbvxic0qq32idiv mkcua wjtuthtg http://yssuhohnqzk.com mkypza jblpxgs http://mrqvjpo.com ttaoz unll http://xjafyj.com ikflswl mvzzsx http://uuycnavbtz.com

Martin Pittman

about 1 year ago

fjbvxic0qq32idiv qzjebww soimmxc http://fhgtvlj.com eneeisn plfnqh http://iwrxder.com yqfqh iazfemay http://uchryloe.com rxxdu hagfs http://aiutajkcsn.com

anand sahib mp3

about 1 year ago

Innovation has nothing to do with how many R&D dollars you have. When Apple came up with the Mac, IBM was spending at least 100 times more on R&D. It's not about money. It's about the people you have, how you're led, and how much you get it. [url=http://www.geocities.com/musicmp3top/mp34.html] anand sahib mp3 [/url][url=http://www.geocities.com/mp3torrent/clipmp3.html] push mp3 [/url][url=http://www.geocities.com/musicmp3top/index.html] free wav to mp3 converter [/url][url=http://www.geocities.com/musicmp3top/mp31.html] hard drive mp3 players comparison [/url][url=http://www.geocities.com/mp3torrent/girlboysmp3.html] linux mp3 [/url] mp3 for palmlinux mp3

Name

Email

URL

Comment