Created
July 21, 2012 16:36
-
-
Save malditogeek/3156358 to your computer and use it in GitHub Desktop.
Goliath + HAProxy deploy recipe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
after "deploy:update", "deploy:cleanup" | |
after "deploy:update", "foreman:export" | |
after "deploy:symlink", "update_haproxy_config_symlink" | |
namespace :deploy do | |
task :stop do | |
run "sudo stop goliath_app" | |
end | |
task :start do | |
run "sudo start goliath_app" | |
end | |
task :restart do | |
run "sudo start goliath_app || sudo restart goliath_app" | |
end | |
end | |
namespace :foreman do | |
desc "Export the Procfile to Ubuntu's upstart scripts" | |
task :export do | |
run "cd #{release_path} && sudo bundle exec foreman export upstart /etc/init -p 10000 -t config/upstart -a goliath_app -c server=4 -u deploy -l #{shared_path}/log" | |
end | |
desc "Start the application services" | |
task :start do | |
sudo "start goliath_app" | |
end | |
desc "Stop the application services" | |
task :stop do | |
sudo "stop goliath_app" | |
end | |
end | |
task :update_haproxy_config_symlink do | |
run "#{sudo} rm -f /etc/haproxy/haproxy.cfg" | |
run "#{sudo} ln -s #{release_path}/config/haproxy.cfg /etc/haproxy/haproxy.cfg" | |
run "#{sudo} /etc/init.d/haproxy reload" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment