Created
March 19, 2015 15:00
-
-
Save cbilgili/7989ea3d047bf2e1a6b0 to your computer and use it in GitHub Desktop.
Foreman unicorn upstart rbenv
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 :unicorn_port, 5087 | |
namespace :foreman do | |
desc "Export the Procfile to Ubuntu's upstart scripts" | |
task :export do | |
on roles(:app) do | |
within current_path do | |
execute :rbenv, :sudo, "foreman export upstart /etc/init --procfile=./Procfile -a #{fetch(:application)} -p #{fetch(:unicorn_port)} -u #{fetch(:user)} -l #{shared_path}/log" | |
end | |
end | |
end | |
desc "Start the application services" | |
task :start do | |
on roles(:app) do | |
as :root do | |
within current_path do | |
execute :rbenv, :sudo, "start #{fetch(:application)}" | |
end | |
end | |
end | |
end | |
desc "Stop the application services" | |
task :stop do | |
on roles(:app) do | |
as :root do | |
within current_path do | |
execute :rbenv, :sudo, "stop #{fetch(:application)}" | |
end | |
end | |
end | |
end | |
desc "Restart the application services" | |
task :restart do | |
on roles(:app) do | |
as :root do | |
within current_path do | |
execute :rbenv, :sudo, "start #{fetch(:application)} || restart #{fetch(:application)}" | |
end | |
end | |
end | |
end | |
end | |
after "deploy:publishing", "foreman:export" | |
after "deploy:publishing", "foreman:restart" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment