Skip to content

Configuring FromThePage For Your Environment

Sara Brumfield edited this page Nov 14, 2018 · 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

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.

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/01fromthepage.rb to match your environment
    1. IDP_SSO_TARGET_URL = 'your.saml.url'
    2. IDP_CERT = ENV['IDP_CERT']

Note: we expect a "name" and an "email" value to be returned by the SAML server. See the from_omniauth method in app/models/user.rb. For more information on this authentication scheme, see the omniauth-saml gem documentation.

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.