Redo autostart script to start from user. Write doc. Refactor bluepill capistrano recipe. Refs #1

This commit is contained in:
Pavel Chipiga 2011-12-14 22:16:00 +02:00
parent 697e9df87e
commit e7bf100806
3 changed files with 19 additions and 9 deletions

View File

@ -2,7 +2,7 @@
for f in `ls /srv` for f in `ls /srv`
do do
sudo -u rosa APP_NAME=$f bundle exec bluepill --no-privileged load /srv/$f/current/config/production.pill su -l rosa -c "cd /srv/$f/current && APP_NAME=$f bundle exec bluepill --no-privileged load /srv/$f/current/config/production.pill"
done done
/srv/rosa_build/current/bin/mount_downloads.sh /srv/rosa_build/current/bin/mount_downloads.sh

View File

@ -1,3 +1,8 @@
=== Basic bootstrap === Basic bootstrap
* rake db:drop db:setup * rake db:drop db:setup
== ==
=== Setup autostart
Add to /etc/rc.d/rc.local following /srv/rosa_build/current/bin/autostart.sh
==

View File

@ -2,20 +2,25 @@ Capistrano::Configuration.instance(:must_exist).load do
namespace :bluepill do namespace :bluepill do
set(:bluepill_binary) {"APP_NAME=#{fetch :application} bundle exec bluepill --no-privileged"} set(:bluepill_binary) {"APP_NAME=#{fetch :application} bundle exec 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"
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} quit"
end
desc "Load bluepill configuration and start it" desc "Load bluepill configuration and start it"
task :start, :roles => [:app] do task :start, :roles => [:app] do
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} load config/production.pill" run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} load config/production.pill"
end end
desc "Stop processes that bluepill is monitoring"
task :stop, :roles => [:app], :on_error => :continue do
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} stop"
end
task :restart, :roles => [:app] do task :restart, :roles => [:app] do
quit # run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} restart #{fetch :application}"
start stop; start
end
desc "Stop processes that bluepill is monitoring and quit bluepill"
task :quit, :roles => [:app] do
# stop
run "cd #{fetch :current_path} && #{try_sudo} #{bluepill_binary} quit"
end end
desc "Prints bluepills monitored processes statuses" desc "Prints bluepills monitored processes statuses"