UC San Diego DAMS Hydra Head
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.capistrano
.circleci
.github
app
bin
config
db
docker
fedora_conf/conf
ingest_templates
lib
log
node_modules
public
script
solr_config
spec
test
vendor
.dockerignore
.editorconfig
.gitignore
.hound.yml
.project
.rspec
.rubocop.yml
.ruby-version
Capfile
Dockerfile
Gemfile
Gemfile.lock
README.md
Rakefile
UC_Copyright_Notice.txt
bower.json
config.ru
unicorn.ru

README.md

Code Climate

Test Coverage

Dependency Status

UC San Diego Library Digital Collections Public Access System.

A Hydra repository backed by DAMS Repository.

Setup Instructions

Windows

Let's not go there.

Apple/OSX

Install Command Line Tools

For Mavericks (10.9): run sudo xcodebuild -license and follow the instructions to accept the XCode agreement. Then run xcode-select --install in your terminal and then click "Install".

XCode Command Line Tools Homebrew Compatibility Chart

Setup Ruby/Rails (OSX)

  1. Install homebrew

    $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
  2. Run brew doctor and fix any issues that are reported before proceeding

    $ brew doctor
  3. Install automake

    $ brew install automake
  4. Install rbenv

    $ brew install rbenv ruby-build rbenv-gem-rehash

    or:

    $ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
    $ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    $ git clone https://github.com/sstephenson/rbenv-gem-rehash.git ~/.rbenv/plugins/rbenv-gem-rehash
  5. Update your .bashrc to use rbenv by default:

    export PATH=$HOME/.rbenv/bin:$PATH
    eval "$(rbenv init -)"
    
  6. Install Ruby 2.2.3 and set as default

    $ rbenv install 2.2.3
    $ rbenv global 2.2.3
    $ gem install bundler
  7. Confirm Ruby 2.2.3 is the default ruby

    $ ruby --version

    _If the version shown is not 2.2.3+, set default directly.

  8. Install Node.js (for updating Javascript libraries with bower)

    $ brew install node
  9. Install phantomJS

    $ brew install phantomjs

Prerequisites

Confirm all commands below return correct versions. Note this can easily get out of date. To be sure, look at the .ruby-version file in the repository.

  • Ruby 2.2.3+ $ ruby -v
  • git $ git --version
  • node $ node --version

Check out DAMSPAS from GIT

  1. Clone Project: git clone https://github.com/ucsdlib/damspas.git
  2. Open Project: cd damspas
  3. Check out develop branch: git checkout develop
  4. Install gems: bundle install For RHEL, need to install packages: automake, gcc-c++, libxml2-devel, libxslt-devel, sqlite-devel.
  5. Update DB: bundle exec rake db:migrate
  6. Update Test DB: bundle exec rake db:migrate RAILS_ENV=test
  7. Run Test Suite: bundle exec rake spec

Running DAMS PAS

WEBrick

The simplest Rails server is the built-in WEBrick. Just run:

$ rails s

And DAMS PAS will be available at http://localhost:3000/

WEBrick has some limitations, in particular it's single-threaded, slow and can't handle streaming large files.

Unicorn

For a faster, multi-threaded webserver that can handle large files, Unicorn is almost as easy:

$ unicorn -p 8081

This will run DAMS PAS at http://localhost:8081/ -- you can specify any port you like, but the default port (8080) is also the default port for Jetty and Tomcat, so you probably need to specify something.

Passenger

Production deployment is typically done using Passenger (mod_rails) paired with Apache or Nginx. This is more complicated to setup, but has the advantage of using the same stack in all environments and being able to use the same configuration.

  1. Install or enable Apache. On MacOSX 10.8 (Mountain Lion), this has been removed from the System Preferences Sharing panel, but can be done using the command line:

    $ sudo defaults write /System/Library/LaunchDaemons/org.apache.httpd Disabled -bool false
  2. Install Passenger gem:

    $ gem install passenger
  3. Install cURL development headers (needed by RHEL):

    $ sudo yum install curl-devel
  4. Install Apache module:

    $ passenger-install-apache2-module
  5. Configure Apache, taking the configuration directives from the module install output, and placing them in a file that will be loaded by Apache. In MacOSX, the file should be in /etc/apache2/other/, in RHEL, it should be in /etc/httpd/conf.d/. This should be named something passenger.conf and look like:

    LoadModule passenger_module /usr/local/var/rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/passenger-4.0.44/buildout/apache2/mod_passenger.so
    PassengerRoot /usr/local/var/rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/passenger-4.0.44
    PassengerDefaultRuby /usr/local/var/rbenv/versions/2.0.0-p481/bin/ruby
    PassengerBufferResponse off # disable buffering to allow streaming large files
    <Directory /var/www/html/damspas>
      Allow from all
      Options -MultiViews
      RackBaseURI /damspas
      RailsEnv "development"
    </Directory>
    
  6. Omniauth ignores the RackBaseURI, so you may want to rewrite the authentication callback URLs without the RackBaseURI:

    RewriteEngine On
    RewriteLog /var/log/apache2/rewrite.log
    RewriteLogLevel 9
    RewriteCond %{REQUEST_URI} /users
    RewriteRule ^/users(.*) /damspas/users/$1 [P,L]
    
  7. Create a symlink from the web space to the public directory of DAMS PAS:

    $ cd /var/www/html
    $ ln -s /path/to/damspas/public damspas

    On MacOSX, the web root will be in /Library/WebServer/Documents by default.

  8. Restart Apache:

    $ sudo apachectl restart

    DAMS PAS will be available at http://localhost/damspas/