Created
August 30, 2013 15:09
-
-
Save jamescook/6390856 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
diff --git a/Procfile b/Procfile | |
new file mode 100644 | |
index 0000000..125d0f9 | |
--- /dev/null | |
+++ b/Procfile | |
@@ -0,0 +1 @@ | |
+unicorn: exec bundle exec unicorn_rails -c config/unicorn.rb -D | |
diff --git a/config/deploy.rb b/config/deploy.rb | |
index 180bf39..2a77bb7 100644 | |
--- a/config/deploy.rb | |
+++ b/config/deploy.rb | |
@@ -48,6 +48,39 @@ default_run_options[:pty] = true | |
default_run_options[:shell] = 'bash' | |
before "deploy:fix_releases", "deploy:create_release_dir" | |
+after 'deploy:update', 'foreman:restart' | |
+after 'deploy', 'rvm:trust_rvmrc' | |
+before 'foreman:export', 'rvm:trust_rvmrc' | |
+ | |
+namespace :foreman do | |
+ desc "Export the Procfile to Ubuntu's upstart scripts" | |
+ task :export, roles: :app do | |
+ run "cd #{current_path} && rvmsudo bundle exec foreman export upstart /etc/init " + | |
+ "-f ./Procfile -a #{application} -u #{user} -l #{shared_path}/log -d #{current_path}" | |
+ end | |
+ | |
+ desc "Start the application services" | |
+ task :start, roles: :app do | |
+ run "#{sudo} start #{application}" | |
+ end | |
+ | |
+ desc "Stop the application services" | |
+ task :stop, roles: :app do | |
+ run "#{sudo} stop #{application}" | |
+ end | |
+ | |
+ desc "Restart the application services" | |
+ task :restart, roles: :app do | |
+ run "#{sudo} restart #{application} || #{sudo} start #{application}" | |
+ end | |
+end | |
+ | |
+namespace :rvm do | |
+ task :trust_rvmrc do | |
+ run "rvm rvmrc trust #{release_path}" | |
+ end | |
+end | |
+ | |
namespace :deploy do | |
desc "Fixes releases" | |
task :fix_releases do |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment