Skip to content

Latest commit

 

History

History
26 lines (19 loc) · 1.04 KB

2.x-Multiple-Stages-Without-Multistage-Extension.md

File metadata and controls

26 lines (19 loc) · 1.04 KB

If you have reviewed the multistage extension and have wondered how it works, or how you could replicate this without adding another dependency, consider the following example.

Note: This way only really works if you have minimal differences in tasks between stages, if you have extensive staging differences, please consider the advice on deploying to multiple stages.

Enter this in to your config/deploy.rb taking note that the role definitions are inside the task block:

set :application, 'example-website'

task :production do
  role :web, "www.capify.org"
  set :deploy_to, "/u/apps/#{application}-production/"
  set :deploy_via, :remote_cache
  after('deploy:symlink', 'cache:clear')
end

task :staging do
  role :web, "localhost"
  set :deploy_to, "/Users/capistrano/Sites/#{application}-staging/"
  set :deploy_via, :copy
  after('deploy:symlink', 'cruise_control:build')
end

With that in mind, to deploy you can try something like:

$ cap staging deploy
$ cap staging deploy:restart