Skip to content

Hyku Test Environment Setup

Tim Donohue edited this page Oct 30, 2017 · 13 revisions

EC2 Server Setup

  1. Launch new Ubuntu 16.04 EC2 instance

    • 50GB space
    • Minimally open port 3000 (Rails port) and 8983 (Solr port)
  2. Install base prerequisites

    sudo apt-get -y update && sudo apt-get -y upgrade
    sudo apt-get -y install build-essential
    sudo apt-get -y install wget curl unzip
    
  3. Install Java 8

    sudo apt-get install --yes default-jdk
    
  4. Install Ruby, Rails, Imagemagick, Redis, etc

    sudo apt-get -y install imagemagick libreadline-dev libyaml-dev libsqlite3-dev nodejs zlib1g-dev libsqlite3-dev redis-server
    sudo apt-get -y install ruby ruby-dev
    sudo gem install bundler rails --no-ri --no-rdoc
    
  5. Install Postgres & setup "ubuntu" as a superuser

    sudo apt-get -y install postgresql-common postgresql libpq-dev
    sudo -u postgres createuser ubuntu --superuser
    
  6. Install FITS (currently v1.0.5) and add to PATH

    curl http://projects.iq.harvard.edu/files/fits/files/fits-1.0.5.zip -o fits.zip
    unzip fits.zip
    chmod a+x fits-1.0.5/*.sh
    echo "PATH=\${PATH}:$HOME/fits-1.0.5" >> ~/.bashrc
    rm fits.zip
    
  7. Install Solr v7.1.0 to /opt/solr and add to PATH

    cd /opt
    sudo wget http://apache.claz.org/lucene/solr/7.1.0/solr-7.1.0.tgz
    sudo tar xzf solr-7.1.0.tgz solr-7.1.0/bin/install_solr_service.sh --strip-components=2
    sudo bash ./install_solr_service.sh solr-7.1.0.tgz
    sudo rm solr-7.1.0.tgz
    sudo rm install_solr_service.sh
    echo "PATH=\${PATH}:/opt/solr/bin" >> ~/.bashrc
    
  8. Install Tomcat 8 (to /etc/tomcat8, /var/lib/tomcat8, and /usr/share/tomcat8)

    sudo apt-get install tomcat8
    
  9. Install Fedora 4

    cd /var/lib/tomcat8/webapps/
    sudo wget https://github.com/fcrepo4/fcrepo4/releases/download/fcrepo-4.7.4/fcrepo-webapp-4.7.4.war
    
    • Edit the /etc/default/tomcat8 file and add this:
    JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/file-simple/repository.json"
    
    • Create the default Fedora home directory (/var/lib/tomcat8/fcrepo4-data/) & give Tomcat permissions to it.
    cd /var/lib/tomcat8
    sudo mkdir fcrepo4-data
    sudo chown tomcat8:tomcat8 fcrepo4-data
    
    • Finally, restart Tomcat. Fedora should now be at http://[ec2-server]:8080/fcrepo-webapp-4.7.4/rest/
    sudo service tomcat8 restart
    
  10. Install Hyku (to $HOME/hyku), in default single-tenant & development mode

    git clone https://github.com/samvera-labs/hyku.git hyku
    cd hyku
    bundle install
    bundle exec rake db:create
    bundle exec rake db:migrate
    
  11. Create a Solr Collection/Core for Hyku (named hyku-development), as the solr user

    sudo -u solr bash -c '/opt/solr/bin/solr create -c hyku-development -d /home/ubuntu/hyku/solr/config -p 8983'
    
  12. Startup Hyku to test it out

    cd ~/hyku/
    SOLR_URL="http://127.0.0.1:8983/solr/hyku-development" FEDORA_URL="http://127.0.0.1:8080/fcrepo-webapp-4.7.4/rest/" bundle exec rails server -b 0.0.0.0 -p 3000
    
  13. Visit http://[ec2-server-url]:3000/ to see if it works!

  14. Create default AdminSet (if not autocreated)

    SOLR_URL="http://127.0.0.1:8983/solr/hyku-development" FEDORA_URL="http://127.0.0.1:8080/fcrepo-webapp-4.7.4/rest/" bundle exec rake hyrax:default_admin_set:create
    
  15. Optionally, create start/stop scripts

    • Here's a very simple start-hyku script, based on the above setup:
    #!/bin/sh
    cd $HOME/hyku
    # Start Rails server on port 3000, using provided Solr and Fedora URLs
    # Logs to ~/hyku/hyku.log
    # Uses nohup to keep running even after logout
    SOLR_URL="http://127.0.0.1:8983/solr/hyku-development" FEDORA_URL="http://127.0.0.1:8080/fcrepo-webapp-4.7.4/rest/" nohup bundle exec rails server -b 0.0.0.0 -p 3000 > hyku.log 2>&1 &
    
    • Here's a very simple stop-hyku script, which just kills whatever is running on port 3000:
    #!/bin/sh
    # To stop Hyku, we kill whatever process is running on port 3000
    kill -9 $(lsof -i tcp:3000 -t)
    
Clone this wiki locally