Skip to content

Instantly share code, notes, and snippets.

@malditogeek
Created July 21, 2012 16:36
Show Gist options
  • Save malditogeek/3156358 to your computer and use it in GitHub Desktop.
Save malditogeek/3156358 to your computer and use it in GitHub Desktop.
Goliath + HAProxy deploy recipe
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