Skip to content

DEPRECATED: Developing Ursus in Docker

Parinita Mulak edited this page Oct 2, 2026 · 1 revision

Warning

Deprecated documentation

This page is retained for historical reference and may no longer describe the current Ursus application or development environment.

For current documentation, start with Solr in Ursus.

Prerequisites

Getting started

$ git clone git@github.com:UCLALibrary/ursus.git
$ cd ursus
$ docker-compose run web bundle exec rails db:setup
$ docker-compose up

Ursus should now be running on port 3003.

The data you're viewing is coming from a solr instance, preloaded with data from Californica-test, and should not need to be changed in most cases, since ursus is a discovery interface only. You can see the solr console on port 8983.

Running the Test Suite

  1. Connect to a shell inside the container with docker-compose run web bash
  2. Run bundle exec rspec spec

Where everything comes from.

The primary docker-compose.yml uses a clone of ursus-test's (??? dev? stage? prod?) solr index. This enables you to run a local instance of ursus while using our test servers to obtain IIIF manifests and image tiles.

Unfortunately the solr index has to be manually obtained from our backups and checked in to the UCLALibrary/docker-solr-ursus repo, which will trigger a build of uclalibrary/solr-ursus on dockerhub.


Running against a local version of Californica

Sometime you will need to develop in an environment where Ursus and Californica are sharing the same Solr data.

In Ursus the standard developer environment comes pre-populated with data from Californica-test.

In order to use other data, you will need to run our management app Californica alongside Ursus. The file docker-compose-with-californica.yml is set up to allow this.


  1. Get your Californica environment running Follow the Californica instructions to get a local instance of Californica running on port 3000

  2. Get your Ursus environment running

    • Spin up your environment and start the app:

      • docker-compose -f docker-compose-with-californica.yml up
    • Run the database migration

      • docker-compose -f docker-compose-with-californica.yml run web bundle exec rake db:setup

    Note: If you get a database error make sure that you are running californica as outlined above (1. Get your Californica environment running)

    Mysql2::Error::ConnectionError
    Unknown MySQL server host 'db' (-2)
    
  3. You will have to explicitly specify the alternate docker-compose file every time you run a docker-compose command
    For example:

    • Open a shell inside a container
      docker-compose -f docker-compose-with-californica.yml run web bash
    • Run the test suite
      docker-compose -f docker-compose-with-californica.yml run web bundle exec rspec spec

Running byebug to debug code

To debug code running under the development web server container

  1. add a byebug call in the code you want to debug
  2. restart the web container by running docker-compose restart web
  3. run docker ps and get the of the ursus/web container.
  4. run docker attach <ID> and press enter. You'll be able to access the byebug prompt.

To open a debug prompt within the test suite

  1. add a byebug call in the code you want to debug
  2. run your test suite in the way you normally do

Running rails commands natively

It is possible to run rails natively against backing services running in docker. Personally, I run the rails server in docker but like to run tests and rake commands natively. This has the side benefit of maintaining a copy of Ursus' various dependency libraries in a place where a text editor can find them (they're not very good at digging through docker containers).

I haven't worked out consistent instructions for doing this yet, however. Here's a rough outline:

  1. Install the proper version of ruby with rvm, rbenv, or similar.
  2. Change config/solr.yml and config/blacklight.yml to point to http://localhost:8983/solr/calursus by default.
  3. Point config/database.yml to http://127.0.0.1:3306 by default. It's important to not use localhost here, because that would make the mysql client try to connect via a socket, which doesn't work with docker.
  4. Run bundle install