1
0
Fork 0
mirror of https://github.com/capistrano/capistrano synced 2023-03-27 23:21:18 -04:00

switchtower: add :restart_via variable for specifying whether restart ought to use :sudo (default, use sudo)

git-svn-id: http://svn.rubyonrails.org/rails/tools/switchtower@3355 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
Jamis Buck 2005-12-27 01:50:23 +00:00
parent d147be1026
commit 527a881f95
3 changed files with 20 additions and 8 deletions

View file

@ -1,5 +1,9 @@
*SVN*
* Add :restart_via variable for specifying whether restart ought to use :sudo (default, use sudo)
* Use SFTP for file transfers (if available).
* Add an "update_current" task that will do an svn up on the current release
* Use the :checkout variable to determine what operation to use for svn checkouts (instead of co, like "export").

View file

@ -66,6 +66,7 @@ module SwitchTower
def initialize(name, options)
@name, @options = name, options
@servers = nil
end
# Returns the list of servers (_not_ connections to servers) that are
@ -110,7 +111,7 @@ module SwitchTower
logger.trace "executing task #{name}"
begin
push_task_call_frame name
result = instance_eval &block
result = instance_eval(&block)
ensure
pop_task_call_frame
end

View file

@ -4,12 +4,18 @@
# application servers.
# * The :web role has been defined as the set of machines consisting of the
# web servers.
# * The Rails spinner and reaper scripts are being used to manage the FCGI
# * The :db role has been defined as the set of machines consisting of the
# databases, with exactly one set up as the :primary DB server.
# * The Rails spawner and reaper scripts are being used to manage the FCGI
# processes.
# * There is a script in script/ called "reap" that restarts the FCGI processes
set :rake, "rake"
set :migrate_target, :current
set :migrate_env, ""
set :restart_via, :sudo
desc "Enumerate and describe every available task."
task :show_tasks do
keys = tasks.keys.sort_by { |a| a.to_s }
@ -91,14 +97,15 @@ task :symlink, :roles => [:app, :db, :web] do
run "ln -nfs #{current_release} #{current_path}"
end
desc "Restart the FCGI processes on the app server."
desc <<-DESC
Restart the FCGI processes on the app server. This uses the :restart_via
variable to determine whether to use sudo or not. By default, :restart_via is
set to :sudo, but you can set it to :run if you are in a shared environment.
DESC
task :restart, :roles => :app do
sudo "#{current_path}/script/process/reaper"
send(restart_via, "#{current_path}/script/process/reaper")
end
set :migrate_target, :current
set :migrate_env, ""
desc <<-DESC
Run the migrate rake task. By default, it runs this in the version of the app
indicated by the 'current' symlink. (This means you should not invoke this task