-
Notifications
You must be signed in to change notification settings - Fork 5
Setup
Let's not go there.
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
-
Install homebrew
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
Run brew doctor and fix any issues that are reported before proceeding
$ brew doctor
-
Install automake
$ brew install automake
-
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
-
Update your .bashrc to use rbenv by default:
export PATH=$HOME/.rbenv/bin:$PATH eval "$(rbenv init -)"
-
Install Ruby 2.2.3 and set as default
$ rbenv install 2.2.3 $ rbenv global 2.2.3 $ gem install bundler
-
Confirm Ruby 2.2.3 is the default ruby
$ ruby --version
_If the version shown is not 2.2.3+, set default directly.
-
Install Node.js (for updating Javascript libraries with bower)
$ brew install node
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
- Clone Project:
git clone https://github.com/ucsdlib/damspas.git
- Open Project:
cd damspas
- Check out develop branch:
git checkout develop
- Copy DB Sample:
cp config/database.yml.sample config/database.yml
- Copy Fedora Sample:
cp config/fedora.yml.sample config/fedora.yml
- Copy Solr Sample:
cp config/solr.yml.sample config/solr.yml
- Copy Devise initializer:
cp config/initializers/devise.rb.sample config/initializers/devise.rb
- Copy Secret Token Sample:
cp config/initializers/secret_token.rb.sample config/initializers/secret_token.rb
- Edit
config/initializers/secret_token.rb
and replace the long hex string with a new random string (you can generate a new random key withrake secret
oropenssl rand 64 -hex
). - Edit the
wowza_directory
property inconfig/environments/test.rb
to point to a dummystreaming.key
file on your local machine - Install gems:
bundle install
For RHEL, need to install packages: automake, gcc-c++, libxml2-devel, libxslt-devel, sqlite-devel. - Update DB:
bundle exec rake db:migrate
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.
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.
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.
-
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
-
Install Passenger gem:
$ gem install passenger
-
Install cURL development headers (needed by RHEL):
$ sudo yum install curl-devel
-
Install Apache module:
$ passenger-install-apache2-module
-
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 somethingpassenger.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>
-
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]
-
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.
-
Restart Apache:
$ sudo apachectl restart
DAMS PAS will be available at http://localhost/damspas/