Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

make deploy:cleanup work with multi-host configuration #107

Merged
merged 1 commit into from

4 participants

@leehambley leehambley merged commit 77663c5 into from
@cgriego

Why was the :roles option added to this task? We have custom roles with our app code that now are not cleaned. If you have custom roles that do not have app code, then you should be using the :no_release => true option on the server/role definition.

@ppg

I agree with cgriego. The easiest example is that of a background role for processing jobs. The common case would be to intend to deploy and clean releases to that role/machine as it will need to execute code there also. With this change my background role will never be cleaned up and there's no way for me to change that configuration. If i have a role that doesn't need my code base (such as :im) then I should be using :no_release, which already skips deploy and cleanup; is there something missing from that functionality?

Thanks,
\Peter

@philrosenstein

have taken :roles back out of :cleanup task #112 (sorry for the confusion)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 5 deletions.
  1. +5 −5 lib/capistrano/recipes/deploy.rb
View
10 lib/capistrano/recipes/deploy.rb
@@ -409,14 +409,14 @@ def try_runner(*args)
will use sudo to clean up the old releases, but if sudo is not available \
for your environment, set the :use_sudo variable to false instead.
DESC
- task :cleanup, :except => { :no_release => true } do
+ task :cleanup, :roles => [:app, :web, :db], :except => { :no_release => true } do
count = fetch(:keep_releases, 5).to_i
- if count >= releases.length
+ local_releases = capture("ls -xt #{releases_path}").split.reverse
+ if count >= local_releases.length
logger.important "no old releases to clean up"
else
- logger.info "keeping #{count} of #{releases.length} deployed releases"
-
- directories = (releases - releases.last(count)).map { |release|
+ logger.info "keeping #{count} of #{local_releases.length} deployed releases"
+ directories = (local_releases - local_releases.last(count)).map { |release|
File.join(releases_path, release) }.join(" ")
try_sudo "rm -rf #{directories}"
Something went wrong with that request. Please try again.