Skip to content

Installation: Configure the Rails Application

acozine edited this page Mar 11, 2014 · 39 revisions

Notes

Configure the Rails Application to make sure that all the parts of the system are working together. This step includes the secret token, the Fits path, Solr configuration, the temporary transcoding directory, storage management, and more.

Steps

  1. Enable the secret token for the site by completing the steps below.

    1. Generate a string for the secret token by entering the command cd /opt/$HYDRA_NAME && bundle exec rake secret in the terminal window.
    2. Copy /opt/$HYDRA_NAME/config/initializers/secret_token.rb.sample to /opt/$HYDRA_NAME/config/initializers/secret_token.rb by entering the command cp /opt/$HYDRA_NAME/config/initializers/secret_token.rb.sample /opt/$HYDRA_NAME/config/initializers/secret_token.rb.
    3. Edit secret_token.rb and replace the sample string with the string you just generated.
  2. Enable a different secret token for devise (user authentication) by completing the steps below.

    1. Generate a second string for a different secret token by entering the command cd /opt/$HYDRA_NAME && export DEVISE_SECRET=$(bundle exec rake secret).
    2. Copy /opt/$HYDRA_NAME/config/initializers/devise.rb.sample to /opt/$HYDRA_NAME/config/initializers/devise.rb cp /opt/$HYDRA_NAME/config/initializers/devise.rb.sample /opt/$HYDRA_NAME/config/initializers/devise.rb.
    3. Replace the sample string with the string you just generated by entering the command sed -i.bak s/key\ =\ \'.*\'/key\ =\ \'$DEVISE_SECRET\'/g /opt/$HYDRA_NAME/config/initializers/devise.rb
  3. Symlink the solrconfig.xml and schema.xml files from the application into Solr by entering the commands:

     sudo ln -sf /opt/$HYDRA_NAME/solr_conf/conf/schema.xml /opt/solr/$HYDRA_NAME/collection1/conf/schema.xml  
     sudo ln -sf /opt/$HYDRA_NAME/solr_conf/conf/solrconfig.xml /opt/solr/$HYDRA_NAME/collection1/conf/solrconfig.xml  
  4. Set the Fits path for sufia by entering the command sed -i.bak "s/\/home\/ubuntu\/fits-0\.6\.1\/fits\.sh/\/usr\/local\/bin\/fits\.sh/g" /opt/$HYDRA_NAME/config/initializers/sufia.rb.

  5. Create and configure the temporary directory for transcoding to use the default directory by entering the command mkdir /opt/hydradam_tmp.
    To use a different directory name, edit /opt/$HYDRA_NAME/config/initializers/sufia.rb and change the config.temp_file_base setting to your preferred name, then create your directory. The temporary transcoding directory should be owned by $USER.

  6. If you are using the local filesystem for storage, skip this step. The storage manager setting determines what kind of storage hydra expects for your fedora objects. The default setting is "NullStorageManager", which means you're using the local filesystem. If you are using an HSM to store your fedora objects, you must edit /opt/$HYDRA_NAME/config/application.rb and change the config.storage_manager line to config.storage_manager = 'SamfsStorageManager'.

  7. Prepare the databases & assets by entering the commands:

    cd /opt/$HYDRA_NAME  
    RAILS_ENV=production bundle exec rake db:migrate  
    RAILS_ENV=production bundle exec rake assets:precompile  
    
  8. Make the Apache user own the passenger temp and xsendfile directories using the command
    Ubuntu: sudo chown www-data:www-data /opt/passenger_temp /opt/xsendfile
    CentOS: sudo chown apache:apache /opt/passenger_temp /opt/xsendfile

  9. Restart tomcat using the command
    Ubuntu: sudo service tomcat7 restart
    CentOS: sudo service tomcat6 restart

  10. Restart apache using the command
    Ubuntu: sudo service apache2 restart
    CentOS: sudo service httpd restart

Verification Steps

  1. Open a browser and navigate to the home page of your application. You should see the default HydraDAM home page.

Next Step

Proceed to Create an Admin User or return to the Overview page.

Clone this wiki locally