Skip to content
This repository has been archived by the owner on Oct 27, 2018. It is now read-only.

Commit

Permalink
Merge pull request #145 from ualbertalib/issue144
Browse files Browse the repository at this point in the history
configuration changes for env variables; added env variable to enable temp login in production; added Dockerfile to the codebase.
  • Loading branch information
weiweishi committed Apr 11, 2017
2 parents ee2dec3 + 1e8a457 commit 15c2fd6
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 11 deletions.
1 change: 1 addition & 0 deletions .rubocop.yml
Expand Up @@ -83,3 +83,4 @@ RSpec/ExampleLength:

RSpec/MultipleExpectations:
Enabled: false

23 changes: 23 additions & 0 deletions Dockerfile
@@ -0,0 +1,23 @@
FROM ualibraries/ruby_plus2.3.3
# https://github.com/ualbertalib/DIDockerImages/blob/master/RubyPlus/Dockerfile
RUN apt-get update -qq && \
apt-get install -y libpq-dev \
nodejs \
libreoffice-core \
libreoffice-base-core \
libreoffice-common \
imagemagick \
unzip && \
rm -rf /var/lib/apt/lists/*

RUN mkdir /app
WORKDIR /app
ADD . /app
RUN echo "gem 'tinymce-rails-imageupload', github: 'PerfectlyNormal/tinymce-rails-imageupload'" >> /app/Gemfile
RUN cd /app && bundle install
RUN cd /app && rake assets:precompile

CMD rake db:migrate && rails server -b 0.0.0.0

EXPOSE 3000

12 changes: 12 additions & 0 deletions README.md
Expand Up @@ -92,3 +92,15 @@ This is not ideal and hopefully a temporary solution. But currently in developme
Some helpful links for more information:
* http://www.jeesty.com/shibboleth
* https://docs.gitlab.com/ce/integration/shibboleth.html

## Building docker image

You can build docker image for Hydranorth2 following precedure below.
There is a copy of ualibraries/hydranorth2 image that can be pulled
from [dockerhub](https://hub.docker.com/r/ualibraries/hydranorth2/)

```shell
docker build -t ualibraries/hydranorth2 .
```


3 changes: 2 additions & 1 deletion app/controllers/users/omniauth_callbacks_controller.rb
@@ -1,6 +1,7 @@
class Users::OmniauthCallbacksController < ApplicationController
# TODO: Remove this once we figure out IST, this is only required for the omniauth developer provider
skip_before_action :verify_authenticity_token, only: :complete unless Rails.env.production?
skip_before_action :verify_authenticity_token, only: :complete if (Rails.env.development? ||
ENV['ENABLE_TMP_LOGINS'].present?)

def complete
auth_hash = request.env['omniauth.auth']
Expand Down
2 changes: 1 addition & 1 deletion app/views/devise/sessions/new.html.erb
Expand Up @@ -6,7 +6,7 @@
<%= t('.login_button_text') %>
</a>

<%- if Rails.env.development? %>
<%- if Rails.env.development? || ENV['ENABLE_TMP_LOGINS'] %>
<%# TODO: Temporary login form for local development until IST shibboleth issues gets resolved %>
<a href="/auth/developer" class='btn btn-primary'>
Sign in with Developer Account
Expand Down
4 changes: 2 additions & 2 deletions config/blacklight.yml
@@ -1,9 +1,9 @@
development:
adapter: solr
url: <%= ENV['SOLR_DEVELOPMENT_URL'] || 'http://localhost:8983/solr/hydra-development' %>
url: <%= ENV['SOLR_URL'] || 'http://localhost:8983/solr/hydra-development' %>
test: &test
adapter: solr
url: <%= ENV['SOLR_TEST_URL'] || 'http://localhost:8985/solr/hydra-test' %>
url: <%= ENV['SOLR_URL'] || 'http://localhost:8985/solr/hydra-test' %>
production:
adapter: solr
url: <%= ENV['SOLR_URL'] || 'http://localhost:8983/solr/blacklight-core' %>
Expand Down
6 changes: 3 additions & 3 deletions config/fedora.yml
@@ -1,15 +1,15 @@
development:
user: fedoraAdmin
password: fedoraAdmin
url: <%= ENV['FCREPO_DEVELOPMENT_URL'] || 'http://localhost:8984/rest' %>
url: <%= ENV['FCREPO_URL'] || 'http://localhost:8984/rest' %>
base_path: /dev
test:
user: fedoraAdmin
password: fedoraAdmin
url: <%= ENV['FCREPO_TEST_URL'] || 'http://localhost:8986/rest' %>
url: <%= ENV['FCREPO_URL'] || 'http://localhost:8986/rest' %>
base_path: /test
production:
user: fedoraAdmin
password: fedoraAdmin
url: <%= ENV['FCREPO_PROD_URL'] || 'http://localhost:8983/rest' %>
url: <%= ENV['FCREPO_URL'] || 'http://localhost:8983/rest' %>
base_path: /prod
2 changes: 1 addition & 1 deletion config/initializers/omniauth.rb
Expand Up @@ -12,7 +12,7 @@
},
name: 'CCID'

provider :developer unless Rails.env.production?
provider :developer if (Rails.env.development? || ENV['ENABLE_TMP_LOGINS'].present?)

# By default in development mode, omniauth raises an exception when authentication fails
# comment this line if you want to see the stacktrace from the actual provider when in `development`
Expand Down
6 changes: 3 additions & 3 deletions config/solr.yml
@@ -1,7 +1,7 @@
# This is a sample config file that points to a solr server for each environment
development:
url: <%= ENV['SOLR_DEVELOPMENT_URL'] || 'http://localhost:8983/solr/hydra-development' %>
url: <%= ENV['SOLR_URL'] || 'http://localhost:8983/solr/hydra-development' %>
test:
url: <%= ENV['SOLR_TEST_URL'] || 'http://localhost:8985/solr/hydra-test' %>
url: <%= ENV['SOLR_URL'] || 'http://localhost:8985/solr/hydra-test' %>
production:
url: http://your.production.server:8080/bl_solr/core0
url: <%= ENV['SOLR_URL'] || 'http://your.production.server:8080/bl_solr/core0' %>

0 comments on commit 15c2fd6

Please sign in to comment.