Last active
December 11, 2015 16:48
-
-
Save koenpunt/4630100 to your computer and use it in GitHub Desktop.
Capistrano recipe for foreman in production
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
set :user, "deploy" | |
set :runner, "deploy" | |
set :application, "example.com" | |
set :deploy_to, "/var/apps/#{application}" | |
set :shared_children, %w(sockets) | |
set :scm, :git | |
set :repository, "git@github.com:example.git" | |
set :deploy_via, :remote_cache | |
set :ssh_options, { :forward_agent => true } | |
server "example.com", :app, :web, :db, :primary => true | |
# if you want to clean up old releases on each deploy uncomment this: | |
after "deploy:restart", "deploy:cleanup" | |
after "deploy:restart", "foreman:restart" | |
after "deploy:update", "foreman:export" | |
after "deploy:update", "foreman:restart" | |
namespace :foreman do | |
desc "Export the Procfile to Ubuntu's upstart scripts" | |
task :export, :roles => :app do | |
invoke_command "sh -c 'cd #{release_path} && bundle exec foreman export upstart /etc/init -a #{application} -u #{user} -l #{shared_path}/log'", :via => run_method | |
end | |
desc "Start the application services" | |
task :start, :roles => :app do | |
invoke_command "service #{application} start", :via => run_method | |
end | |
desc "Stop the application services" | |
task :stop, :roles => :app do | |
invoke_command "service #{application} stop", :via => run_method | |
end | |
desc "Restart the application services" | |
task :restart, :roles => :app do | |
invoke_command "service #{application} restart", :via => run_method | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment