How to wipe all content in Scholar@UC (dev & qa) - uclibs/ucrate GitHub Wiki
- 
Log into the appropriate Fedora server (dev or QA - DO NOT WIPE PRODUCTION)
 - 
Switch to the Tomcat user:
sudo su - tomcat - 
Stop Tomcat:
/opt/tomcat/bin/shutdown.sh - 
Delete Fedora content:
rm -rf /mnt/hydra/fcrepo/data/* - 
Wipe MySQL:
mysql -u FedoraAdmin -p fcrepo
Password : FedoraAdmin
mysql>drop table MODESHAPE_REPOSITORY;
mysql>exit - 
If this doesn't work you clean from rails console on one of the web servers : require 'active_fedora/cleaner' ActiveFedora::Cleaner.clean!
 - 
Start Fedora:
/mnt/hydra/fcrepo/etc/fcrepo_start.sh 
- 
Log into the Solr server (dev or QA)
 - 
Clear the Solr index:
curl http://localhost:8983/solr/collection1/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>' 
- 
Log into the appropriate web server (dev or QA)
 - 
Switch to the scholar user:
sudo su - scholar - 
Change to the app directory:
cd /srv/apps/curate_uc - 
Set the environment for bundler:
export PATH=$PATH:/srv/apps/.gem/ruby/2.7.0/bin - 
On the QA server rails will want you to set your environment:
bundle exec rake db:environment:set RAILS_ENV=production - 
If bundler gives you a problem as the scholar user, do a
gem install --user-install bundler:1.17.3 - 
Reset and migrate the database:
bundle exec rails db:drop RAILS_ENV=development(UseproductionandDISABLE_DATABASE_ENVIRONMENT_CHECK=1for QA)bundle exec rails db:create RAILS_ENV=development(Useproductionfor QA)bundle exec rails db:migrate RAILS_ENV=development(Useproductionfor QA) - 
Since we are having a problem with the bundle exec rails db:create then you need to directly log in to the mysql database and create the scholar_qa table.
mysql -h libitdbtest.libraries.uc.edu -u scholar -p. The password can be found on the .env.production.local file.create database scholar_qa; - 
Delete the contents of the following directories:
rm -rf /mnt/common/scholar-derivatives/*rm -rf /mnt/common/scholar-public-uploads/*rm -rf /mnt/common/scholar-riif-cache/*rm -rf /mnt/common/scholar-temp-uploads/*rm -rf /mnt/common/avatars/* - 
Create the default admin set:
bundle exec rails hyrax:default_admin_set:create RAILS_ENV=development(Useproductionfor QA) - 
Create the default collection types:
bundle exec rails hyrax:default_collection_types:create RAILS_ENV=development(Useproductionfor QA) - 
Restart the app (run this command on each of the load balanced servers):
touch /srv/apps/curate_uc/tmp/restart.txt - 
Restart Sidekiq (run this command on each of the load balanced servers):
script/restart_sidekiq.sh development(Useproductionfor QA)