sufia-based hydra app
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app Small adjustment Nov 12, 2018
bin Upgrade rails from 4.2.4 to 4.2.5 Jul 7, 2016
config Adding money as a genre Oct 31, 2018
db Other DB changes Jun 20, 2018
docs Update image_crops.md Jun 7, 2018
exe Create an exe to run validation, print report fix #2129, fix #2938 Jan 19, 2017
lib remove dependency on rake task that doesn't exist anymore Aug 27, 2018
log Newly-generated rails project Mar 12, 2015
patches/fixity_checks remove monkey-patch to ActiveFedora now present in version of AF we a… Aug 13, 2018
public Dynamic robots.txt, disallowing all in non-production Nov 21, 2017
solr solr mm is 100% always Dec 11, 2017
spec Merge pull request #1150 from sciencehistory/batch_edit_bug_fix Sep 11, 2018
vendor an sRGB profile licensed for free use, from http://www.color.org/srgb… Oct 18, 2017
.fcrepo_wrapper tell fcrepo_wrapper to use the same fedora version we have in product… May 3, 2017
.gitignore .gitignore MacOS .DS_Store Apr 12, 2017
.rspec Reorganize rspec helper files according to more current conventions. Apr 23, 2015
.ruby-version change dev and test to be on ruby 2.5.1, for our impending upgrade Jun 13, 2018
.solr_wrapper solr_wrapper download solr dists to subdir in tmp, to make it easier … Mar 6, 2017
.travis.yml change dev and test to be on ruby 2.5.1, for our impending upgrade Jun 13, 2018
Capfile slackistrano integration stub Aug 31, 2017
Gemfile upgrade active_fedora to 11.5.2 Jun 27, 2018
Gemfile.lock update rack version Nov 7, 2018
Guardfile Document how to make guard work with vagrant Apr 23, 2015
LICENSE.txt change many instances of org name for rebrand Dec 7, 2017
README.md fix README description of our app Aug 29, 2018
Rakefile ensure cron rake errors get reported to honeybadger Jan 23, 2018
config.ru Newly-generated rails project Mar 12, 2015

README.md

README

Build Status

Description

The Sufia-based application powering the Science History Institute's digital collections site at https://digital.sciencehistory.org

Dependencies

All system setup for development and production machines is managed and documented via ansible playbooks that use the roles defined in https://github.com/curationexperts/ansible-hydra.

Development

One way to do development might be to set up a ubuntu VM and use the ansible scripts. But these are instructions for setting it up on an OSX dev box, without a VM.

  • Dependencies (also check at https://github.com/projecthydra/sufia#prerequisites)

    • brew install imagemagick
    • brew install fits
    • brew install redis
      • brew services start redis
    • postgres (on osx, i like https://postgresapp.com/)
    • brew install vips IF you want to turn on .dzi tile creation for deep-zooming in dev. See dzi_tiles_on_s3
  • cp config/secrets.yml.example config/secrets.yml

    • you will need to fill out some secret sierra connection config in here
  • db setup

    • ./bin/rake db:create db:schema:load
  • To run the rails app, you Fedora instance running and a Solr instance running. You can:

    • run ./bin/rake dev:servers to start fedora and solr (according to config in ./.solr_wrapper and ./.fc_repo_wrapper), leave that running, and then in a different terminal start rails server as normal.
    • start fedora, solr, and rails with ./bin/rake hydra:server (but you may have trouble with byebug/pry when you do it this way)
    • The above methods both use the solr_wrapper and fcrepo_wrapper gems to automatically start (and install if needed) fedora and solr. If you want to install/run them some other way yourself, you may want to set some ENV variables to tell the Rails app where to find them at wherever you have them running:
      • HYDRA_SOLR_URL_DEVELOPMENT
      • HYDRA_FEDORA_URL_DEVELOPMENT
      • HYDRA_FEDORA_BASE_PATH_DEVELOPMENT
      • HYDRA_FEDORA_USER_DEVELOPMENT
      • HYDRA_FEDORA_PASSWORD_DEVELOPMENT

Load default Workflow and add default Admin Set

After Fedora and Solr are running, load the default workflow and create the default administrative set. Both of these need to be run any time the app is deployed to a new environment:

rake curation_concerns:workflow:load
rake sufia:default_admin_set:create

Create sample data

  • You can createcreate some sample data and a user account to get started quicker:
    • ./bin/rake dev:data[email@example.com,password] will create account with that email/password, and create 6 sample works (5 public one private) attached to that account.
    • ./bin/rake dev:data will create the same 6 sample works, but each belonging to a different newly created random user.

Running tests locally

You also need a hydra and a fedora server running to run tests. You can:

  • Use ./bin/rake dev:spec_with_app_load to automatically start hydra and fedora, then run Rspec tests, then shut the down. (This is what we do on travis)
  • Or, you can use RAILS_ENV=test ./bin/rake dev:servers to run the fedora and solr apps in test mode (using config from ./config/solr_wrapper_test.yml and ./config/fcrepo_wrapper_test.yml), just leave it running in a terminal, and then run tests with ./bin/rspec or ./bin/rake rspec or however you want.
  • Or, if you have a solr and fedora installed and running yourself in your own way, you may want to set ENV variables to the app knows where to find them when running tests. See ENV keys mentioned above in "development setup", but replace _DEVELOPMENT with _TEST.

Other docs

See docs subdir.

Deployment

bundle exec cap [target machine] deploy

See more at: https://chemheritage.atlassian.net/wiki/spaces/HDCSD/pages/5668869/Deployment+Capistrano

Maintenance mode

Maintenance mode makes the entire app unavailable.

bundle exec cap staging maintenance:enable REASON="a test of maintenance mode" UNTIL="12pm Eastern Time"

bundle exec cap staging maintenance:disable

Remote rake tasks

Run a rake task with downtime:

TASK=chf:data_fix:library_division REASON="testing things" UNTIL="12pm Eastern Time" bundle exec cap staging invoke:rake:with_maintenance

Will turn maint mode on for you, run task, turn it back off -- even if task fails. If you want to leave it on if task fails, SAFE_MAINT=false.

Or to just run a rake task on a remote server without maint mode:

cap staging invoke:rake TASK=chf:data_fix:whatever

Run Tests

bundle exec rspec

Run tests continuously using Guard

bundle exec guard -p -l 10