Skip to content

Clearing Local Development and Test Environments in Scholar 3 Sufia

Kyle Lawhorn edited this page Sep 12, 2017 · 9 revisions

Clearing development

In certain situations, it may become necessary to completely wipe your dev environment. In scholar 2, we simply cleaned jetty, however with scholar 3 we have two separate wrappers for solr and fedora, and they need to be cleaned out manually.

The "easy" way

The standard way to do this is simply by appending clean to the end of either command, so that:

solr_wrapper -d solr/config/ --collection_name hydra-development

Becomes:

solr_wrapper -d solr/config/ --collection_name hydra-development clean

And:

fcrepo_wrapper -p 8984

Becomes:

fcrepo_wrapper -p 8984 clean

Then you must wipe and rebuild the rails database: bundle exec rake db:reset

The manual way:

At times, it seems that running these commands can be insufficient. At the moment, the common way to tell if you need to manually clean solr/fedora is if you're running into a Sufia::PermissionTemplate error when trying to create objects, whether it be a work or something else. To do this, you have to delete and recreate the tmp directory.

First, you must run the clean commands from above as running these also seems to save data to the tmp directory and if you delete it before, some data will still persist.

After running the clean commands, run rm -rf tmp in the working directory, then after: mkdir tmp

Clearing redis

We also recently discovered that redis may not be fully clearing its data upon shut down. If you notice the user activity feed on the dashboard persisting notifications, you may have to manually clear redis with the following command:

redis-cli flushall

Clearing test:

Clearing the test environment is the same as clearing development with the following exceptions:

You must specify the test environment in the solr/fedora commands, which can be achieved by:

  • changing the fedora port used to the test environment specified in the configs. In our case that is: fcrepo_wrapper -p 8986 clean
  • changing the solr core listed to hydra-test: solr_wrapper -d solr/config/ --collection_name hydra-test clean
  • and finally: RAILS_ENV=test bundle exec db:reset

The process for clearing redis is the same in both the test and development environments

For the moment, this is all the information we have on clearing the environments. We will update any further information we find to this page.

Clone this wiki locally