The Sufia-based application powering the Science History Institute's digital collections site at https://digital.sciencehistory.org
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.
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)
cp config/secrets.yml.example config/secrets.yml
- you will need to fill out some secret sierra connection config in here
./bin/rake db:create db:schema:load
To run the rails app, you Fedora instance running and a Solr instance running. You can:
./bin/rake dev:serversto start fedora and solr (according to config in
./.fc_repo_wrapper), leave that running, and then in a different terminal start
rails serveras 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
fcrepo_wrappergems 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:
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[firstname.lastname@example.org,password]will create account with that email/password, and create 6 sample works (5 public one private) attached to that account.
./bin/rake dev:datawill 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:
./bin/rake dev:spec_with_app_loadto 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:serversto run the fedora and solr apps in test mode (using config from
./config/fcrepo_wrapper_test.yml), just leave it running in a terminal, and then run tests with
./bin/rake rspecor however you want.
- Or, if you have a solr and fedora installed and running yourself in your own
way, you may want to set
ENVvariables to the app knows where to find them when running tests. See
ENVkeys mentioned above in "development setup", but replace
See docs subdir.
bundle exec cap [target machine] deploy
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
bundle exec rspec
Run tests continuously using Guard
bundle exec guard -p -l 10