Skip to content

Commit

Permalink
Merge pull request apache#39 from Shopify/capistrano_does_Cleanup
Browse files Browse the repository at this point in the history
add cleanup task.... capistrano should have this by default, yet here we...
  • Loading branch information
orenmazor committed Dec 18, 2014
2 parents 127cc60 + ffb68f9 commit 8d58081
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Capfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ set :keep_releases, 5

MAINTENANCE = (11..15).map {|i| "dn%02d.chi.shopify.com" % i } # Node is up but should not be part of the production cluster
LOAD_TESTING = (42..44).map {|i| "dn%02d.chi.shopify.com" % i }
DECOMISSIONED = ["dn37.chi.shopify.com", "dn40.chi.shopify.com"] # Node is down don't try to send code
DECOMISSIONED = ["dn37.chi.shopify.com", "dn40.chi.shopify.com", "dn09.chi.shopify.com", "dn46.chi.shopify.com", "dn17.chi.shopify.com"] # Node is down don't try to send code
BROKEN = MAINTENANCE + DECOMISSIONED

task :production do
Expand All @@ -34,6 +34,11 @@ task :staging do
end

namespace :deploy do
task :cleanup do
count = fetch(:keep_releases, 5).to_i
run "ls -1dt /u/apps/spark/releases/* | tail -n +#{count + 1} | xargs rm -rf"
end

task :upload_to_hdfs, :roles => :uploader, :on_no_matching_servers => :continue do
run "hdfs dfs -copyFromLocal -f /u/apps/spark/current/lib/spark-assembly-1.3.0-SNAPSHOT-hadoop2.5.0.jar hdfs://nn01.chi.shopify.com/user/sparkles/spark-assembly-#{`git rev-parse master`.gsub(/\s/,'')}.jar"
end
Expand Down Expand Up @@ -65,4 +70,5 @@ namespace :deploy do
before 'deploy:symlink_current', 'deploy:symlink_shared'
before 'deploy:restart', 'deploy:restart_master', 'deploy:restart_history'
after 'deploy:download', 'deploy:upload_to_hdfs'
after 'deploy:restart', 'deploy:cleanup'
end
43 changes: 43 additions & 0 deletions boxes
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
dn30.chi.shopify.com 5
dn14.chi.shopify.com 5
dn38.chi.shopify.com 5
dn47.chi.shopify.com 5
dn32.chi.shopify.com 5
dn45.chi.shopify.com 5
dn31.chi.shopify.com 5
dn27.chi.shopify.com 5
dn33.chi.shopify.com 5
reports-reportify-etl2.chi.shopify.com 25
data-app.chi.shopify.com 0
dn13.chi.shopify.com 5
dn25.chi.shopify.com 5
dn03.chi.shopify.com 5
dn15.chi.shopify.com 5
dn24.chi.shopify.com 5
dn26.chi.shopify.com 5
dn20.chi.shopify.com 5
dn21.chi.shopify.com 5
dn10.chi.shopify.com 5
dn08.chi.shopify.com 5
dn04.chi.shopify.com 5
platfora2.chi.shopify.com 5
dn05.chi.shopify.com 5
dn23.chi.shopify.com 5
dn28.chi.shopify.com 5
dn19.chi.shopify.com 5
dn06.chi.shopify.com 5
dn34.chi.shopify.com 5
spark-etl1.chi.shopify.com 5
hadoop-rm.chi.shopify.com 10
dn18.chi.shopify.com 5
dn16.chi.shopify.com 5
dn02.chi.shopify.com 5
dn29.chi.shopify.com 5
dn36.chi.shopify.com 5
dn35.chi.shopify.com 5
dn11.chi.shopify.com 5
dn22.chi.shopify.com 5
dn39.chi.shopify.com 5
dn07.chi.shopify.com 5
dn12.chi.shopify.com 5
dn41.chi.shopify.com 5

0 comments on commit 8d58081

Please sign in to comment.