Skip to content

cul-it/exhibits-library-cornell-edu

Repository files navigation

CUL Online Exhibitions

Prerequisites

Local Development Setup

  1. Clone this repo

    $ git clone git@github.com:cul-it/exhibits-library-cornell-edu.git
  2. Copy example dotenv file and update CHANGEME values

    $ cp .env.example .env
  3. Choose your path for setting up your dev environment: start with Docker or start app manually.

OPTION 1: Start with Docker

$ docker compose up -d

Web server: http://localhost:9292

Solr: http://localhost:8983

Testing in Docker

Run full test suite:

$ ./docker/run_test.sh

Open the test container in interactive mode and run tests individually:

$ ./docker/run_test.sh -i
$ bundle exec rspec spec/models/solr_document_spec.rb:20

Linting in Docker

This project uses RuboCop to ensure consistency in code style/formatting. To output rubocop issues:

$ docker compose exec webapp bundle exec rubocop

Or open an interactive bash session to run rubocop:

$ docker compose exec webapp bash
$ bundle exec rubocop
$ exit

OPTION 2: Start app manually

  1. Install gems

    $ cd <clone>
    $ bundle install
  2. Create the database and run migrations

    $ bin/rake db:create db:schema:load db:migrate
  3. Start Solr (via solr_wrapper)

    $ bin/solr_wrapper

    Solr will be accessible at http://localhost:8983/solr

    solr_wrapper is configured to persist data between runs. Please refer to the solr_wrapper documentation for details on purging persisted data.

    Additional configurations can be made in .solr_wrapper.yml

  4. Create an initial admin user and default exhibit

    $ bin/rake spotlight:initialize
  5. Start Redis and Sidekiq for processing background jobs (Needs to run at the root of the rails app.)

    $ redis-server
    $ bundle exec sidekiq
  6. Start Rails in new terminal session

    $ rails s

    Visit the application at http://localhost:3000

    Visit the Sidekiq dashboard at http://localhost:3000/sidekiq

Testing with manual setup

$ bundle exec rspec

Linting with manual setup

This project uses RuboCop to ensure consistency in code style/formatting. To output rubocop issues:

$ bundle exec rubocop

Circle/CI

Go to https://circleci.com and pick "log in" and the "Login with GitHub" option. This will allow you to select this repository. Once you are logged in, you should be able to see CircleCI builds and messages.