Skip to content

Commit

Permalink
Merge pull request nesquena#8 from demandchain/master-deprovision
Browse files Browse the repository at this point in the history
Master deprovision
  • Loading branch information
Donovan Bray committed Aug 9, 2013
2 parents b749346 + a9ef0a4 commit 0afab59
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/cap_recipes/tasks/nginx_unicorn/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@

desc "Watch Nginx and Unicorn Workers with GOD"
task :setup_god, :roles => :app do
god.upload nginx_unicorn_god_path, "nginx_unicorn.god"
god.upload nginx_unicorn_god_path, "#{nginx_unicorn_init_d}.god"
# disable init from automatically starting and stopping these init controlled apps
# god will be started by init, and in turn start these god controlled apps.
# but leave the init script in place to be called manually
Expand All @@ -148,6 +148,12 @@
enable
end

desc "remove the application conf"
task :deconfigure, :roles => :app do
disable
sudo "rm -rf #{nginx_unicorn_conf_dir}/sites-available/#{application}.conf"
end

desc "Enable the application conf"
task :enable, :roles => :app do
sudo "ln -sf #{nginx_unicorn_conf_dir}/sites-available/#{application}.conf #{nginx_unicorn_conf_dir}/sites-enabled/#{application}.conf"
Expand Down
6 changes: 6 additions & 0 deletions lib/cap_recipes/tasks/unicorn/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,11 @@
run "cd #{latest_release}; [ -f tmp/pids/unicorn.pid ] && kill -USR2 `cat tmp/pids/unicorn.pid` || #{base_ruby_path}/bin/unicorn_rails -c config/unicorn.rb -E #{rails_env} -D"
end

task :deprovision, :roles => :app do
unicorn.stop
god.remove "#{unicorn_init_name}.god"
god.restart
end

end
end

0 comments on commit 0afab59

Please sign in to comment.