-
Notifications
You must be signed in to change notification settings - Fork 1
Building from Scratch
Mark Bussey edited this page Oct 9, 2018
·
5 revisions
This guide walks you through the steps to set up a template-generated instance of Hyrax which can be used with the other tutorials in this Wiki. We have followed the main outline of the instructions in the Hyrax README, and we have added the steps to make using a Vagrant-based virtual machine easier.
- Start a vagrant-based virtual machine
- Set up a Hyrax-based Rails application
- Start Solr, Fedora, and Web servers
- Be able to log into a local Hyrax instance and submit a work
- Recent version of VirtualBox installed
- Recent version of Vagrant installed
- A Vagrantfile which loads a VM pre-loaded with the Hyrax prerequisites
- Start your VM using
vagrant up
and connect withvagrant ssh
. - Navigate to your working directory -
/vagrant
will give you a VM-mounted instance of the directory from which you started vagrantcd /vagrant
- Generate a Hyrax application using the basic application template
rails _5.1.6_ new hyrax_demo -m https://raw.githubusercontent.com/samvera/hyrax/v2.3.0/template.rb --no-spring
NOTE: using the template file above to set up your application is equivalent to running the following individual commands
- Run
rails _5.1.6_ new hyrax-demo --no-spring
cd hyrax-demo
- Add
gem 'hyrax', '2.3.0'
to your Gemfile bundle install
rails generate hyrax:install -f
rails db:migrate
- Run
- Change directory to the root of the newly generated application
cd hyrax-demo
- For the tutorials, set background jobs to run inline by editing
config/application.rb
around line 11# after the line # class Application < Rails::Application config.active_job.queue_adapter = :inline
- Point your solr config at the local (already downloaded) Solr instance in
/var/tmp
by adding these lines to the top ofhyrax-demo/.solr_wrapper
:version: 6.6.0 download_dir: /var/tmp
- Point your fedora config at the local (already downloaded) Fedora instance in
/var/tmp
by adding these lines to the end ofhyrax-demo/.fcrepo_wrapper
:version: 4.7.5 download_dir: /var/tmp
- Start Solr, Fedora, and Web servers in a new terminal window. You'll want to leave these running in a separate window while you use your first terminal session for command-line exercises in the tutorials.
then, in the new terminal session after you ssh
# after you open a new terminal window vagrant ssh
cd /vagrant/hyrax-demo bundle exec rails hydra:server
NOTE: alternatively you can start services individually and send them to the background:
cd /vagrant/hyrax-demo solr_wrapper & fcrepo_wrapper & rails server &
exit
when you're done with the terminal window. You can now use your primary terminal window for the remaining exercises. - Generate the default admin set:
bundle exec rails hyrax:default_admin_set:create
- Create a work type to be used in future tutorials. To generate a new work type, we follow the instructions in the Hyrax README. In this case, our work type will be Image.
Restart Rails after generating a new work type, if Rails was running already.
bundle exec rails generate hyrax:work Image
- Open a browser window and go to
http://localhost:3000
. You should be able to create an account and log in. Once you have logged in, go tohttp://localhost:3000/concern/images/new
. You should be able to submit a new Work object.
To see the sample application at this stage, go to https://github.com/RepoCamp/berlin2018/tree/walkthrough