Skip to content

Create Hyrax application

Anusha Ranganathan edited this page Mar 20, 2018 · 29 revisions

Steps to Install data2paper

Reference: All online sources and documents referred to in this document are detailed here

  1. Create a Linux virtual machine with the Azure portal

    • 4 cores, 16 GB RAM, OS: Ubuntu 16.04
    • Open port 80
  2. Create a new user for the application called appuser and ssh as that user

  3. Install node.js using the ppa This is needed for runtime of app

  4. Install Ruby on Rails with rbenv

    • Installed Ruby 2.4.2 rbenv install 2.4.2
    • Rails 5.1.4 (Did not run echo "gem: --no-document" > ~/.gemrc as I didn't want to skip the docs)
  5. Install Hyrax pre-requisites
    NOTE: Solr and Fedora are not needed for dev mode.

    1. Solr version >= 5.x
    2. Fedora version >= 4.5.1
    3. Install Redis sudo apt-get install redis-server && sudo systemctl enable redis-server.service
    4. Install Postgres and create user
      • Install postgres
        sudo apt-get update && sudo apt-get install postgresql postgresql-contrib libpq-dev
        
      • Create postgres user
        sudo -u postgres createuser -s data2paper
        
      • Set the password for the user
        sudo -u postgres psql # set the password
        \password data2paper
        # enter password and confirm
        \q
        
    5. Install Fits
      • Install Java if not already installed. Instructions
      • Download Fits
        cd /home/appuser 
        wget http://projects.iq.harvard.edu/files/fits/files/fits-1.0.5.zip
        sudo apt-get install unzip
        unzip fits-1.0.5.zip
        
      • Make fits.sh an executable
        cd fits-1.0.5/
        chmod a+x fits.sh
        
      • Test fits.sh -h return a value
        ./fits.sh -h
        
      • Add full path for fits.sh to $PATH Add the full path for fits.sh to $PATH
        PATH=/home/appuser/fits-1.0.5/fits.sh:$PATH
        
        Add this to the file ~/.profile
        vim ~/.profile
        
        After modifications, my path in the looks like
        PATH="$HOME/bin:$HOME/.local/bin:$PATH:$HOME/fits-1.0.5/fits.sh"
        
      • Also modify config/initializers/hyrax.rb and set the full path for fits in it
        config.fits_path = "/home/appuser/fits-1.0.5/fits.sh"
        
    6. Install Libre office for derivtaives
      If which soffice returns a path, you're done. if not,install libre office
      sudo apt install libreoffice-common
      
      Test which soffice returns a path

    7. Install image magic
      sudo apt-get install imagemagick
  6. Either Generate the rails app rails _5.1.4_ new data2paper -m https://raw.githubusercontent.com/samvera/hyrax/v2.0.0.rc1/template.rb

  7. OR Clone the Data2paper repository

    1. Clone the repository git clone https://github.com/anusharanganathan/data2paper.git
    2. Install the gems
      bundle install
      
  8. Create a file with the environment variables
    Install rbenv-vars plugin

    cd ~/.rbenv/plugins
    git clone https://github.com/sstephenson/rbenv-vars.git
    cd ~/data2paper/
    

    Generate the secret key for cookies

    rake secret
    

    Create the file for environment variables (using rbenv-vars plugin)

    vim .rbenv-vars
    

    Add the key and values similar to https://github.com/anusharanganathan/data2paper/wiki/Settings-for-rbenv-vars
    Test the file can be read fine with rbenv

    rbenv vars
    
  9. Create the database and run the migrations
    Note Currently need to change the password in config/database.yml

    bundle exec rake db:create
    

    Run the migrations

    bundle exec rake db:migrate
    
  10. Fetch Solr, Fedora and start the application

    bundle exec rails hydra:server
    
  11. Setup an admin user

    • Sign up as a new user at the url /users/sign_up
    • Assign the admin role to the user
    admin = Role.create(name: "admin")
    admin.users << User.find_by_user_key( "your_admin_users_email@fake.email.org" )
    admin.save
    
  12. Run the rake task to disable features not used

    bundle exec rake features:set["show_deposit_agreement:false","active_deposit_agreement_acceptance:false","assign_admin_set:false","batch_upload:false"]
    
  13. Install and configure Sidekiq

    • Restart the rails server (or puma service) and then visit /sidekiq to see the Sidekiq web app

Next: Running Hyrax in development to run the application

Next: Configure SSL certificate using Lets Encrypt with NGinx

Clone this wiki locally