Merge branch 'master' of github.com:domify/registry

This commit is contained in:
Martin Lensment 2015-07-20 15:12:38 +03:00
commit d62a5d5b9b
23 changed files with 844 additions and 142 deletions

View file

@ -1,7 +1,9 @@
dir_mode: script
dir: ../../log
dir: ../../log/que
multiple: true
backtrace: true
monitor: true
ontop: false
app_name: 'que'
user: <%= ENV['QUE_USER'] || 'registry' %>
group: <%= ENV['QUE_GROUP'] || ENV['QUE_USER'] || 'registry' %>

View file

@ -21,3 +21,20 @@ api_log_test:
registrant_write_test:
<<: *default
database: registry_test
# only for testing assets
production:
<<: *default
database: registry_test
whois_test:
<<: *default
database: registry_whois_test
api_log_test:
<<: *default
database: registry_api_log_test
registrant_write_test:
<<: *default
database: registry_test

View file

@ -11,7 +11,7 @@ require 'mina/rbenv' # for rbenv support. (http://rbenv.org)
# branch - Branch name to deploy. (needed by mina/git)
# alpha branch, all interfaces unified
set :domain, 'registry-st'
set :domain, 'registry'
set :deploy_to, '$HOME/registry'
set :repository, 'https://github.com/domify/registry' # dev repo
set :branch, 'master'
@ -20,7 +20,7 @@ set :que_restart, true
# alpha branch, only use for heavy debugging
task :epp do
set :domain, 'registry-st'
set :domain, 'registry'
set :deploy_to, '$HOME/epp'
set :repository, 'https://github.com/domify/registry' # dev repo
set :branch, 'master'
@ -30,7 +30,7 @@ end
# alpha branch, only use for heavy debugging
task :registrar do
set :domain, 'registry-st'
set :domain, 'registry'
set :deploy_to, '$HOME/registrar'
set :repository, 'https://github.com/domify/registry' # dev repo
set :branch, 'master'
@ -40,7 +40,7 @@ end
# alpha branch, only use for heavy debugging
task :registrant do
set :domain, 'registry-st'
set :domain, 'registryt'
set :deploy_to, '$HOME/registrant'
set :repository, 'https://github.com/domify/registry' # dev repo
set :branch, 'master'
@ -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/log/que")
queue! %(chmod g+rx,u+rwx "#{deploy_to}/shared/log/que")
queue! %(touch "#{deploy_to}/shared/config/database.yml")
deploy do
invoke :'git:clone'
@ -199,13 +203,18 @@ 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/log/que")
queue! %(chmod g+rx,u+rwx "#{deploy_to}/shared/log/que")
invoke :'deploy:link_shared_paths'
invoke :'bundle:install'
invoke :'rails:db_migrate'
to :launch do
invoke :restart
invoke :'deploy:cleanup'
queue! "QUE_WORKER_COUNT=1 #{rake} daemon:que:restart" if que_restart
invoke :que_restart if que_restart
end
end
end
@ -236,6 +245,11 @@ task restart: :environment do
queue "mkdir -p #{deploy_to}/current/tmp; touch #{deploy_to}/current/tmp/restart.txt"
end
desc 'Restart que server'
task que_restart: :environment do
queue "/etc/init.d/que restart"
end
namespace :cron do
desc 'Setup cron tasks.'
task setup: :environment do

View file

@ -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 log/que directory.
Debugging
---------
You can run que manually as well for debugging:
cd /home/registry/registry/current

View file

@ -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 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>"

View file

@ -19,14 +19,14 @@ end
Que.logger.level = Logger.const_get((ENV['QUE_LOG_LEVEL'] || 'INFO').upcase)
Que.worker_count = 1
Que.wake_interval = (ENV['QUE_WAKE_INTERVAL'] || 0.1).to_f
Que.wake_interval = (ENV['QUE_WAKE_INTERVAL'] || 1).to_f
Que.mode = :async
# When changing how signals are caught, be sure to test the behavior with
# the rake task in tasks/safe_shutdown.rb.
stop = false
%w( INT TERM ).each do |signal|
%w( INT ).each do |signal|
trap(signal) { stop = true }
end
@ -38,6 +38,6 @@ at_exit do
end
loop do
sleep 0.01
sleep 1
break if stop
end

View file

@ -12,3 +12,7 @@ namespace :assets do
end
end
end
task as: :environment do
system('RAILS_ENV=production rake assets:precompile')
end

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -2319,8 +2319,6 @@ describe 'EPP Domain', epp: true do
it 'does not renew domain with invalid period' do
Setting.days_to_renew_domain_before_expire = 0
old_balance = @registrar1.balance
old_activities = @registrar1.cash_account.account_activities.count
exp_date = domain.valid_to
xml = @epp_xml.domain.renew(