Skip to content

Development Setup

Adam Wead edited this page Aug 31, 2021 · 3 revisions

Dependencies

Homebrew

You'll need this to install things like Redis, specialized executables, and development libraries for related gems need by the application, unless you're using docker for this (see below).

To install, go to: https://brew.sh/

Ruby

Install the version specified in .ruby-version

There are a number of different version managers you can use:

Docker

We use docker, by way of docker-compose, to manage dependencies such as Redis and Solr. You can even run the entire Rails app in its own container and eliminate the need for any local Ruby management and homebrew libraries; however, the performance it noticeably faster if you use your local machine for Ruby, Rails, and gems, while using docker for ancillary dependencies such as Solr and Redis.

Docker can be installed different ways. The easiest is probably to just use Docker Desktop. See https://www.docker.com/products/docker-desktop

Redis

Install via homebrew

brew install redis                                                                                                                                        
brew services start redis

Or, use the docker image (see below for specific instructions)

Solr

While you can technically run this locally, it's much easier to just let docker deal with this (see below for specific instructions).

Install the Application

Clone the repo

git clone git@github.com:psu-libraries/psulib_blacklight.git                                                                                              
cd psulib_blacklight                                                                                                                                      
bundle install
bundle exec rake db:create db:migrate

If any gems fail to install, it's usually an indication that you need to install specific development libraries via homebrew. For example, the sqlite gem needs brew install sqlite to install properly.

The bundler gem is usually installed when you install Ruby, but a gem install bundler can fix that. Bundler may complain if the version of bundler you're running is different than the one listed in the Gemfile.lock. You can ignore it, or install the specific one with:

gem install bundler -v [version listed in Gemfile.lock]

Start Dependencies

If you want to use docker for Redis and Solr:

docker-compose up --build redis solr

If you've already built them, the omit the --build flag

If you want to use Redis locally via homebrew, then just start solr

docker-compose up solr

Changes in the ports or hosts of these services is specified in settings.yml but all of them are set to their defaults and should not need changing.

Setup and Testing

Initialize the database and load the test data into Solr:

bundle exec rake db:create db:migrate
bundle exec rake solr:create_collection
bundle exec rake solr:update_config
bundle exec rake solr:create_alias
bundle exec rake solr:load_fixtures                                                                                                  

Run the test suite:

bundle exec rspec

Start the Application

bundle exec rails s

And go to http://localhost:3000

Alternatively, you can use puma-dev

Indexing

Use Traject

To clean out data that is being preserved explicitly run:

bundle exec rails solr:clean
Clone this wiki locally