Skip to content

How to wipe all content in Scholar@UC (dev & qa)

Thomas Scherz edited this page Nov 17, 2023 · 10 revisions

Purge the Fedora repository

  1. Log into the appropriate Fedora server (dev or QA - DO NOT WIPE PRODUCTION)

  2. Switch to the Tomcat user:
    sudo su - tomcat

  3. Stop Tomcat:
    /opt/tomcat/bin/shutdown.sh

  4. Delete Fedora content:
    rm -rf /mnt/hydra/fcrepo/data/*

  5. Wipe MySQL:
    mysql -u FedoraAdmin -p fcrepo
    Password : FedoraAdmin
    mysql> drop table MODESHAPE_REPOSITORY;
    mysql> exit

  6. If this doesn't work you clean from rails console on one of the web servers : require 'active_fedora/cleaner' ActiveFedora::Cleaner.clean!

  7. Start Fedora:
    /mnt/hydra/fcrepo/etc/fcrepo_start.sh

Clear the Solr index

  1. Log into the Solr server (dev or QA)

  2. Clear the Solr index:
    curl http://localhost:8983/solr/collection1/update?commit=true -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'

Purge the app's rails database

  1. Log into the appropriate web server (dev or QA)

  2. Switch to the scholar user:
    sudo su - scholar

  3. Change to the app directory:
    cd /srv/apps/curate_uc

  4. Set the environment for bundler:
    export PATH=$PATH:/srv/apps/.gem/ruby/2.7.0/bin

  5. On the QA server rails will want you to set your environment:
    bundle exec rake db:environment:set RAILS_ENV=production

  6. If bundler gives you a problem as the scholar user, do a gem install --user-install bundler:1.17.3

  7. Reset and migrate the database:
    bundle exec rails db:drop RAILS_ENV=development (Use production and DISABLE_DATABASE_ENVIRONMENT_CHECK=1 for QA)
    bundle exec rails db:create RAILS_ENV=development (Use production for QA)
    bundle exec rails db:migrate RAILS_ENV=development (Use production for QA)

  8. 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;

  9. 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/*

  10. Create the default admin set:
    bundle exec rails hyrax:default_admin_set:create RAILS_ENV=development (Use production for QA)

  11. Create the default collection types:
    bundle exec rails hyrax:default_collection_types:create RAILS_ENV=development (Use production for QA)

  12. Restart the app (run this command on each of the load balanced servers):
    touch /srv/apps/curate_uc/tmp/restart.txt

  13. Restart Sidekiq (run this command on each of the load balanced servers):
    script/restart_sidekiq.sh development (Use production for QA)