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.
A generated Hyrax-based Research Data Repository application
Note that this application is designed to run within the rdr-vagrant virtual machine
-
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.
-
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
-
clone the rdr-vagrant repository
git clone --recursive https://github.com/duke-libraries/rdr-vagrant.git
-
move to the rdr-vagrant folder
cd rdr-vagrant
-
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.
-
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 ..
-
shell into vagrant box
vagrant ssh
-
change to the new folder
cd /vagrant/rdr
7. Copy the role map config file no longer needed -- see belowcp config/role_map.yml.sample config/role_map.yml
-
grab the bunder gem
gem install bundler
-
run
bundle install --without production
-
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
-
run database migrations
rake db:migrate
-
load default workflow
rake hyrax:workflow:load
-
export environmental variables (DEPOSITOR_REQUEST_FORM and EZID_TEST_PASSWORD): like so:
export DEPOSITOR_REQUEST_FORM="https://whatever-url-you-want"
-
start the server(s):
open a new terminal tab, ssh into vagrant
vagrant ssh
, move to the correct foldercd /vagrant/rdr
, start Fedorafcrepo_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
-
create default admin set — open a new terminal tab (Ctrl-T or ⌘-T), shell into vagrant
vagrant ssh
, and move to the correct foldercd /vagrant/rdr
then run
bin/rails hyrax:default_admin_set:create
you can close the tab when it's done
-
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
- to shut down the app, stop the rails server by pressing Ctrl-C, logout of vagrant
logout
, and then shutdown the VMvagrant halt
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 should be running on :8983
- Fedora should be running on :8984
- Solr and Fedora now run individually (so we don't need to run rake tasks) see Run the wrappers.
- Ubuntu 16.04 64-bit base machine
- Solr 7.1.0: http://localhost:8983/solr/
- Fedora 4.7.4: http://localhost:8984/
- Ruby 2.4.2 (managed by RVM)
- Rails 5.1.4
Instructions are based on the Samvera Hyrax installation instructions
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.
-
run database migrations using:
rake db:migrate
-
add a user to the admin group via the rails console
use
rails c
to start the consolethen 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
-
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
-
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.