Skip to content

Lesson: Start FCRepo and Solr

Bess Sadler edited this page Jan 17, 2017 · 7 revisions

Goals

  • Install FCRepo and Solr
  • Learn to start and stop FCRepo and Solr

Explanation

In order to use blacklight and hydra-head you need an installation of Solr. In addition, hydra-head requires a copy of Fedora. Fedora and Solr are both Java web applications.

For developer environments, we have created a solr_wrapper and fcrepo_wrapper -- commands to assist you in starting Solr and Fedora. Whenever you need Fedora and Solr running in your development environment, just start or stop that copy of solr_wrapper or fcrepo_wrapper

TIP DO NOT use solr_wrapper or fcrepo_wrapper for production installations.

Steps

Run fcrepo_wrapper and solr_wrapper

NOTE: fcrepo_wrapper and solr_wrapper gems were included in your demo app by the hydra gem.

TIP Running solr_wrapper in a tmux panel can silently fail. Use a separate new terminal window, or install https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard for Mac OSX.

Step 1: Start Solr

Open a new terminal window and type:

cd <hydra-demo app path>
solr_wrapper -d solr/config/ --collection_name hydra-development

You may get 404 errors while starting Solr, which looks something like this:

Starting Solr 6.0.1 on port 8983 ...                                                                                                    .../.rbenv/versions/2.3.1/lib/ruby/2.3.0/open-uri.rb:359:in `open_http': 404 Not Found (OpenURI::HTTPError)% ( ETA: ??:??:?? )
	from .../.rbenv/versions/2.3.1/lib/ruby/2.3.0/open-uri.rb:737:in `buffer_open'

This is due to Solr archiving older versions of their software to a different location on their website. To get around this, you can tell solr_wrapper to use the most recent version of Solr. First, go to the Solr website and determine what the latest version number is. Then pass that version number to solr_wrapper as an additional parameter to the above command. If the current version is 6.3.0, the command will now look like this:

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

You can check to see if Solr is started by going to http://localhost:8983/

NOTE: There are additional parameters that control how solr_wrapper is started, including specifying where to start solr and store the index. See solr_wrapper documentation for more details.*

NOTE: If you shut solr down and want to restart it (for example, if you complete this tutorial in more than one session), restart solr with the same command, but remove the --collection-name flag. Otherwise, it will try to create a collection called hydra-development, find that it already exists, and throw an error.

Step 2: Start FCRepo

Open a new terminal window and type:

fcrepo_wrapper -p 8984

You can check to see if FCRepo is started by going to http://localhost:8984/

NOTE: There are additional parameters that control how fcrepo_wrapper is started, including specifying where to start fedora and store the data. See fcrepo_wrapper documentation for more details.*

Step 3: Make git ignore the fcrepo4-data directory

We want git to ignore the fcrepo4-data directory for the same reasons that we don't check our development databases into git -- because it's big and bulky and you don't actually need other developers to have exact copies of your data as long as they have all the other code.

We do that by editing .gitignore and adding the something like this:

# Ignore Fedora data files
/fcrepo4-data

Now commit this change

git add .gitignore
git commit -m "Adds /fcrepo4-data to .gitignore"

FYI: Stopping FCRepo and Solr

In order to stop either service, open the window they are running in and type <Control>-C. Wait a few moments for the process to terminate.

Tip: Sometimes people are confused about whether they need to restart Fedora or Solr when they restart their Rails application. In most cases it is fine to leave Fedora and Solr running when you start, stop, and restart the Rails application. The only exception is when you make changes to Solr's configuration or Fedora's configuration -- these would be changes to files inside of your copy of the solr configuration (i.e. solr/config), not changes to files in your Rails application's Ruby code. In those cases, where you have made changes to Solr or Fedora's configuration, you need to restart the processes in order for those changes to take effect. The most common change that requires restarting Solr is when you modify the solrconfig.xml or schema.xml in your solr config directory. Normally, changes to your data steams or models do not require restarts to Solr and Fedora because these changes are indexed dynamically by Hydra.

Next Step

Go on to Lesson: Start the Application & Search for Results or return to the Dive into Hydra-Works page.

Clone this wiki locally