Skip to content

Instantly share code, notes, and snippets.

@masone
Created March 23, 2012 09:53
Show Gist options
  • Save masone/2169133 to your computer and use it in GitHub Desktop.
Save masone/2169133 to your computer and use it in GitHub Desktop.
foreman capistrano
after 'deploy:update_code', 'foreman:export'
after 'deploy:update_code', 'foreman:restart'
namespace :foreman do
desc "Start the application services"
task :start, :roles => [:web], :except => {:no_release => true} do
run "sudo start #{host}"
end
desc "Stop the application services"
task :stop, :roles => [:web], :except => {:no_release => true} do
run "sudo stop #{host}"
end
desc "Restart the application services"
task :restart, :roles => [:web], :except => {:no_release => true} do
run "sudo start #{host} || sudo restart #{host}"
end
desc "Export the Procfile to upstart scripts"
task :export, :roles => [:web], :except => {:no_release => true} do
run "cd #{release_path} &&
sudo bundle exec foreman export upstart /etc/init
-a #{host}
-u #{user}
-l #{shared_path}/log
-p #{foreman_base_port}
-b
-c worker=#{worker_processes},web=1,clock=1" # no spaces between commas!
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment