Skip to content
This repository has been archived by the owner on Feb 13, 2020. It is now read-only.

duke-libraries/rdr

Repository files navigation

This repository has moved to https://gitlab.oit.duke.edu/ddr/rdr.

As of February 12, 2020, the GitHub repository is retained for archival purposes only.

rdr

A generated Hyrax-based Research Data Repository application

Note that this application is designed to run within the rdr-vagrant virtual machine

Prerequisites (vagrant / virtualbox)

  • Vagrant version 1.8.5+

    You can quickly check to see if you have a suitable version of vagrant installed by running vagrant -v

    If you don't have vagrant installed, you can download it -- it's available for both Mac and Windows, as well as Debian and Centos.

  • VirtualBox

    Vagrant runs inside of a Virtual Machine (VM) hosted by VirtualBox, which is made by Oracle and is free to download. They have version for Mac and Windows, as well as Linux and Solaris.

    You can quickly check to see if you have VirtualBox installed by running vboxmanage --version

Setup the Environment

Vagrant

  1. clone the rdr-vagrant repository git clone --recursive https://github.com/duke-libraries/rdr-vagrant.git

  2. move to the rdr-vagrant folder cd rdr-vagrant

  3. startup vagrant vagrant up

    This will run through provisioning the new Virtual Machine. The first time it runs, it will take a while to complete. In the future when you want to startup the dev environment, you'll run the same command but it will startup much more quickly

    Vagrant creates a shared folder that you can access both inside the VM and on your workstation. We've found it's best to do your git operations exclusively via the workstation folder.

rdr application

  1. This repo (rdr) is included as a submodule in rdr-vagrant, so the folder and files are there already.

    However, we need to specify that we will be using the develop branch.

    move to the rdr folder cd rdr

    specify the branch git checkout develop

    move back to the rdr-vagrant folder cd ..

  2. shell into vagrant box vagrant ssh

  3. change to the new folder cd /vagrant/rdr

7. Copy the role map config file cp config/role_map.yml.sample config/role_map.yml no longer needed -- see below

  1. grab the bunder gem gem install bundler

  2. run bundle install --without production

  3. setup Postgres (see confluence documentation]:

    a. Create a 'hydra' postgres user (role): psql -c "CREATE USER hydra WITH PASSWORD 'hydra' CREATEDB;" postgres

    b. Create a development postgres database: psql -c "CREATE DATABASE development WITH OWNER hydra;" postgres

    c. Create a test postgres database: psql -c "CREATE DATABASE test WITH OWNER hydra;" postgres

    d. Set up the development and test databases: rake db:schema:load

  4. run database migrations rake db:migrate

  5. load default workflow rake hyrax:workflow:load

  6. export environmental variables (DEPOSITOR_REQUEST_FORM and EZID_TEST_PASSWORD): like so: export DEPOSITOR_REQUEST_FORM="https://whatever-url-you-want"

  7. start the server(s):

    open a new terminal tab, ssh into vagrant vagrant ssh, move to the correct folder cd /vagrant/rdr, start Fedora fcrepo_wrapper

    open a new terminal tab, ssh in, move to correct folder, and startup Solr solr_wrapper

    open one more terminal tab, ssh in, move to correct folder, and startup rails rails server -b 0.0.0.0

  8. create default admin set — open a new terminal tab (Ctrl-T or ⌘-T), shell into vagrant vagrant ssh, and move to the correct folder cd /vagrant/rdr

    then run bin/rails hyrax:default_admin_set:create

    you can close the tab when it's done

  9. The application should now be running at localhost:3000. You can try to do some things like creating a new user account and depositing an object

    *Note that if you would like to give your user account admin rights, you'll need follow the instructions below

Shutting down the application

  • to shut down the app, stop the rails server by pressing Ctrl-C, logout of vagrant logout, and then shutdown the VM vagrant halt

Starting up the application

It is best to run Solr, Fedora, and Rails in three separate tabs:

  • startup the vagrant instance: vagrant up
  • ssh into vagrant vagrant ssh
  • move to the correct folder cd /vagrant/rdr
  • start Fedora fcrepo_wrapper
  • open a new terminal tab, ssh in, move to correct folder, and startup Solr solr_wrapper
  • open one more terminal tab, ssh in, move to correct folder, and startup rails rails server -b 0.0.0.0

Solr and Fedora

Environment (via rdr-vagrant)

References

Instructions are based on the Samvera Hyrax installation instructions

Addenda

3/21/2018 -- Changes to role management

Previously we were using the default role management in Hyrax which used config/role_map.yml to assign users to roles. We're no longer using the yml file and are instead using the hydra-role-management gem so there are a few extra steps you'll need to take to get things to work.

  1. run database migrations using: rake db:migrate

  2. add a user to the admin group via the rails console

    use rails c to start the console

    then enter:

    admin = Role.create(name: "admin")

    admin.users << User.find_by_user_key( "your_admin_user_name" )

    admin.save

    and then exit the console: exit

  3. start up the server rails server -b 0.0.0.0, sign in using the 'admin' user you assigned above, and visit localhost:3000/roles which should allow you to view existing roles, create new ones, and assign users to them.

    Note: if you had established other user roles in the role_map.yml file, you'll need to manually assign those users using this process

  4. If you have any problems, you can test whether a user has been assigned to either the admin or curator groups (as these have defined methods on the User class) using the rails console as follows:

    u = User.find_by_user_key( "your_user_id_name" )

    u.admin?

    u.curator?

    If either returns true, you know your user is in that group.