Skip to content

Commit 214bc8c

Browse files
authored
Merge pull request #452 from ucfopen/dev/v2-6-0
Dev/v2 6 0
2 parents 7c7d3af + c20ceb4 commit 214bc8c

38 files changed

+1142
-310
lines changed

HEROKU.md

Lines changed: 98 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,15 @@ After clicking the Heroku button above:
1515

1616
1. Create an account (if you don't have one already).
1717
2. Give the app a name.
18-
3. Fill out the `OAUTH2_ID` and `OAUTH2_KEY` fields with dummy data. (We'll fix it later.)
19-
4. Fill out the `OAUTH2_URI` field with `https://yourapp.herokuapp.com/oauth2response.php`. (Replace 'yourapp' with the name you gave in step 2.)
20-
5. Fill out the `CANVAS_NAV_ITEM_NAME` field with the name you would like the app to appear as in the course navigation menu. This is useful if your instance will be use for a pilot. The normal value to use here is ***UDOIT***.
21-
6. (optional) Copy and paste your Google/YouTube API key into the `GOOGLE_API_KEY` field.
22-
7. (optional) Copy and paste your Vimeo API key into the `VIMEO_API_KEY` field.
23-
8. (optional) If you have a Google Analytics account, you can paste your site tracking code into the `GA_TRACKING_CODE` field.
24-
9. (optional) If you would like to enable the Admin Panel, change the `ADMIN_PANEL_ENABLED` field to `true`.
25-
8. Click the Deploy button and wait for the process to complete.
18+
3. Set `OAUTH2_ENFORCE_SCOPES` to true if you have a scoped developer key.
19+
4. Fill out the `OAUTH2_ID` and `OAUTH2_KEY` fields with dummy data. (We'll fix it later.)
20+
5. Fill out the `OAUTH2_URI` field with `https://yourapp.herokuapp.com/oauth2response.php`. (Replace 'yourapp' with the name you gave in step 2.)
21+
6. Fill out the `CANVAS_NAV_ITEM_NAME` field with the name you would like the app to appear as in the course navigation menu. This is useful if your instance will be use for a pilot. The normal value to use here is ***UDOIT***.
22+
7. (optional) Copy and paste your Google/YouTube API key into the `GOOGLE_API_KEY` field.
23+
8. (optional) Copy and paste your Vimeo API key into the `VIMEO_API_KEY` field.
24+
9. (optional) If you have a Google Analytics account, you can paste your site tracking code into the `GA_TRACKING_CODE` field.
25+
10. (optional) If you would like to enable the Admin Panel, change the `ADMIN_PANEL_ENABLED` field to `true`.
26+
11. Click the Deploy button and wait for the process to complete.
2627

2728
### Step 3: Request a Developer Key
2829
UDOIT uses Oauth2 to take actions on behalf of the user, so you'll need to ask your Canvas administrator to generate a Developer Key for you. (If you are an admin, go to your institution's account administration page in Canvas and click on 'Developer Keys'.) Here is the information you need to provide them:
@@ -33,6 +34,35 @@ UDOIT uses Oauth2 to take actions on behalf of the user, so you'll need to ask y
3334
* This should be `https://yourapp.herokuapp.com/oauth2response.php`. (Replace 'yourapp' with the name of your UDOIT instance on Heroku.)
3435
* ***Icon URL:*** The URL of the UDOIT icon. This is `https://yourapp.herokuapp.com/assets/img/udoit_icon.png`. (Replace ***yourapp*** with the name of your UDOIT instance on Heroku.)
3536

37+
#### Scoped Developer Keys
38+
If you'd like to use this option, you'll need set the following scopes for your developer key.
39+
* Assignments
40+
* url:GET|/api/v1/courses/:course_id/assignments
41+
* url:GET|/api/v1/courses/:course_id/assignments/:id
42+
* url:PUT|/api/v1/courses/:course_id/assignments/:id
43+
* Courses
44+
* url:PUT|/api/v1/courses/:id
45+
* url:GET|/api/v1/courses/:id
46+
* url:POST|/api/v1/courses/:course_id/files
47+
* Discussion Topics
48+
* url:GET|/api/v1/courses/:course_id/discussion_topics
49+
* url:GET|/api/v1/courses/:course_id/discussion_topics/:topic_id
50+
* url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id
51+
* Files
52+
* url:GET|/api/v1/courses/:course_id/files
53+
* url:GET|/api/v1/courses/:course_id/folders/:id
54+
* url:GET|/api/v1/folders/:id/folders
55+
* url:GET|/api/v1/folders/:id/files
56+
* Modules
57+
* url:GET|/api/v1/courses/:course_id/modules
58+
* url:GET|/api/v1/courses/:course_id/modules/:module_id/items
59+
* Pages
60+
* url:GET|/api/v1/courses/:course_id/pages
61+
* url:GET|/api/v1/courses/:course_id/pages/:url
62+
* url:PUT|/api/v1/courses/:course_id/pages/:url
63+
* Users
64+
* url:GET|/api/v1/users/:user_id/profile
65+
3666
### Step 4: Add your Developer Key to UDOIT
3767
1. In Heroku, click the 'Manage App' button for your install of UDOIT.
3868
2. Go to the 'Settings' tab.
@@ -43,7 +73,7 @@ UDOIT uses Oauth2 to take actions on behalf of the user, so you'll need to ask y
4373

4474
### Step 5: Install the UDOIT LTI
4575

46-
In Canvas, you can install UDOIT at the course or sub-account levels.
76+
In Canvas, you can install UDOIT at the course or sub-account levels.
4777

4878
1. Click the **Settings** menu item from any course in Canvas.
4979
2. Click the **Apps** tab.
@@ -60,6 +90,8 @@ UDOIT should now be available in the course navigation menu.
6090

6191
# Manual Deploy on Heroku
6292

93+
**Warning: Recommended for advanced users only**
94+
6395
You can use our configuration to launch a new Heroku app using [Heroku's app-setups api](https://devcenter.heroku.com/articles/setting-up-apps-using-the-heroku-platform-api).
6496

6597
You'll have to set some env settings. Peek at [app.json](app.json) for any env vars that don't have `"required": false` set. Our config vars are covered in [Configure section](#configure)
@@ -79,7 +111,7 @@ curl -n -X POST https://api.heroku.com/app-setups \
79111

80112
Read the result to make sure it returned an id, not an error.
81113

82-
Check your Heroku dashboard or run `heroku apps` to see if a new app shows up. If all goes well, it should be running.
114+
Check your Heroku dashboard or install the [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) and run `heroku apps` to see if a new app shows up. If all goes well, it should be running.
83115

84116

85117
## Configure
@@ -129,6 +161,62 @@ If needed, you can manually run the table creation script: `heroku run composer
129161
## Table Schema
130162
The table schema can be found in [migrations/](migrations/)
131163

164+
# Upgrade an Existing Heroku Installation
165+
166+
When it comes time to update UDOIT to the latest version, you probably don't want to have to start over from scratch using the Heroku Button (as explained above). Luckily, there's a procedure for upgrading an existing installation, which allows you to keep your existing database, settings, and URL.
167+
168+
## First Time Setup
169+
170+
This process takes a while to set up the first time, but is very fast after that. On your computer:
171+
172+
1. Install [Git](https://git-scm.com/downloads)
173+
2. [Configure Git](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup)
174+
3. Install [Heroku CLI](https://devcenter.heroku.com/articles/heroku-cli) and follow the instructions to get your account set up.
175+
4. Clone the UDOIT Git repository. If you are using a command line interface, navigate to a directory where you would like the code to live and run this command: `git clone git@github.com:ucfopen/UDOIT.git`. This will create a folder called `UDOIT` that contains the latest version.
176+
5. In your command line interface, navigate into the newly-created `UDOIT` folder.
177+
6. Run `heroku git:remote --app your-heroku-instance`, replacing `your-heroku-instance` with your actual heroku instance name. For example, if your UDOIT instance resides at `https://udoit-pcu.herokuapp.com`, you would run `heroku git:remote --app udoit-pcu`. This adds your Heroku instance as a ***remote*** called `heroku` in the Git repository so that you can push updates to it in the future.
178+
179+
## Pushing Updates to Heroku
180+
181+
Now that your computer is set up, you only need to follow these steps each time you would like to update your instance of UDOIT:
182+
183+
1. In your command line interface, navigate to the `UDOIT` directory on your computer.
184+
2. Run `git checkout master` to make sure we're on the master branch, which represents the latest version of UDOIT.
185+
3. Run `git pull` to update your local copy of UDOIT from the official GitHub repository.
186+
4. Run `git push heroku master:master` to deploy the new version to your UDOIT instance.
187+
5. Run `heroku run --app your-heroku-instance "php composer.phar migrate"` to update the database structure for your UDOIT instance. (Remember to replace `your-heroku-instance` with your Heroku instance name.)
188+
6. Log into the Heroku website and click on your UDOIT instance.
189+
7. Click **Settings**
190+
8. Under the **Config Vars** heading, click **Reveal Config Vars**.
191+
9. Compare them to the `env` section of [app.json](app.json), and add any missing variables to Heroku.
192+
193+
UDOIT should now be up to date with the latest release!
194+
195+
## Dealing with Multiple Heroku Instances
196+
197+
### First Time Setup (Test Instance)
198+
199+
The sections above assume you only have a single Heroku instance. However, we recommend you always have two instances: one for testing and one for production. That way, you can test out the deploy on your test instance without risking any downtime on your production instance. If you don't have a test instance, just use the [Heroku Button](#heroku-button) to create one. Assuming you set everything up for your production instance in the [First Time Setup](#first-time-setup) section above, here's how to set up your testing instance (sometimes called "staging" or "QA"):
200+
201+
1. In your command line interface, navigate to the `UDOIT` directory on your computer.
202+
2. Run `heroku git:remote --remote test --app your-heroku-test-instance`, replacing `your-heroku-test-instance` with your actual heroku test instance name. For example, if your UDOIT instance resides at `https://udoit-pcu-test.herokuapp.com`, you would run `heroku git:remote --remote test --app udoit-pcu-test`. This adds your Heroku test instance as a ***remote*** called `test` in the Git repository so that you can push updates to it in the future.
203+
204+
Feel free to name the remote anything you want. It doesn't have to be `test`; it could be `staging` or `qa` or `blah`. It's best to make it something descriptive, though.
205+
206+
### Pushing Updates to the Test Instance
207+
208+
Now that you have the connection to the test instance set up, here's how to push an update to it:
209+
210+
1. In your command line interface, navigate to the `UDOIT` directory on your computer.
211+
2. Run `git checkout master` to make sure we're on the master branch, which represents the latest version of UDOIT.
212+
3. Run `git pull` to update your local copy of UDOIT from the official GitHub repository.
213+
4. Run `git push test master:master` to deploy the new version to your UDOIT test instance.
214+
5. Run `heroku run --app your-heroku-test-instance "php composer.phar migrate"` to update the database structure for your UDOIT test instance. (Remember to replace `your-heroku-test-instance` with your Heroku test instance name.)
215+
6. Log into the Heroku website and click on your UDOIT test instance.
216+
7. Click **Settings**
217+
8. Under the **Config Vars** heading, click **Reveal Config Vars**.
218+
9. Compare them to the `env` section of [app.json](app.json), and add any missing variables to Heroku.
219+
132220
# FAQ
133221

134222
## Why aren't my scans completing?

README.md

Lines changed: 46 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ To start the Heroku deployment process, you can click the button below, please n
5454
* PHP 7.1, 7.2 (Not yet compatible with 7.3. See issue #422)
5555
* [GD Graphics Library](http://php.net/manual/en/book.image.php)
5656
* MySQL or PostgreSQL
57+
* Git (If you are using [The Git Method](#the-git-method) below) or if you plan on contributing to UDOIT
5758

5859
## Downloading the Source Code
5960
There are two methods of obtaining the source code and maintaining your installation of UDOIT: Git Clone or Download ZIP.
@@ -81,7 +82,7 @@ If you'd like to add a little extra security to your installation, you can confi
8182
UDOIT uses [Composer](https://getcomposer.org/) to install PHP dependencies. So `cd` into your UDOIT directory and run this command before anything else:
8283

8384
```
84-
$ php composer.phar install
85+
$ php composer.phar install --no-dev
8586
```
8687

8788
The libraries (other then Quail) that we rely on can be found in `composer.json`.
@@ -150,11 +151,49 @@ UDOIT uses Oauth2 to take actions on behalf of the user, so you'll need to ask y
150151
* If you did a normal install into the web root of your server, it would be `https://www.example.com/public/oauth2response.php`. (Replace 'www.example.com' with the url of your UDOIT server.)
151152
* ***Icon URL:*** The URL of the UDOIT icon. This is `https://www.example.com/public/assets/img/udoit_icon.png`. (Replace 'www.example.com' with the url of your UDOIT server.)
152153

154+
Your Canvas administrator will perform the following tasks:
155+
1. Navigate to your institution's ***Account Admin panel*** in Canvas.
156+
2. Click on the ***Developer Keys*** menu option.
157+
3. Click the ***+ Developer Key*** button and select the ***API Key*** option.
158+
4. Enter the data provided above into the form, leaving the ***Redirect URI (Legacy)*** and ***Vendor Code (LTI 2)*** fields blank.
159+
5. (Optional) If you would like to Enforce Scopes on this developer key, which limits this Developer Key to only allow access to the functions UDOIT requires, enable the option and check the boxes outlined in the [Scoped Developer Keys](#scoped-developer-keys) section below.
160+
6. Click ***Save Key***
161+
7. Find the new Developer Key in the list, and send the values from the ***Details*** column to the person requesting the key. The top value is the ***Oauth2 ID***, and the value revealed by clicking on the ***Show Key*** button is the ***Oauth2 Key***.
162+
153163
After you receive your Developer Key from your Canvas admin, edit the following variables in `config/localConfig.php`:
154164

155-
* `$oauth2_id`: The Client_ID yoru Canvas admin gives you
156-
* `$oauth2_key`: The Secret your Canvas admin gives you
157-
* `$oauth2_uri`: The Redirect URI you provided to your Canvas admin
165+
* `$oauth2_id`: The ***Oauth2 ID*** your Canvas admin gives you
166+
* `$oauth2_key`: The ***Oauth2 Key*** your Canvas admin gives you
167+
* `$oauth2_uri`: The ***Redirect URI*** you provided to your Canvas admin
168+
169+
#### Scoped Developer Keys
170+
If you'd like to use this option, you'll need set the following scopes for your developer key.
171+
* Assignments
172+
* url:GET|/api/v1/courses/:course_id/assignments
173+
* url:GET|/api/v1/courses/:course_id/assignments/:id
174+
* url:PUT|/api/v1/courses/:course_id/assignments/:id
175+
* Courses
176+
* url:PUT|/api/v1/courses/:id
177+
* url:GET|/api/v1/courses/:id
178+
* url:POST|/api/v1/courses/:course_id/files
179+
* Discussion Topics
180+
* url:GET|/api/v1/courses/:course_id/discussion_topics
181+
* url:GET|/api/v1/courses/:course_id/discussion_topics/:topic_id
182+
* url:PUT|/api/v1/courses/:course_id/discussion_topics/:topic_id
183+
* Files
184+
* url:GET|/api/v1/courses/:course_id/files
185+
* url:GET|/api/v1/courses/:course_id/folders/:id
186+
* url:GET|/api/v1/folders/:id/folders
187+
* url:GET|/api/v1/folders/:id/files
188+
* Modules
189+
* url:GET|/api/v1/courses/:course_id/modules
190+
* url:GET|/api/v1/courses/:course_id/modules/:module_id/items
191+
* Pages
192+
* url:GET|/api/v1/courses/:course_id/pages
193+
* url:GET|/api/v1/courses/:course_id/pages/:url
194+
* url:PUT|/api/v1/courses/:course_id/pages/:url
195+
* Users
196+
* url:GET|/api/v1/users/:user_id/profile
158197

159198
### Google/YouTube API Key
160199
In order for UDOIT to scan YouTube videos for closed captioning, you will need to create a YouTube Data API key. Follow the instructions below:
@@ -273,6 +312,9 @@ The `Deploy to Heroku` button installs the latest release of UDOIT when clicked.
273312
* Allow inbound traffic from world to UDOIT on 80 and 443
274313
* Allow outbound traffic from UDOIT to Canvas on 443
275314

315+
### Why am I recieving a "Due to LMS limitations, UDOIT is unable to scan this section." error?
316+
When an institution installs UDOIT and uses a scoped developer key, certain features of the Canvas API are unavailable to UDOIT, including retrieving content from the Syllabus tool. This limitation does not affect UDOIT installations that use a non-scoped developer key. For more information, refer to the "Canvas API Includes" section of the <a href="https://canvas.instructure.com/doc/api/file.developer_keys.html">Canvas API Documentation</a>.
317+
276318
# Developing and Testing
277319

278320
For quick local development, set `$UDOIT_ENV = ENV_DEV;` in `config/localConfig.php`. This flag disables authentication and allows you to quickly see a sample test report for most template, js, and css development. Use this along with the quick dev server below.

app.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
"description": "Full url to your oauth2responce.php file",
4343
"value": "https://your.herokuapp.com/oauth2response.php"
4444
},
45+
"OAUTH2_ENFORCE_SCOPES": {
46+
"description": "Set to true if you have a scoped developer key",
47+
"value": "false"
48+
},
4549
"GOOGLE_API_KEY": {
4650
"description": "Google API key for caption detection support",
4751
"required": false
@@ -58,6 +62,10 @@
5862
"description": "needed to use the Heroku configuration",
5963
"value": "true"
6064
},
65+
"USE_API_CACHING": {
66+
"description": "Flag to indicate whether or not to use the api caching feature",
67+
"required": false
68+
},
6169
"CANVAS_NAV_ITEM_NAME" : {
6270
"description": "The text displayed in the canvas navigation menu to launch this app",
6371
"value": "UDOIT"

config/herokuConfig.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@
1010
$oauth2_id = getenv('OAUTH2_ID');
1111
$oauth2_key = getenv('OAUTH2_KEY');
1212
$oauth2_uri = getenv('OAUTH2_URI');
13+
$oauth2_enforce_scopes = (getenv('OAUTH2_ENFORCE_SCOPES')) == 'true';
14+
15+
/* Set session cookie options */
16+
$session_cookie_options = [
17+
'expire' => getenv('SESSION_COOKIE_EXPIRE') ?: 0,
18+
'path' => getenv('SESSION_COOKIE_PATH') ?: '/',
19+
'domain' => getenv('SESSION_COOKIE_DOMAIN') ?: null,
20+
'secure' => getenv('SESSION_COOKIE_SECURE') ?: true,
21+
'httponly' => getenv('SESSION_COOKIE_HTTPONLY') ?: false,
22+
];
1323

1424
/* Tool name for display in Canvas Navigation */
1525
$canvas_nav_item_name = getenv('CANVAS_NAV_ITEM_NAME');
@@ -55,6 +65,9 @@
5565
/* Google Analytics Tracking Code */
5666
define('GA_TRACKING_CODE', getenv('GA_TRACKING_CODE')?:'');
5767

68+
/* Flag for API Caching */
69+
define('USE_API_CACHING', getenv('USE_API_CACHING')?:'');
70+
5871
// Fix some issues caused by the heroku load balancer
5972
// The OAUTH signature verification doesn't know it's using https w/o this
6073
if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') {

config/localConfig.template.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,25 @@
55
$shared_secret = '';
66

77
/* Canvas Developer Key Oauth 2.0 Settings */
8-
$oauth2_id = ''; // Provided by your Canvas Admin
9-
$oauth2_key = ''; // Provided by your Canvas Admin
10-
$oauth2_uri = ''; // EX: https://udoit.my-org.edu/oauth2response.php or https://udoit.my-org.edu/udoit/public/oauth2response.php
8+
$oauth2_id = ''; // Provided by your Canvas Admin
9+
$oauth2_key = ''; // Provided by your Canvas Admin
10+
$oauth2_uri = ''; // EX: https://udoit.my-org.edu/oauth2response.php or https://udoit.my-org.edu/udoit/public/oauth2response.php
11+
$oauth2_enforce_scopes = false; // Set to true if you have a scoped developer key.
12+
13+
/* Set session cookie options
14+
* expire - the cookie expiration time in seconds (0 means it does not expire)
15+
* path - the applications on this domain to which the cookie is visible
16+
* domain - the domain to which this cookie is visible
17+
* secure - 'true' to send the cookie only over secure connections
18+
* httponly - 'true' to set the 'httponly' flag when setting the cookie
19+
*/
20+
$session_cookie_options = [
21+
'expire' => getenv('SESSION_COOKIE_EXPIRE') ?: 0,
22+
'path' => getenv('SESSION_COOKIE_PATH') ?: '/',
23+
'domain' => getenv('SESSION_COOKIE_DOMAIN') ?: null,
24+
'secure' => getenv('SESSION_COOKIE_SECURE') ?: true,
25+
'httponly' => getenv('SESSION_COOKIE_HTTPONLY') ?: false,
26+
];
1127

1228
/* Disable headings check character count */
1329
$doc_length = '1500';
@@ -34,6 +50,9 @@
3450
/* Google Analytics Tracking Code */
3551
define('GA_TRACKING_CODE', '');
3652

53+
/* Flag for API Caching */
54+
define('USE_API_CACHING', '');
55+
3756
/* Database Config */
3857
$db_type = 'mysql'; // 'mysql' or 'pgsql'
3958
$db_host = ''; // localhost or some other domain/ip

config/localConfig.test.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@
3030
/* Vimeo API Key */
3131
define('VIMEO_API_KEY', 'TEST_VIMEO_KEY');
3232

33+
/* Course Language */
34+
define('COURSE_LANGUAGE', 'TEST_COURSE_LANGUAGE');
35+
36+
/* Flag for API Caching */
37+
define('USE_API_CACHING', 'false');
38+
3339
/* Database Config */
3440
$db_type = 'test'; // 'mysql' or 'pgsql'
3541
$db_host = ''; // localhost or ip

0 commit comments

Comments
 (0)