mirror of
https://github.com/internetee/registry.git
synced 2025-05-16 17:37:17 +02:00
Que inits script sudo friendly, pid files moved to tmp/pids #2724
This commit is contained in:
parent
9d22212acd
commit
463df1f406
4 changed files with 31 additions and 17 deletions
|
@ -1,7 +1,9 @@
|
|||
dir_mode: script
|
||||
dir: ../../log
|
||||
dir: ../../tmp/pids
|
||||
multiple: true
|
||||
backtrace: true
|
||||
monitor: true
|
||||
ontop: false
|
||||
app_name: 'que'
|
||||
user: <%= ENV['QUE_USER'] || 'registry' %>
|
||||
group: <%= ENV['QUE_GROUP'] || ENV['QUE_USER'] || 'registry' %>
|
||||
|
|
|
@ -138,7 +138,8 @@ set :shared_paths, [
|
|||
'public/system',
|
||||
'export/zonefiles',
|
||||
'import/bank_statements',
|
||||
'import/legal_documents'
|
||||
'import/legal_documents',
|
||||
'tmp/pids'
|
||||
]
|
||||
|
||||
# Optional settings:
|
||||
|
@ -180,6 +181,9 @@ task setup: :environment do
|
|||
queue! %(mkdir -p "#{deploy_to}/shared/import/legal_documents")
|
||||
queue! %(chmod g+rx,u+rwx "#{deploy_to}/shared/import/legal_documents")
|
||||
|
||||
queue! %(mkdir -p "#{deploy_to}/shared/tmp/pids")
|
||||
queue! %(chmod g+rx,u+rwx "#{deploy_to}/shared/tmp/pids")
|
||||
|
||||
queue! %(touch "#{deploy_to}/shared/config/database.yml")
|
||||
deploy do
|
||||
invoke :'git:clone'
|
||||
|
@ -199,6 +203,11 @@ task deploy: :environment do
|
|||
# instance of your project.
|
||||
invoke :'git:clone'
|
||||
invoke :load_commit_hash
|
||||
|
||||
# TEMP until all servers are updated
|
||||
queue! %(mkdir -p "#{deploy_to}/shared/tmp/pids")
|
||||
queue! %(chmod g+rx,u+rwx "#{deploy_to}/shared/tmp/pids")
|
||||
|
||||
invoke :'deploy:link_shared_paths'
|
||||
invoke :'bundle:install'
|
||||
invoke :'rails:db_migrate'
|
||||
|
|
|
@ -22,9 +22,15 @@ Installation at deployed server:
|
|||
sudo /etc/init.d/que start # for manual start
|
||||
sudo update-rc.d que defaults # for start in server boot
|
||||
|
||||
# Debugging
|
||||
PID files
|
||||
---------
|
||||
|
||||
You can run que manually as well:
|
||||
All pid files are at tmp/pids directory.
|
||||
|
||||
Debugging
|
||||
---------
|
||||
|
||||
You can run que manually as well for debugging:
|
||||
|
||||
cd /home/registry/registry/current
|
||||
|
||||
|
|
|
@ -11,38 +11,35 @@
|
|||
set -u
|
||||
set -e
|
||||
|
||||
#
|
||||
# Change these to match your server:
|
||||
#
|
||||
# Make sure that all paths are correct.
|
||||
#
|
||||
### CHANGES
|
||||
APP_HOME="/home/registry/registry"
|
||||
APP_ROOT="$APP_HOME/current"
|
||||
QUE_USER=registry # or use some other unprivileged system user
|
||||
QUE_USER=registry # or use some other unprivileged OS user what your registry servers uses
|
||||
RAILS_ENV=production
|
||||
RUBY_BUNDLE_PATH=/home/$QUE_USER/.rbenv/shims/bundle
|
||||
QUE_INSTANCES=1 # or as many really needed based real load
|
||||
RUBY_BUNDLE=/home/$QUE_USER/.rbenv/shims/bundle
|
||||
QUE_INSTANCES=1 # or as many really needed based on real load info
|
||||
### END OF CHANGES
|
||||
|
||||
cd $APP_ROOT || exit 1
|
||||
|
||||
case ${1-help} in
|
||||
status)
|
||||
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec lib/daemons/que_ctl status
|
||||
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE exec lib/daemons/que_ctl status
|
||||
;;
|
||||
start)
|
||||
echo "$1 que monitor and server"
|
||||
for i in `seq 1 $QUE_INSTANCES`; do
|
||||
cd $APP_ROOT && QUE_WORKER_COUNT=1 RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec rake daemon:que:start
|
||||
echo '.'
|
||||
cd $APP_ROOT && QUE_WORKER_COUNT=1 RAILS_ENV=$RAILS_ENV QUE_USER=$QUE_USER $RUBY_BUNDLE exec rake daemon:que:start
|
||||
echo 'que instance started'
|
||||
done
|
||||
;;
|
||||
stop)
|
||||
echo "$1 que monitor and server"
|
||||
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec lib/daemons/que_ctl stop
|
||||
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE exec lib/daemons/que_ctl stop
|
||||
;;
|
||||
restart)
|
||||
echo "$1 que monitor and server"
|
||||
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV $RUBY_BUNDLE_PATH exec rake daemon:que:restart
|
||||
cd $APP_ROOT && RAILS_ENV=$RAILS_ENV QUE_USER=$QUE_USER $RUBY_BUNDLE exec rake daemon:que:restart
|
||||
;;
|
||||
*)
|
||||
echo >&2 "Usage: $0 <status|start|stop|restart>"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue