Some clarification on Capistrano 2 's deploy.rb

28 views
Skip to first unread message

niristotle okram

unread,
Apr 29, 2015, 5:10:01 PM4/29/15
to capis...@googlegroups.com
Versions:
  • Ruby   2.1.1
  • Capistrano  2
Platform:
  • Working on....
  • Deploying to... RHEL 6.6

Files:
  • Capfile
  • deploy.rb

require 'capistrano/chef'
require "capistrano/ext/multistage"

set :application, "test"
set :repository, 'ssh:/...................'
set :user, 'deployer'

#the below line is to avoid git clone on every deployment
set :deploy_via, :remote_cache

set :deploy_to, '/opt/mount1/test'
set :scm, :git

#line to avoid saving the files declared
set :copy_exclude, [".git", ".gitignore"]

set :scm_verbose, true
ssh_options[:paranoid] = false
default_run_options[:pty] = true


# set :scm, :git # You can set :scm explicitly or Capistrano will make an intelligent guess based on known version control directory names
# Or: `accurev`, `bzr`, `cvs`, `darcs`, `git`, `mercurial`, `perforce`, `subversion` or `none`



#before "deploy", "deploy:stop_app"

#after "deploy", "deploy:start_app"

after "deploy", "deploy:restart_app"

namespace :deploy do
  task :update_code, :roles => :web, :except => { :no_release => true } do
    on_rollback { puts "some message?" }
    strategy.deploy!
    finalize_update
  end

  task :stop_app, :roles => :web do
    run "sudo /etc/init.d/test stop", :shell => :bash
  end

  task :start_app, :roles => :web do
    run "sudo /etc/init.d/test start", :shell => :bash
  end


  task :restart_app, :roles => :web do
    run "sudo /etc/init.d/test restart", :shell => :bash
  end
end



------------------------------------

So, in the above 'deploy.rb', there is this block below. 

namespace :deploy do
  task :update_code, :roles => :web, :except => { :no_release => true } do
    on_rollback { puts "some message?" }
    strategy.deploy!
    finalize_update
  end

Question:
1. where is this task 'update_code' defined? is this the one that pulls down the code to the 'deploy_to' location and performs the symlinks etc?
2. this else condition for the update_code task 
:except => { :no_release => true } do
    on_rollback { puts "some message?" }
    strategy.deploy!
    finalize_update
what do they mean? where can i find the meaning of ' strategy.deploy!' and ' finalize_update'




Thanks 









Lee Hambley

unread,
Apr 29, 2015, 5:19:47 PM4/29/15
to Capistrano
I'm sorry I can't be more helpful, but most of it you will find documented in source code here - https://github.com/capistrano/capistrano/tree/legacy-v2 specifically under that tag. The v2 code is now *very* old.

--
You received this message because you are subscribed to the Google Groups "Capistrano" group.
To unsubscribe from this group and stop receiving emails from it, send an email to capistrano+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/capistrano/c2d87025-56cb-4af0-8220-a9d70a5b2b01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages