Skip to content

Commit

Permalink
Remove DReSA-specific production config
Browse files Browse the repository at this point in the history
  • Loading branch information
fbacall committed Jul 19, 2022
1 parent 5cbd4dd commit 144c2f8
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 252 deletions.
13 changes: 4 additions & 9 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,6 @@ source 'https://rails-assets.org' do
gem 'rails-assets-moment', '~> 2.15.0'
end

group :test do
gem 'fakeredis', git: 'https://github.com/artygus/fakeredis/', ref: 'f68bd4f'
gem 'minitest', '5.14.4'
gem 'rails-controller-testing'
end

group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
Expand All @@ -189,7 +183,8 @@ group :development do
gem 'binding_of_caller'
end

group :production do
gem 'unicorn'
gem 'passenger'
group :test do
gem 'fakeredis', git: 'https://github.com/artygus/fakeredis/', ref: 'f68bd4f'
gem 'minitest', '5.14.4'
gem 'rails-controller-testing'
end
10 changes: 0 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ GEM
activerecord
kaminari-core (= 1.2.1)
kaminari-core (1.2.1)
kgio (2.11.4)
kt-paperclip (7.0.1)
activemodel (>= 4.2.0)
activesupport (>= 4.2.0)
Expand Down Expand Up @@ -411,9 +410,6 @@ GEM
parallel (1.21.0)
parser (3.0.3.1)
ast (~> 2.4.1)
passenger (6.0.12)
rack
rake (>= 0.8.1)
pg (1.2.3)
pr_geohash (1.0.0)
private_address_check (0.5.0)
Expand Down Expand Up @@ -488,7 +484,6 @@ GEM
rake (>= 12.2)
thor (~> 1.0)
rainbow (3.0.0)
raindrops (0.20.0)
rake (13.0.6)
rb-fsevent (0.11.0)
rb-inotify (0.10.1)
Expand Down Expand Up @@ -698,9 +693,6 @@ GEM
unicode-display_width (2.1.0)
unicode-types (1.7.0)
unicode_utils (1.4.0)
unicorn (6.1.0)
kgio (~> 2.6)
raindrops (~> 0.7)
validate_email (0.1.6)
activemodel (>= 3.0)
mail (>= 2.2.5)
Expand Down Expand Up @@ -774,7 +766,6 @@ DEPENDENCIES
money-rails
omniauth-rails_csrf_protection
omniauth_openid_connect
passenger
pg
private_address_check
progress_bar (~> 1.1.0)
Expand Down Expand Up @@ -813,7 +804,6 @@ DEPENDENCIES
tzinfo
tzinfo-data
uglifier (>= 1.3.0)
unicorn
validate_url (~> 1.0.2)
web-console
webmock (~> 3.4.2)
Expand Down
31 changes: 0 additions & 31 deletions config/logrotate.conf
Original file line number Diff line number Diff line change
@@ -1,35 +1,4 @@
# configuration for logrotate

"shared/log/logrotate.log" {
monthly
size 10M
missingok
notifempty
rotate 3
copytruncate
}

"shared/log/cron.log" {
weekly
size 10M
missingok
notifempty
rotate 4
copytruncate
}

"shared/log/unicorn.*.log" {
daily
size 50M
missingok
notifempty
rotate 3
compress
delaycompress
copytruncate
nodateext
}

"log/*.log" {
daily
size 50M
Expand Down
6 changes: 0 additions & 6 deletions config/schedule.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,3 @@ subscriptions:
ingestions:
every: day
at: '3am'
backups:
every: saturday
at: '12:30am'
logrotate:
every: day
at: '11pm'
36 changes: 0 additions & 36 deletions config/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,6 @@
schedules ||= {}
end

# check input parameters
set(:db_user, 'tess_user') if !defined?(db_user)
set :db_name, "tess_#{environment}"
set :bkup_script, "#{path}/scripts/pgsql_backup.sh"
set :bkup_folder, "#{path}/shared/backups"

# set log file
FileUtils.mkdir_p("#{path}/shared/log")
set :log_folder, "#{path}/shared/log"
FileUtils.touch("#{log_folder}/cron.log")
unless ENV["RAILS_LOG_TO_STDOUT"]
set :output, "#{log_folder}/cron.log"
end

# Generate a new sitemap...
if !schedules['sitemap'].nil?
every :"#{schedules['sitemap']['every']}", at: "#{schedules['sitemap']['at']}" do
Expand Down Expand Up @@ -60,25 +46,3 @@
rake "tess:automated_ingestion"
end
end

# run database backups
if !schedules['backups'].nil?
every :"#{schedules['backups']['every']}", at: "#{schedules['backups']['at']}" do
command "#{bkup_script} #{db_user} #{db_name} #{bkup_folder} --exclude-schema=audit"
end
else
every :saturday, at: '12:30am' do
command "#{bkup_script} #{db_user} #{db_name} #{bkup_folder} --exclude-schema=audit"
end
end

# run log rotation
if !schedules['logrotate'].nil?
every :"#{schedules['logrotate']['every']}", at: "#{schedules['logrotate']['at']}" do
command "/usr/sbin/logrotate -f #{path}/config/logrotate.conf -s #{log_folder}/logrotate.log"
end
else
every :day, at: '11pm' do
command "/usr/sbin/logrotate -f #{path}/config/logrotate.conf -s #{log_folder}/logrotate.log"
end
end
20 changes: 0 additions & 20 deletions config/unicorn.rb

This file was deleted.

43 changes: 0 additions & 43 deletions scripts/pgsql_backup.sh

This file was deleted.

50 changes: 0 additions & 50 deletions scripts/pgsql_restore.sh

This file was deleted.

29 changes: 29 additions & 0 deletions scripts/update_tess.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

# echo "Usage: update.sh <development | production>"
# exit 0
if [ -z $1 ]
then
ENV=$1
else
ENV="development"
fi

export RAILS_ENV=$ENV

# rebuild rails environment
git pull
bundle install --deployment
bundle exec rake db:migrate
bundle exec rake sunspot:solr:reindex
bundle exec rake assets:cleans
bundle exec rake assets:precompile
bundle exec rake tmp:clear
# update scheduled tasks
whenever --update-crontab --set environment="$ENV"

# restart services
touch tmp/restart.txt
pkill -f sidekiq
bundle exec sidekiq -d -e "$ENV" -L /tmp/sidekiq.log

47 changes: 0 additions & 47 deletions update_tess.sh

This file was deleted.

0 comments on commit 144c2f8

Please sign in to comment.