Skip to content

Configuring FromThePage For Your Environment

Sara Brumfield edited this page Aug 22, 2019 · 29 revisions

Default URL

Edit config/environments/production.rb and change:

Rails.application.routes.default_url_options[:host] = 'fromthepage.com'

to reflect your server hostname -- URLs in status emails will use this for creating links to your server.

Securing with SSL

After configuring your web server with an SSL certificate, uncomment the following line in config/environments/production.rb:

config.force_ssl = true

SMTP configuration

Edit config/environments/production.rb and add/change the config.action_mailer.smtp_settings

Here's the docs for the settings: http://guides.rubyonrails.org/action_mailer_basics.html#action-mailer-configuration

Here's two examples:

first:

config.action_mailer.smtp_settings = {
    :address   => "smtp.domain.edu",
    :port      => 587, # ports 587 and 2525 are also supported with STARTTLS
    :enable_starttls_auto => true, # detects and uses STARTTLS
    :user_name => "[email protected]",
    :password  => "XXX", # SMTP password is any valid API key
    :authentication => 'login', # Mandrill supports 'plain' or 'login'
    :domain => 'fromthepage.ace.fordham.edu', # your domain to identify your server when connecting
    :openssl_verify_mode  => 'none'
}

config.action_mailer.default_url_options = { host: 'fromthepage.ace.domain.edu' }

second:

config.action_mailer.smtp_settings = {
  :address   => "smtp.host.com",
  :port      => 587, # ports 587 and 2525 are also supported with STARTTLS
  :enable_starttls_auto => true, # detects and uses STARTTLS
  :user_name => "SMTP_Injection",  # 
  :password  => "XXX", # SMTP password is any valid API key
  :authentication => 'login', # 'plain' or 'login', see rails docs for other options
  :domain => 'fromthepage.com', # your domain to identify your server when connecting
}

Test your mail config using:

RAILS_ENV=production rake fromthepage:check_email_config[[email protected]]

Managing Guest Users

To disable guest user transcriptions, add GUEST_TRANSCRIPTION_ENABLED = false to the 01fromthepage.rb initializer

Create a user with the login "guest_user". All "orphaned" guest user interactions get migrated to this account when the rake task runs to clean up guest user accounts.

Rake Task for Guest Account Cleanup (must do to clean up guest accounts for anonymous users) -- run as a cron job:

00 4 * * * /bin/bash -l -c 'cd /home/fromthepage/deployment/current && RAILS_ENV=production bundle exec rake fromthepage:guest_cleanup[1] >> /tmp/cron_log_file 2>&1'

If you want to extend the number of "saves" a guest user can do, you'll need to change the code. See this issue for details: https://github.com/benwbrum/fromthepage/issues/549

Edit config/initializers/01fromthepage.rb

Change the email address for sending system emails.
Add the admin email who should get emails. The primary stakeholder is the right person to use here. If you would like to disable guest user transcriptions, add GUEST_TRANSCRIPTION_ENABLED = false

cron jobs to be run for email reporting

Admin User Email (who is doing what on the system in the last X hours -- 24 here). This will go to the admin emails set in #3, but we strongly suggest it goes to your primary stakeholder (rather than a system administrator).

00 3 * * * /bin/bash -l -c 'cd /home/fromthepage/deployment/current && RAILS_ENV=production bundle exec rake fromthepage:email_stats[24] >> /tmp/cron_log_file 2>&1'

Nightly email of activity for a particular collection in FromThePage. You can specify the collection number (find it in the URL for the collection) and the email address the report should go to.

00 4 * * * /bin/bash -l -c 'cd /home/fromthepage/deployment/current && RAILS_ENV=production bundle exec rake fromthepage:contributor_stats[58,[email protected]] >> /tmp/cron_log_file 2>&1'

external dependency configuration

FromThePage executes a few system commands to do things like run background tasks. Edit production.rb to add constants pointing to RAKE and NEATO, e.g.

RAKE = '/usr/bin/env rake'

NEATO is a module of Graphviz, which will need to be installed on your system (e.g. sudo apt-get install graphviz)

NEATO = '/usr/bin/neato'

Branding

To use a custom logo in place of the FromThePage logo

  1. Edit config/initializers/01fromthepage.rb and set USE_PNG_LOGO = true
  2. drop a logo.png file in app/assets/images
  3. run rake assets:precompile

To use a custom color scheme in place of the FromThePage color scheme, edit the color values in app/assets/stylesheets/base/customer_color_scheme.scss and restart the server.

To change the name of the Dashboard, change the values in config/locales/customer.en.yml

Single Sign On

FromThePage supports Single Sign On via the omniauth gem within devise.

To enable Google OAuth2:

  1. Edit config/initializers/01fromthepage.rb and set ENABLE_GOOGLEOAUTH = true
  2. Set two environment variables with your Google client ID (GOOGLE_CLIENT_ID) and Google Client Secret (GOOGLE_CLIENT_SECRET). For more information on this authentication schema, see the omniauth-google-oauth2 gem documentation.
  3. Add http://your-domain/users/auth/google_oauth2/callback to the Google API credentials Authorized redirect URIs.

To enable SAML based authentication:

  1. Edit config/initializers/01fromthepage.rb and set ENABLE_SAML = true
  2. Set the following fields in config/initializers/devise.rb:

    Devise.setup do |config|

      config.omniauth :saml,

        issuer: 'https://yourdomain/users/auth/saml/metadata',

        idp_cert: ENV['IDP_CERT'],

        idp_sso_target_url: 'https://yourdomain/idp/profile/SAML2/Redirect/SSO',

        attribute_statements: { email: ['urn:oid:0.9.2342.19200300.100.1.3'], name: ['urn:oid:2.16.840.1.113730.3.1.241'] }

    end

Note: You will need to match "name" and "email" to the values returned by the SAML server. For details see the omniauth-saml gem documentation.

After configuring your single sign on, we strongly recommend you modify your landing page to say "LOG IN HERE" by

<h2><a href="/users/auth/saml"><b>Log in with your INSTITUTION ID</b></a></h2>

ReCAPTCHA

You can set up recaptcha by signing up for a recaptcha account and putting the values from there into environment variables:

RECAPTCHA_SITE_KEY

RECAPTCHA_SECRET_KEY

and then restarting FromThePage.