These are best practices for setting up a DCE developed and/or hosted instance of Hyrax. Many of these are lessons learned by experience.
- Set up a master metadata spreadsheet. Mark in blue all fields that we inherit from Hyrax. Mark in green fields that we need to create. Ensure each field has an RDF predicate.
- Add the random flag to rspec test suite
- Set up CI testing with travis
- Set up capistrano and ensure passenger restarts after deploy (see /~https://github.com/capistrano/passenger)
- Specify Ruby support
- In
Gemfile
:
ruby '2.4.2' # or other version specification as required
- In
.travis.yml
:
rvm: - 2.4.2
- In
- Use sidekiq for background jobs
- Mount sidekiq UI and ensure it's limited to users with the admin role:
- Add to
config/routes.rb
:
# Mount sidekiq web ui and require authentication by an admin user
require 'sidekiq/web'
authenticate :user, ->(u) { u.admin? } do
mount Sidekiq::Web => '/sidekiq'
end
- Set up honeybadger.io to track exceptions (only in production)
- Set up capistrano to deploy, and ensure it creates the default admin set upon deploy. Example
- Set up gemnasium to track dependencies
- Turn on eager loading across Rails enviornments. By default Rails optimizes module loading differently in
development
andtest
than inproduction
. We want to normalize this behavior to avoid surprises. - Add to
config/environments/development.rb
andconfig/environments/test.rb
:
config.eager_load = true
- Set the log level down to WARN especially in production. Hyrax is really really verbose and it makes debugging difficult. In
/config/environments/production.rb
:
config.log_level = :warn
- Set up virus checking for self deposit applications (or at least ask the question)
- Truncate titles in notifications to 140 characters, or at least test notifications against very long titles. See Laevigata.
- Add code version in page footer. See /~https://github.com/curationexperts/cypripedium/pull/44/commits/cdc444d66db78e0f3697aef0b1800ead5c2d6531
- Ensure the versions of ghost script, imagemagick, fits etc work together to produce non-garbled derivatives (more to come here)
- Use the whenever gem to schedule removal of blacklight saved searches via this rake task:
RAILS_ENV=production bundle exec rake blacklight:delete_old_searches[1]
- Change location of derivatives in production environment to
/opt/derivatives
(See curationexperts/epigaea#416) so derivatives don't disappear between deploys