Skip to content

Setup Notes

jkim-ru edited this page Jan 9, 2018 · 4 revisions

This page describes how to set up the necessary environment parameters and two config files necessary for running the ccql application in development.

ENV parameters

The code currently expects some ENV parameters to be set prior to starting the application. The following snippet shows a few of them. Feel free to create your own script.

#!/usr/bin/env bash

export ADMIN_MAILER_ADMIN_EMAIL='please.change.me@example.org'
export ADMIN_MAILER_LOGIN_URL='http://example.org/login'
export ADMIN_MAILER_DEFAULT_FROM='no-reply@datacollaboratory.org'
export ACTION_MAILER_DEFAULT_FROM='no-reply@datacollaboratory.org'
export MAILBOXER_DEFAULT_FROM='no-reply@datacollaboratory.org'
export DEVISE_MAILER_SENDER='please.change.me@example.org'
export HYRAX_CONTACT_EMAIL='please.change.me@example.org'
export REDIS_DEV_HOST='https://example.org'

config/secrets.yml

For the dev environment, you'll need to create a config/secrets.yml file in order to run your application. This file will be added to the .gitignore. Here is an example below:

# Be sure to restart your server when you modify this file.

# Your secret key is used for verifying the integrity of signed cookies.
# If you change this key, all old signed cookies will become invalid!

# Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks.
# You can use `rails secret` to generate a secure secret key.

# Make sure the secrets in this file are kept private
# if you're sharing your code publicly.

development:
  secret_key_base: <%= ENV["DEV_SECRET_KEY_BASE"] %> 
test:
  secret_key_base: <%= ENV["TEST_SECRET_KEY_BASE"] %>

# Do not keep production secrets in the repository,
# instead read values from the environment.
production:
  secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>

Replace <%= ENV["DEV_SECRET_KEY_BASE"] %> with your own generated secret key before starting your application or make sure it's set in your environment.

config/role_map.yml

For the dev environment, you'll need to create a config/role_map.yml file to get access to the administrative functions. This role map will be added to the .gitignore, so you may need to create your own. This file is useful for setting up the admin users. See the example below:

development:
  admin:
    - your_email@here.com
  archivist:
    - archivist1@example.com

test:
  archivist:
    - archivist1@example.com
    - archivist2@example.com
    - leland_himself@example.com
  admin_policy_object_editor:
    - archivist1@example.com
  donor:
    - donor1@example.com
    - leland_himself@example.com
  researcher:
    - archivist1@example.com
    - researcher1@example.com
  patron:
    - patron1@example.com
    - leland_himself@example.com

production:
  # Add roles for users here.

Replace your_email@here.com with the email you used to create your account, and you'll be given admin privileges.