diff --git a/bin/autostart.sh b/bin/autostart.sh index 7848951ad..e01ae9204 100755 --- a/bin/autostart.sh +++ b/bin/autostart.sh @@ -2,7 +2,7 @@ for f in `ls /srv` do - sudo -u rosa bundle exec bluepill --no-privileged load /srv/$f/current/config/production.pill APP_NAME=$f + sudo -u rosa bundle exec APP_NAME=$f bluepill --no-privileged load /srv/$f/current/config/production.pill done /srv/rosa_build/current/bin/mount_downloads.sh diff --git a/config/production.pill b/config/production.pill index d700694c7..7ef1af2d6 100644 --- a/config/production.pill +++ b/config/production.pill @@ -1,6 +1,6 @@ #! /usr/bin/env ruby -app_name = ENV['APP_NAME'] rescue 'rosa_build' +app_name = ENV['APP_NAME'] || 'rosa_build' Bluepill.application(app_name) do |app| app.uid = app.gid = 'rosa' app.working_dir = "/srv/#{app_name}/current" diff --git a/lib/recipes/bluepill.rb b/lib/recipes/bluepill.rb index 9f57e3bd0..9d29618c9 100644 --- a/lib/recipes/bluepill.rb +++ b/lib/recipes/bluepill.rb @@ -1,21 +1,21 @@ Capistrano::Configuration.instance(:must_exist).load do namespace :bluepill do - set :bluepill_binary, "bundle exec bluepill --no-privileged" + set :bluepill_binary, "bundle exec APP_NAME=#{fetch :application} bluepill --no-privileged" desc "Stop processes that bluepill is monitoring and quit bluepill" task :quit, :roles => [:app], :on_error => :continue do - run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} stop APP_NAME=#{fetch :application}" - run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} quit APP_NAME=#{fetch :application}" + run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} stop" + run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} quit" end desc "Load bluepill configuration and start it" task :start, :roles => [:app] do - run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} load config/production.pill APP_NAME=#{fetch :application}" + run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} load config/production.pill" end desc "Prints bluepills monitored processes statuses" task :status, :roles => [:app] do - run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} status APP_NAME=#{fetch :application}" + run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} status" end end end