Technical recipes for frequently and infrequently recurring problems
Sometimes we want to wipe everything out of one of our systems and get it to a pristine state. It’s best if we always follow the same documented procedure for this so we can make consistent assumptions about what has been reset. Use good judgement and TRIPLE check that you are doing this on the system you think you’re doing it on. Don’t accidentally wipe out production when you meant to reset the sandbox.
On the command line:
sudo service apache2 stop
If fedora is small, you can do this in a console:
require 'active_fedora/cleaner'
ActiveFedora::Cleaner.clean!
If fedora is huge, go to the system where fedora is running and do this:
sudo service tomcat7 stop
cd /opt
sudo mv fedora-data fedora-data-$TODAY
sudo mkdir fedora-data
sudo chown tomcat7:tomcat7 fedora-data
sudo service tomcat7 start
On a rails console:
Blacklight.default_index.connection.delete_by_query("*:*"); Blacklight.default_index.connection.commit
On the command line:
redis-cli FLUSHALL
On the command line
RAILS_ENV=whatever bundle exec rake db:reset
NOTE: You might need to restart postgres if it won’t drop the database because it says you have sessions connected. sudo service postgresql stop
then sudo service postgresql start
On the command line
sudo rm -rf /opt/uploads/hyrax/uploaded_file/file/*
sudo find /tmp -type f -user deploy -execdir /bin/rm -- {} \;
Restart apache and you should be ready to go!
sudo service apache2 start