Skip to content

Commit

Permalink
Merge pull request #102 from blackboard/feature/redo-storage-setup
Browse files Browse the repository at this point in the history
Feature/redo storage setup
  • Loading branch information
ewpreston authored Sep 30, 2021
2 parents 5429662 + 95d7a8b commit 16cabdc
Show file tree
Hide file tree
Showing 68 changed files with 8,093 additions and 8,191 deletions.
35 changes: 28 additions & 7 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,35 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": 3
}
],
[
"@babel/preset-react"
]
],
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-transform-classes",
"@babel/plugin-transform-flow-strip-types",
"@babel/plugin-transform-modules-commonjs",
"@babel/transform-runtime"
"@babel/plugin-syntax-dynamic-import",
["babel-plugin-import",
{
"libraryName": "@material-ui/core",
"libraryDirectory": "",
"camel2DashComponentName": false
},
"core"
],
[
"babel-plugin-import",
{
"libraryName": "@material-ui/icons",
"libraryDirectory": "",
"camel2DashComponentName": false
},
"icons"
]
]
}
54 changes: 54 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"env": {
"browser": true,
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"single"
],
"semi": [
"error",
"always"
],
"array-bracket-spacing": [
"warn",
"always"
],
"jsx-quotes": [
"warn",
"prefer-single"
],
"react/display-name": [
"off"
]
},
"ignorePatterns": [
"*.md",
"/server/database/**/*.json"
]
}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
bower_components
**/public/dist
**/server/lib
/server/src/database/auth-data.json
/server/src/database/cim-data.json

# Created by https://www.gitignore.io/api/node,eclipse

Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:10.16.1
FROM node:12

# Create app directory
RUN mkdir -p /usr/app
Expand All @@ -11,5 +11,7 @@ RUN npm install
# Bundle app source
COPY . /usr/app

VOLUME /data

EXPOSE 3000
CMD ./launch.sh
18 changes: 4 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# BBDN-LTI-Tool-Provider-Node
This project is a multi-purpose application designed to demonstrate several integration methods available with Blackboard Learn. The application is an LTI 1.1, LTI 1.3, and Advantage Tool Provider. It also has code to emit Caliper events, as well as act as a very basic caliper eventstore.
This project is a multi-purpose application designed to demonstrate several integration methods available with Blackboard Learn. The application is an LTI 1.1, LTI 1.3, and Advantage Tool Provider. It also has code to emit Caliper events, as well as act as a very basic caliper eventstore.

Upon launch of the LTI Tool, the user is given a few options:

Expand All @@ -13,8 +13,6 @@ Upon launch of the LTI Tool, the user is given a few options:

## Requirements
- [Node and npm](http://nodejs.org) - Installing node on Windows requires installing a number of additional packages. It will warn you and if you don't want the script to do it automatically, the installer will give you a link to instructions to run the installs manually.
- [Redis](http:redis.io) - On Mac it's easiest to `brew install redis`. The code assumes the default
host and port (localhost:6379). On Windows, its easiest to use docker. Running `docker pull redis` will download the latest redis release in a docker image that you can run as required. If you need to run redis on a different host or port, update your config_override.json

## Configuration
You can override a number of configuration properties by creating a config_override.json file in server/config. Below is an example:
Expand All @@ -23,8 +21,6 @@ You can override a number of configuration properties by creating a config_overr
{
"frontend_url": "https://example.com/"
"provider_port": "9008",
"redis_host": "localhost",
"redis_port": 6379
}
```

Expand Down Expand Up @@ -61,13 +57,7 @@ Implementation of IMS Global LTI v1.3 and LTI Advantage.

A screencast of the rough LTI Advantage setup is shown in [Eric Preston's demo at 23:00](https://us.bbcollab.com/recording/e193c6cb59cb4ed1a776c271665d4154).

1. Install and start redis

On Mac it's easiest to `brew install redis`. The code assumes the default host and port (localhost:6379).

On Windows, it's easiest to use the redis docker image. With Docker Desktop installed, at a command prompt, run `docker pull redis` and then `docker run -p 6379:6379 --name lti-redis -d redis`.

2. Start the server with `npm start`.
1. Start the server with `npm start`.

Check that you can access https://example.com/setup

Expand Down Expand Up @@ -165,7 +155,7 @@ The Deep Linking Request should launch to http://localhost/deepLinkOptions to be

Docker specific files are included (Dockerfile, docker-compose.yml, launch.sh).

Use config_override.json (same entries as config.json) to override `redis_host` from localhost to redis so it can access the redis docker container.
If running the docker image on the same machine as the learn instance then the `docker-compose.yml` needs to contain the ip address of the machine being used.
Use config_override.json (same entries as config.json) to override the default configuration.
If running the docker image on the same machine as the learn instance then the `docker-compose.yml` needs to contain the ip address of the machine being used.

Build the LTI tool container with `docker build -t lti-tool .`. Then start containers using `docker-compose up`.
139 changes: 102 additions & 37 deletions content-item.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!doctype html>
<html>
<html lang="en">
<head>
<style>
body {
body {
font-family: 'Helvetica Neue', Helvetica, Roboto, Aria, sans-serif;
font-size: 14px;
}
Expand All @@ -14,47 +14,112 @@
background-color: lightgreen;
}
</style>
<title>Content Item Message</title>
</head>
<body>

<h2>Content Item test page</h2>

<h3>Post to http://localhost:3000/lti</h3>
<h3>Post to /lti</h3>

<form method="post" action="http://localhost:3000/lti" encType="application/x-www-form-urlencoded">
<table border="1">
<tr><td class="required">lti_message_type *</td><td><input class="required" type="text" name="lti_message_type" value="ContentItemSelectionRequest" size="50" /></td></tr>
<tr><td class="required">lti_version *</td><td><input class="required" type="text" name="lti_version" value="LTI-2p0" size="50" /></td></tr>
<tr><td>user_id</td><td><input type="text" name="user_id" value="29123" size="50" /></td></tr>
<tr><td>roles</td><td><input type="text" name="roles" value="Instructor" size="50" /></td></tr>
<tr><td>lis_person_name_full</td><td><input type="text" name="lis_person_name_full" value="John Logie Baird" size="50" /></td></tr>
<tr><td>lis_person_name_family</td><td><input type="text" name="lis_person_name_family" value="Baird" size="50" /></td></tr>
<tr><td>lis_person_name_given</td><td><input type="text" name="lis_person_name_given" value="John" size="50" /></td></tr>
<tr><td>lis_person_contact_email_primary</td><td><input type="text" name="lis_person_contact_email_primary" value="[email protected]" size="50" /></td></tr>
<tr><td>context_id</td><td><input type="text" name="context_id" value="S3294476" size="50" /></td></tr>
<tr><td>context_type</td><td><input type="text" name="context_type" value="CourseSection" size="50" /></td></tr>
<tr><td>context_title</td><td><input type="text" name="context_title" value="Telecommunications 101" size="50" /></td></tr>
<tr><td>context_label</td><td><input type="text" name="context_label" value="ST101" size="50" /></td></tr>
<tr><td>lis_course_section_sourcedid</td><td><input type="text" name="lis_course_section_sourcedid" value="DD-ST101:C1" size="50" /></td></tr>
<tr><td>tool_consumer_info_product_family_code</td><td><input type="text" name="tool_consumer_info_product_family_code" value="ims" size="50" /></td></tr>
<tr><td>tool_consumer_info_version</td><td><input type="text" name="tool_consumer_info_version" value="1.2" size="50" /></td></tr>
<tr><td>tool_consumer_instance_guid</td><td><input type="text" name="tool_consumer_instance_guid" value="imsglobal.org" size="50" /></td></tr>
<tr><td>tool_consumer_instance_name</td><td><input type="text" name="tool_consumer_instance_name" value="Learning Impact Leadership Institute" size="50" /></td></tr>
<tr><td>launch_presentation_document_target</td><td><input type="text" name="launch_presentation_document_target" value="frame" size="50" /></td></tr>
<tr><td class="required">accept_media_types *</td><td><input class="required" type="text" name="accept_media_types" value="*/*" size="50" /></td></tr>
<tr><td class="required">accept_presentation_document_targets *</td><td><input class="required" type="text" name="accept_presentation_document_targets" value="none,embed,frame,iframe,window,popup,overlay" size="50" /></td></tr>
<tr><td class="required">content_item_return_url *</td><td><input class="required" type="text" name="content_item_return_url" value="https://mylearn.int.bbpd.io" size="50" /></td></tr>
<tr><td>accept_unsigned</td><td><input type="text" name="accept_unsigned" value="false" size="50" /></td></tr>
<tr><td>accept_multiple</td><td><input type="text" name="accept_multiple" value="true" size="50" /></td></tr>
<tr><td>auto_create</td><td><input type="text" name="auto_create" value="false" size="50" /></td></tr>
<tr><td>data</td><td><input type="text" name="data" value="Some opaque TC data" size="50" /></td></tr>
<tr><td>oauth_version</td><td><input type="text" name="oauth_version" value="1.0" size="50" /></td></tr>
<tr><td>oauth_nonce</td><td><input type="text" name="oauth_nonce" value="..." size="50" /></td></tr>
<tr><td>oauth_timestamp</td><td><input type="text" name="oauth_timestamp" value="..." size="50" /></td></tr>
<tr><td>oauth_consumer_key</td><td><input type="text" name="oauth_consumer_key" value="..." size="50" /></td></tr>
<tr><td>oauth_callback</td><td><input type="text" name="oauth_callback" value="about:blank" size="50" /></td></tr>
<tr><td>oauth_signature_method</td><td><input type="text" name="oauth_signature_method" value="HMAC-SHA1" size="50" /></td></tr>
<tr><td>oauth_signature</td><td><input type="text" name="oauth_signature" value="..." size="50" /></td></tr>
<form method="post" action="lti" encType="application/x-www-form-urlencoded">
<table>
<tr><td class="required">lti_message_type *</td><td><label>
<input class="required" type="text" name="lti_message_type" value="ContentItemSelectionRequest" size="50" />
</label></td></tr>
<tr><td class="required">lti_version *</td><td><label>
<input class="required" type="text" name="lti_version" value="LTI-2p0" size="50" />
</label></td></tr>
<tr><td>user_id</td><td><label>
<input type="text" name="user_id" value="29123" size="50" />
</label></td></tr>
<tr><td>roles</td><td><label>
<input type="text" name="roles" value="Instructor" size="50" />
</label></td></tr>
<tr><td>lis_person_name_full</td><td><label>
<input type="text" name="lis_person_name_full" value="John Logie Baird" size="50" />
</label></td></tr>
<tr><td>lis_person_name_family</td><td><label>
<input type="text" name="lis_person_name_family" value="Baird" size="50" />
</label></td></tr>
<tr><td>lis_person_name_given</td><td><label>
<input type="text" name="lis_person_name_given" value="John" size="50" />
</label></td></tr>
<tr><td>lis_person_contact_email_primary</td><td><label>
<input type="text" name="lis_person_contact_email_primary" value="[email protected]" size="50" />
</label></td></tr>
<tr><td>context_id</td><td><label>
<input type="text" name="context_id" value="S3294476" size="50" />
</label></td></tr>
<tr><td>context_type</td><td><label>
<input type="text" name="context_type" value="CourseSection" size="50" />
</label></td></tr>
<tr><td>context_title</td><td><label>
<input type="text" name="context_title" value="Telecommunications 101" size="50" />
</label></td></tr>
<tr><td>context_label</td><td><label>
<input type="text" name="context_label" value="ST101" size="50" />
</label></td></tr>
<tr><td>lis_course_section_sourcedid</td><td><label>
<input type="text" name="lis_course_section_sourcedid" value="DD-ST101:C1" size="50" />
</label></td></tr>
<tr><td>tool_consumer_info_product_family_code</td><td><label>
<input type="text" name="tool_consumer_info_product_family_code" value="ims" size="50" />
</label></td></tr>
<tr><td>tool_consumer_info_version</td><td><label>
<input type="text" name="tool_consumer_info_version" value="1.2" size="50" />
</label></td></tr>
<tr><td>tool_consumer_instance_guid</td><td><label>
<input type="text" name="tool_consumer_instance_guid" value="imsglobal.org" size="50" />
</label></td></tr>
<tr><td>tool_consumer_instance_name</td><td><label>
<input type="text" name="tool_consumer_instance_name" value="Learning Impact Leadership Institute" size="50" />
</label></td></tr>
<tr><td>launch_presentation_document_target</td><td><label>
<input type="text" name="launch_presentation_document_target" value="frame" size="50" />
</label></td></tr>
<tr><td class="required">accept_media_types *</td><td><label>
<input class="required" type="text" name="accept_media_types" value="*/*" size="50" />
</label></td></tr>
<tr><td class="required">accept_presentation_document_targets *</td><td><label>
<input class="required" type="text" name="accept_presentation_document_targets" value="none,embed,frame,iframe,window,popup,overlay" size="50" />
</label></td></tr>
<tr><td class="required">content_item_return_url *</td><td><label>
<input class="required" type="text" name="content_item_return_url" value="https://mylearn.int.bbpd.io" size="50" />
</label></td></tr>
<tr><td>accept_unsigned</td><td><label>
<input type="text" name="accept_unsigned" value="false" size="50" />
</label></td></tr>
<tr><td>accept_multiple</td><td><label>
<input type="text" name="accept_multiple" value="true" size="50" />
</label></td></tr>
<tr><td>auto_create</td><td><label>
<input type="text" name="auto_create" value="false" size="50" />
</label></td></tr>
<tr><td>data</td><td><label>
<input type="text" name="data" value="Some opaque TC data" size="50" />
</label></td></tr>
<tr><td>oauth_version</td><td><label>
<input type="text" name="oauth_version" value="1.0" size="50" />
</label></td></tr>
<tr><td>oauth_nonce</td><td><label>
<input type="text" name="oauth_nonce" value="..." size="50" />
</label></td></tr>
<tr><td>oauth_timestamp</td><td><label>
<input type="text" name="oauth_timestamp" value="..." size="50" />
</label></td></tr>
<tr><td>oauth_consumer_key</td><td><label>
<input type="text" name="oauth_consumer_key" value="..." size="50" />
</label></td></tr>
<tr><td>oauth_callback</td><td><label>
<input type="text" name="oauth_callback" value="about:blank" size="50" />
</label></td></tr>
<tr><td>oauth_signature_method</td><td><label>
<input type="text" name="oauth_signature_method" value="HMAC-SHA1" size="50" />
</label></td></tr>
<tr><td>oauth_signature</td><td><label>
<input type="text" name="oauth_signature" value="..." size="50" />
</label></td></tr>
</table>
<br/>
<input type="submit" value="Submit" />
Expand Down
13 changes: 6 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
lti-tool:
image: lti-tool
links:
- redis
ports:
- "3000:3000"
volumes:
- data

volumes:
data:
external: true
# Entry for /etc/hosts in container so the tool can make calls
# out to the Learn instance. This is for developers when working
# on one machine. The IP address will need to be changed to the
# one currently assigned to the development machine.
environment:
HOST_ENTRY: 10.103.124.51 mylearn.int.bbpd.io

redis:
image: redis
ports:
- "6379:6379"
Loading

0 comments on commit 16cabdc

Please sign in to comment.