mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +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_mode: script
|
||||||
dir: ../../log
|
dir: ../../tmp/pids
|
||||||
multiple: true
|
multiple: true
|
||||||
backtrace: true
|
backtrace: true
|
||||||
monitor: true
|
monitor: true
|
||||||
ontop: false
|
ontop: false
|
||||||
app_name: 'que'
|
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',
|
'public/system',
|
||||||
'export/zonefiles',
|
'export/zonefiles',
|
||||||
'import/bank_statements',
|
'import/bank_statements',
|
||||||
'import/legal_documents'
|
'import/legal_documents',
|
||||||
|
'tmp/pids'
|
||||||
]
|
]
|
||||||
|
|
||||||
# Optional settings:
|
# Optional settings:
|
||||||
|
@ -180,6 +181,9 @@ task setup: :environment do
|
||||||
queue! %(mkdir -p "#{deploy_to}/shared/import/legal_documents")
|
queue! %(mkdir -p "#{deploy_to}/shared/import/legal_documents")
|
||||||
queue! %(chmod g+rx,u+rwx "#{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")
|
queue! %(touch "#{deploy_to}/shared/config/database.yml")
|
||||||
deploy do
|
deploy do
|
||||||
invoke :'git:clone'
|
invoke :'git:clone'
|
||||||
|
@ -199,6 +203,11 @@ task deploy: :environment do
|
||||||
# instance of your project.
|
# instance of your project.
|
||||||
invoke :'git:clone'
|
invoke :'git:clone'
|
||||||
invoke :load_commit_hash
|
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 :'deploy:link_shared_paths'
|
||||||
invoke :'bundle:install'
|
invoke :'bundle:install'
|
||||||
invoke :'rails:db_migrate'
|
invoke :'rails:db_migrate'
|
||||||
|
|
|
@ -22,9 +22,15 @@ Installation at deployed server:
|
||||||
sudo /etc/init.d/que start # for manual start
|
sudo /etc/init.d/que start # for manual start
|
||||||
sudo update-rc.d que defaults # for start in server boot
|
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
|
cd /home/registry/registry/current
|
||||||
|
|
||||||
|
|
|
@ -11,38 +11,35 @@
|
||||||
set -u
|
set -u
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
#
|
### CHANGES
|
||||||
# Change these to match your server:
|
|
||||||
#
|
|
||||||
# Make sure that all paths are correct.
|
|
||||||
#
|
|
||||||
APP_HOME="/home/registry/registry"
|
APP_HOME="/home/registry/registry"
|
||||||
APP_ROOT="$APP_HOME/current"
|
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
|
RAILS_ENV=production
|
||||||
RUBY_BUNDLE_PATH=/home/$QUE_USER/.rbenv/shims/bundle
|
RUBY_BUNDLE=/home/$QUE_USER/.rbenv/shims/bundle
|
||||||
QUE_INSTANCES=1 # or as many really needed based real load
|
QUE_INSTANCES=1 # or as many really needed based on real load info
|
||||||
|
### END OF CHANGES
|
||||||
|
|
||||||
cd $APP_ROOT || exit 1
|
cd $APP_ROOT || exit 1
|
||||||
|
|
||||||
case ${1-help} in
|
case ${1-help} in
|
||||||
status)
|
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)
|
start)
|
||||||
echo "$1 que monitor and server"
|
echo "$1 que monitor and server"
|
||||||
for i in `seq 1 $QUE_INSTANCES`; do
|
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
|
cd $APP_ROOT && QUE_WORKER_COUNT=1 RAILS_ENV=$RAILS_ENV QUE_USER=$QUE_USER $RUBY_BUNDLE exec rake daemon:que:start
|
||||||
echo '.'
|
echo 'que instance started'
|
||||||
done
|
done
|
||||||
;;
|
;;
|
||||||
stop)
|
stop)
|
||||||
echo "$1 que monitor and server"
|
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)
|
restart)
|
||||||
echo "$1 que monitor and server"
|
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>"
|
echo >&2 "Usage: $0 <status|start|stop|restart>"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue