Deploy: Deploy apps from a source control repository.
Callbacks: Callbacks can be a block or a string. If given a block, the code is evaluated as an embedded recipe, and run at the specified point in the deploy process. If given a string, the string is taken as a path to a callback file/recipe. Paths are evaluated relative to the release directory. Callback files can contain chef code (resources, etc.)
# File lib/chef/resource/deploy.rb, line 60 def initialize(name, run_context=nil) super @resource_name = :deploy @deploy_to = name @environment = nil @repository_cache = 'cached-copy' @copy_exclude = [] @purge_before_symlink = %{log tmp/pids public/system} @create_dirs_before_symlink = %{tmp public config} @symlink_before_migrate = {"config/database.yml" => "config/database.yml"} @symlinks = {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"} @revision = 'HEAD' @action = :deploy @migrate = false @rollback_on_error = false @remote = "origin" @enable_submodules = false @shallow_clone = false @scm_provider = Chef::Provider::Git @svn_force_export = false @provider = Chef::Provider::Deploy::Timestamped @allowed_actions.push(:force_deploy, :deploy, :rollback) @additional_remotes = Hash[] @keep_releases = 5 end
# File lib/chef/resource/deploy.rb, line 393 def additional_remotes(arg=nil) set_or_return( :additional_remotes, arg, :kind_of => Hash ) end
Callback fires after restart
# File lib/chef/resource/deploy.rb, line 388 def after_restart(arg=nil, &block) arg ||= block set_or_return(:after_restart, arg, :kind_of => [Proc, String]) end
Callback fires before migration is run.
# File lib/chef/resource/deploy.rb, line 370 def before_migrate(arg=nil, &block) arg ||= block set_or_return(:before_migrate, arg, :kind_of => [Proc, String]) end
Callback fires before restart
# File lib/chef/resource/deploy.rb, line 382 def before_restart(arg=nil, &block) arg ||= block set_or_return(:before_restart, arg, :kind_of => [Proc, String]) end
Callback fires before symlinking
# File lib/chef/resource/deploy.rb, line 376 def before_symlink(arg=nil, &block) arg ||= block set_or_return(:before_symlink, arg, :kind_of => [Proc, String]) end
# File lib/chef/resource/deploy.rb, line 213 def copy_exclude(arg=nil) set_or_return( :copy_exclude, arg, :kind_of => [ String ] ) end
An array of paths, relative to your app's root, where you expect dirs to exist before symlinking. This runs after purge_before_symlink, so you can use this to recreate dirs that you had previously purged. For example, if you plan to use a shared directory for pids, and you want it to be located in $APP_ROOT/tmp/pids, you could purge tmp, then specify tmp here so that the tmp directory will exist when you symlink the pids directory in to the current release. Default: ["tmp", "public", "config"]
# File lib/chef/resource/deploy.rb, line 332 def create_dirs_before_symlink(arg=nil) set_or_return( :create_dirs_before_symlink, arg, :kind_of => Array ) end
where the deployed version of your code goes
# File lib/chef/resource/deploy.rb, line 97 def current_path @current_path ||= @deploy_to + "/current" end
note: deploy_to is your application "meta-root."
# File lib/chef/resource/deploy.rb, line 106 def deploy_to(arg=nil) set_or_return( :deploy_to, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/deploy.rb, line 101 def depth @shallow_clone ? "5" : nil end
where the checked out/cloned code goes
# File lib/chef/resource/deploy.rb, line 87 def destination @destination ||= shared_path + "/#{@repository_cache}" end
# File lib/chef/resource/deploy.rb, line 189 def enable_submodules(arg=nil) set_or_return( :enable_submodules, arg, :kind_of => [ TrueClass, FalseClass ] ) end
# File lib/chef/resource/deploy.rb, line 291 def environment(arg=nil) if arg.is_a?(String) Chef::Log.debug "Setting RAILS_ENV, RACK_ENV, and MERB_ENV to `#{arg}'" Chef::Log.warn "[DEPRECATED] please modify your deploy recipe or attributes to set the environment using a hash" arg = {"RAILS_ENV"=>arg,"MERB_ENV"=>arg,"RACK_ENV"=>arg} end set_or_return( :environment, arg, :kind_of => [ Hash ] ) end
# File lib/chef/resource/deploy.rb, line 230 def git_ssh_wrapper(arg=nil) set_or_return( :git_ssh_wrapper, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/deploy.rb, line 181 def group(arg=nil) set_or_return( :group, arg, :kind_of => [ String ] ) end
The number of old release directories to keep around after cleanup
# File lib/chef/resource/deploy.rb, line 305 def keep_releases(arg=nil) [set_or_return( :keep_releases, arg, :kind_of => [ Integer ]), 1].max end
# File lib/chef/resource/deploy.rb, line 149 def migrate(arg=nil) set_or_return( :migrate, arg, :kind_of => [ TrueClass, FalseClass ] ) end
# File lib/chef/resource/deploy.rb, line 157 def migration_command(arg=nil) set_or_return( :migration_command, arg, :kind_of => [ String ] ) end
An array of paths, relative to your app's root, to be purged from a SCM clone/checkout before symlinking. Use this to get rid of files and directories you want to be shared between releases. Default: ["log", "tmp/pids", "public/system"]
# File lib/chef/resource/deploy.rb, line 316 def purge_before_symlink(arg=nil) set_or_return( :purge_before_symlink, arg, :kind_of => Array ) end
# File lib/chef/resource/deploy.rb, line 123 def remote(arg=nil) set_or_return( :remote, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/deploy.rb, line 114 def repo(arg=nil) set_or_return( :repo, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/deploy.rb, line 205 def repository_cache(arg=nil) set_or_return( :repository_cache, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/deploy.rb, line 139 def restart_command(arg=nil, &block) arg ||= block set_or_return( :restart_command, arg, :kind_of => [ String, Proc ] ) end
# File lib/chef/resource/deploy.rb, line 221 def revision(arg=nil) set_or_return( :revision, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/deploy.rb, line 131 def role(arg=nil) set_or_return( :role, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/deploy.rb, line 165 def rollback_on_error(arg=nil) set_or_return( :rollback_on_error, arg, :kind_of => [ TrueClass, FalseClass ] ) end
# File lib/chef/resource/deploy.rb, line 270 def scm_provider(arg=nil) klass = if arg.kind_of?(String) || arg.kind_of?(Symbol) lookup_provider_constant(arg) else arg end set_or_return( :scm_provider, klass, :kind_of => [ Class ] ) end
# File lib/chef/resource/deploy.rb, line 197 def shallow_clone(arg=nil) set_or_return( :shallow_clone, arg, :kind_of => [ TrueClass, FalseClass ] ) end
# File lib/chef/resource/deploy.rb, line 255 def svn_arguments(arg=nil) set_or_return( :svn_arguments, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/deploy.rb, line 283 def svn_force_export(arg=nil) set_or_return( :svn_force_export, arg, :kind_of => [ TrueClass, FalseClass ] ) end
# File lib/chef/resource/deploy.rb, line 263 def svn_info_args(arg=nil) set_or_return( :svn_arguments, arg, :kind_of => [ String ]) end
# File lib/chef/resource/deploy.rb, line 247 def svn_password(arg=nil) set_or_return( :svn_password, arg, :kind_of => [ String ] ) end
# File lib/chef/resource/deploy.rb, line 239 def svn_username(arg=nil) set_or_return( :svn_username, arg, :kind_of => [ String ] ) end
A Hash of shared/dir/path => release/dir/path. This attribute determines which files in the shared directory get symlinked to the current release directory and where they go. Unlike map_shared_files, these are symlinked before any migration is run. For a rails/merb app, this is used to link in a known good database.yml (with the production db password) before running migrate. Default {"config/database.yml" => "config/database.yml"}
# File lib/chef/resource/deploy.rb, line 361 def symlink_before_migrate(arg=nil) set_or_return( :symlink_before_migrate, arg, :kind_of => Hash ) end
A Hash of shared/dir/path => release/dir/path. This attribute determines which files and dirs in the shared directory get symlinked to the current release directory, and where they go. If you have a directory $shared/pids that you would like to symlink as $current_release/tmp/pids you specify it as "pids" => "tmp/pids" Default {"system" => "public/system", "pids" => "tmp/pids", "log" => "log"}
# File lib/chef/resource/deploy.rb, line 346 def symlinks(arg=nil) set_or_return( :symlinks, arg, :kind_of => Hash ) end
Generated with the Darkfish Rdoc Generator 2.