Skip to content

Commit

Permalink
Tlkar2 22 (#15)
Browse files Browse the repository at this point in the history
* TLKAR2-22: standardize for multiple OpenShift configurations.

* Correct typo in link

* TLKAR2-22: correct documentation in secret upload.
  • Loading branch information
dlhaines authored Nov 28, 2017
1 parent efd81ca commit 53750d2
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 5 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ A template for a secrets file is in the the configuration directory.
That template shouldn't be modified but should be copied and that copy
should be read from the separate secure directory.

When running locally the *startup.sh* script assumes that the
secrets.py file is available in the subdirectory *./OPT/SECRETS*.
That reference can be a symbolic link to the actual location. On
OpenShift the location will be set in the deployment
configuration. See the OpenShift kartograafr dev project to see how it
is configured.

The template file illustrates how to easily implement an environmental variable
override of the property value. The code given is very likely not the
best way to do this and is likely to be improved soon.
Expand Down
2 changes: 1 addition & 1 deletion config.py
1 change: 0 additions & 1 deletion configuration/config.py

This file was deleted.

File renamed without changes.
45 changes: 45 additions & 0 deletions configuration/configOpenShiftPROD.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
## Configuration for OpenShift Production.

import os


class Application(object):
class Email(object):
DEBUG_LEVEL = False
SMTP_SERVER = 'mail-relay.itd.umich.edu'
SENDER_ADDRESS = '"ArcGIS-Canvas Service" <kartograafr-service@umich.edu>'
RECIPIENT_AT_DOMAIN = '@umich.edu'
SUBJECT = 'ArcGIS-Canvas logs for course ID {courseID}'

class Logging(object):
MAIN_LOGGER_NAME = 'kartograafr'
DIRECTORY = '/var/log/kartograafr'
COURSE_DIRECTORY = os.path.join(DIRECTORY, 'courses')
MAIN_LOG_BASENAME = 'main'
LOG_FILENAME_EXTENSION = '.log'

class Canvas(object):
API_BASE_URL = 'https://umich.instructure.com/api/v1/'

API_AUTHZ_TOKEN = 'NEVEReverWILLyouKNOWmyNAME'

ACCOUNT_ID = 1 # University of Michigan - Ann Arbor ACCOUNT_ID = 306 # Test Account
TARGET_OUTCOME_ID = 4353 # ArcGIS Group
CONFIG_COURSE_ID = 214023 # kartograafr: Canvas/ArcGIS Integration

# Name is found in page's URL. Canvas changes "course_IDs" to "course-ids"
CONFIG_COURSE_PAGE_NAME = 'course-ids'
COURSE_ID_SET = set(( # Used iff IDs are not found in the configuration course page defined above
85489, # Practice Course for Lance Sloan (LANCE PRACTICE)
114488, # First ArcGIS Course (ARCGIS-1)
135885, # Another ArcGIS Course (ARCGIS-2)
))

class ArcGIS(object):
ORG_NAME = 'umich' # For server URL (see below) and appended to ArcGIS usernames (i.e., "user_org")
SECURITYINFO = {
'security_type': 'Portal', # Default: "Portal". "Required option" by bug in some ArcREST versions.
'org_url': 'https://{}.maps.arcgis.com'.format(ORG_NAME),
'username': '',
'password': '',
}
6 changes: 3 additions & 3 deletions os-updateSecret.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#set -x

# if not arguments then print help
if [ $# -eq 0 ]; then
echo "$0: <SECRET_NAME> <DIRECTORY> "
# Must have both arguments.
if [ $# -ne 2 ]; then
echo "usage: $0 <SECRET_NAME in OpenShift> <Local directory> "
echo "Upload secrets to current OS project."
echo "Must supply name that OS will use as the volume name "
echo "and the path to the directory containing the secrets file(s)."
Expand Down
3 changes: 3 additions & 0 deletions startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ SECRETS_DIR=/opt/secrets
# Docker then localize environment settings and insist on there
# already be an active Python virtual environment.

# On OSX this assumes secrets.py is available in the sub-directory
# ./OPT/SECRETS. That file can be a symbolic link to a copy elsewhere.

if [ $(uname) == Darwin ]; then
echo "STARTUP ON OSX"
if [ -z "${VIRTUAL_ENV}" ]; then
Expand Down

0 comments on commit 53750d2

Please sign in to comment.