Skip to content

Developer VM Setup

conorom edited this page Mar 12, 2020 · 23 revisions

note: these instructions should still offer the basis of a development VM but have not been tested in some time. At a minimum poppler-utils need to be added to the VM after setup for tests to pass.

Overview

It's possible to use a Vagrant based VM to run a full Hydra development environment for the heliotrope repository. You can build a vanilla VM and install all of the required decencies yourself, or you can start with the box that DCE maintains for Hydra Camp which has the following dependencies and tools pre-installed:

  • git
  • rvm
  • Redis
  • FITS
  • FFMpeg
  • ImageMagick In development mode, heliotrope uses solr_wrapper and fcrepo_wrapper to install and run Solr and Fedora, so these don't need to be pre-installed.

Setup

  1. Install Vagrant & VirtualBox following the instructions on their websites.
  2. Open a terminal window and clone the project repo
    git clone https://github.com/mlibrary/heliotrope.git
  3. Change directory to the project directory
    cd heliotrope
  4. Configure Vagrant memory and cpu allocation: the provided Vagrantfile allocates 1792MB and 2 CPU to the VM, which should be enough for our purposes (see notes below).
  5. Start Vagrant (creates machine, provisions its packages and gems, performs initial Fedora setup - see bootstrap.sh)
    vagrant up
  6. Connect to your VM
    vagrant ssh
  7. Create an initial admin user
    bundle exec rake admin
    then follow the prompts to add the first user
  8. Start your services (open a separate vagrant shell for each)
    Solr: bundle exec solr_wrapper
    Fedora: bundle exec fcrepo_wrapper
    Rails server: bundle exec rails s -b 0.0.0.0
    then visit the application at http://localhost:3000

NOTES

** RAILS SERVER ** the rails server 0.0.0.0 binding is required for the VM port forwarding to work

VM CPU/RAM allocation If your system has sufficient resources, edit the Vagrantfile to allocate 2048MB or 4096MB memory and more CPUs for better performance. Reducing the RAM value may require restricting the maximum RAM value used by the JVM. One way of doing this is by exporting this environment variable: export _JAVA_OPTIONS="-Xmx600m"

SHARED DIRECTORY Within your VM, the host project directory (./heliotrope) is shared at /vagrant in the guest VM - you can edit files using a GUI text editor or IDE on your host system.

TODO Examine failures of the command that starts all three servers bundle exec rake hydra:server

Edit fcrepo_wrapper_dev.yml to set the data directory to an unshared location (TODO: add detail)