Skip to content

Installing, Developing, and Testing

Eben English edited this page Dec 6, 2019 · 20 revisions

Installing, Developing, and Testing

Integrating newspaper_works in your Hyrax 2.5.x application.

Your Hyrax 2.5.x based application can extend and utilize newspaper_works

Note

This software is still under development so the installation instructions here might not be up to date with the latest release. The instructions provide the necessary information to implement a test environment. Currently, these instructions are not intended to be used for deploying the application in a production environment.

Installing Newspaper Works

Development Environment

Looking to quickly and easily deploy a NewspaperWorks development/test environment? Check out the NewspaperWorks vagrant box.

Assumptions

System Requirements

Getting Started (New Installation)

Setting up the environment and installing dependencies for a new Hyrax installation

  1. Install Ruby (2.5.5), Rails (5.1.7), rbnev, database, etc.

  2. Install FITS (1.4.1 recommended)

  3. Install the remaining dependencies using apt-get:

sudo apt-get install poppler-utils ghostscript imagemagick libopenjp2-tools libreoffice tesseract-ocr libcurl3 redis-server jetty9 wget

Installing Fedora Commons 4.7.x

Instructions for installing Fedora Commons 4.x can be found here

Installing Apache Solr 7.x

Instructions for installing Apache Solr 7.x can be found here

Installing NewspaperWorks

  1. Create a new Rails application using the Hyrax 2.5.x instructions.

  2. Add the following to your application's Gemfile

    gem 'newspaper_works' 
    
  3. Run bundle install

  4. Ensure that the config/fedora.yml and config/solr.yml files are properly configured to reflect the environment variables.

  5. Run generators in the following sequence:

 rails generate newspaper_works:generate
  1. Edit Hyrax initializer file config/initializers/hyrax.rb
    set the following attributes
 config.work_requires_files = false
 config.iiif_image_server = true
 config.fits_path = /location/of/fits.sh
 config.geonames_username = 'your geonames.org username'
  1. Update the Hyrax production environment variable
    vim config/environments/production.rb
    set the following attributes
    config.public_file_server.enabled = true

  2. Start the Rails server rails s

Application/Site Specific Configuration

  • In order to use some fields in forms, you will want to make sure you have a Geonames username, and configure that username in the config.geonames_username value in config/intitializers/hyrax.rb of your app.
  • This will help fields such as "Place of Publication" provide autocomplete using the Geonames service/vocabulary.

    • NewspaperWorks requires that your application's config/initializers/hyrax.rb be edited to make uploads optional for (all) work types, by setting config.work_requires_files = false.

    • NewspaperWorks expects that your application's config/initializers/hyrax.rb be edited to enable a IIIF viewer, by setting config.iiif_image_server = true.

    • NewspaperWorks expects that your application's config/initializers/hyrax.rb be edited to set the FITS path, by setting config.fits_path = /location/of/fits.sh

    • NewspaperWorks expects that your application's config/environments/production.rb be edited to set file server to public, by setting config.public_file_server.enabled = true

    • NewspaperWorks overrides Hyrax's default :after_create_fileset event handler, in order to attach pre-existing derivatives in some ingest use cases. The file attachment adapters for NewspaperWorks use this callback to allow programmatic assignment of pre-existing derivative files before the primary file's file set has been created for a new work. The callback ensures that derivative files are attached, stored using Hyrax file/path naming conventions, once the file set has been created. Because the Hyrax callback registry only allows single subscribers to any event, application developers who overwrite this handler, or integrate other gems that do likewise, must take care to create a custom composition that ensures all work and queued jobs desired run after this object lifecycle event.

Development and Testing with Vagrant

A custom vagrant setup has been created for users to develop and test the Newspapers_works application. Additional information about the vagrant setup can be found at the samvera-newspapers-vagrant project site.

Public NewspaperWorks testing site

A public instance of the NewspaperWorks gem is available for testing. Note the public site may not be running the latest release of the gem.