Skip to content

Commit 25cc9e0

Browse files
authored
Merge pull request #368 from ucfopen/dev/v2-3-2
Dev/v2 3 2
2 parents 8076437 + b157315 commit 25cc9e0

37 files changed

+821
-234
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ reports
1313
assets/js/vendor/
1414

1515
config/log.log
16+
17+
docker/nginx.conf
18+
docker/nginx.crt
19+
docker/nginx.key

DOCKER.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# UDOIT for Docker
2+
3+
## Installation Prerequisites
4+
5+
* [Docker](https://docs.docker.com/install/)
6+
* [Docker Compose](https://docs.docker.com/compose/install/)
7+
* [Docker Machine](https://docs.docker.com/machine/install-machine/)
8+
9+
***Note: This guide assumes you have followed the [Installation Guide located in the README.md](README.md#installing-udoit).***
10+
11+
## Host Configuration
12+
13+
### Setup Docker-Machine
14+
15+
Create a docker-machine for UDOIT, get the environment commands for the new machine, and connect your shell to it:
16+
17+
```
18+
$ docker-machine create udoit
19+
$ docker-machine env udoit
20+
$ eval $(docker-machine env udoit)
21+
```
22+
23+
Then, save the IP address for the newly created docker-machine (E.g. `192.168.99.100`):
24+
25+
```
26+
$ docker-machine ip udoit
27+
```
28+
29+
### NGINX Configuration
30+
31+
If `docker/nginx.conf` doesn't exist, create it using a copy of the template:
32+
33+
```
34+
$ cp docker/nginx.template.conf docker/nginx.conf
35+
```
36+
37+
Edit `docker/nginx.conf`' to point to the UDOIT docker-machine's IP address by replacing both instances of
38+
39+
```
40+
localhost
41+
```
42+
43+
with
44+
45+
```
46+
<your_ip_address>
47+
```
48+
49+
Generate SSL certificates according to the naming scheme located in the nginx.conf file (`nginx.key` and `nginx.crt`) or use your own SSL certificates:
50+
51+
```
52+
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout docker/nginx.key -out docker/nginx.crt
53+
```
54+
55+
## Start Services using Docker-Compose
56+
57+
Start PHP, MySQL, and NGINX:
58+
59+
```
60+
$ docker-compose up -d
61+
```
62+
63+
Verify everything works by navigating to
64+
65+
```
66+
https://<your_ip_address>
67+
```
68+
69+
The included `docker-compose.yml` automatically builds the latest images of PHP 7.1-FPM, MySQL, and NGINX.
70+
71+
## Development
72+
73+
### PHP
74+
75+
Execute PHP commands on the server using `docker-compose`:
76+
77+
```
78+
$ docker-compose exec php bash
79+
```
80+
81+
Exit by pressing `Ctrl+P` then `Ctrl+Q`
82+
83+
### MySQL
84+
85+
You may access the MySQL database using either `root` or the preconfigured `udoit` user on `<your_ip_address>` and port `3306`.
86+
87+
#### Root access (not advised)
88+
89+
```
90+
username: root
91+
password: udoit
92+
```
93+
94+
#### User access (recommended)
95+
96+
```
97+
username: udoit
98+
password: udoit
99+
```
100+
101+
## Customization
102+
103+
Docker-Compose allows you to change build images, exposed ports, local file linkages, MySQL user accounts, etc. inside the `docker-compose.yml` file.

README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,12 @@ In order for UDOIT to scan YouTube videos for closed captioning, you will need t
167167
3. Enable ***YouTube Data API V3***
168168
4. Create an ***API key*** credential.
169169

170+
### Vimeo API Key
171+
In order for UDOIT to scan Vimeo videos for closed captioning, you will need to create a Vimeo API key. Follow the instructions below:
172+
173+
1. [Create a new App on Vimeo Developer API](https://developer.vimeo.com/apps/new?source=getting-started), please note you must have a Vimeo Developer account.
174+
2. On your applications "Authentication" page, Generate a new Access Token. (Select the `Public` and `Private` checkboxes for Scopes.)
175+
170176
### Installing the LTI in Canvas
171177
Log into Canvas to add UDOIT:
172178

@@ -266,6 +272,10 @@ $ php composer.phar start
266272

267273
Then open [http://localhost:8000 in a browser](http://localhost:8000).
268274

275+
## Docker
276+
277+
To setup the Docker environment, follow the steps outlined in the [DOCKER.md Readme](DOCKER.md).
278+
269279
## Running Tests
270280
We use phpunit to run unit tests on UDOIT. To run the tests, type the following command:
271281

@@ -305,6 +315,7 @@ Add contributors here and dont forget composer.json!)
305315
* Joe Fauvel
306316
* [John Raible](https://github.com/rebelaide)
307317
* [Kevin Baugh](https://github.com/loraxx753)
318+
* [Sean Hernandez](https://github.com/seanlh)
308319

309320
### Special Thanks
310321

app.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
"WORKER_ENABLED": {
5858
"description": "Enable the background worker (requires you turn on the worker dyno).",
5959
"value": "true"
60+
},
61+
"SCAN_FILE_SIZE_LIMIT": {
62+
"description": "Max file size to scan, anything larger gets set as unscannable.",
63+
"value": "50000000"
64+
},
65+
"ALT_TEXT_LENGTH_LIMIT": {
66+
"description": "Maximum character length for alt-text before the item gets flagged as a warning.",
67+
"value": "125"
6068
}
6169
},
6270
"addons": [

composer.json

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,19 @@
1818
"migrate" : "php bin/run_database_migrations.php",
1919
"start": "php -S localhost:8000 -t public/",
2020

21-
"docker-test": "docker-compose run --rm php71 php composer.phar test",
21+
"docker-test": "docker-compose --file docker/docker-compose.yml run --rm php71 php composer.phar test",
2222
"docker-test-multi": [
23-
"@docker-test-no-coverage-php55",
2423
"@docker-test-no-coverage-php56",
2524
"@docker-test-no-coverage-php70",
2625
"@docker-test-no-coverage-php71"
2726
],
28-
"docker-test-no-coverage-php55": "docker-compose run --rm php55 php composer.phar test-no-coverage",
29-
"docker-test-no-coverage-php56": "docker-compose run --rm php56 php composer.phar test-no-coverage",
30-
"docker-test-no-coverage-php70": "docker-compose run --rm php70 php composer.phar test-no-coverage",
31-
"docker-test-no-coverage-php71": "docker-compose run --rm php71 php composer.phar test-no-coverage",
32-
"docker-test-include-functional": "docker-compose run --rm php71 php composer.phar test-include-functional",
33-
"docker-lint": "docker-compose run --rm php71 php composer.phar lint",
34-
"docker-db-setup": "docker-compose run --rm php71 php composer.phar db-setup",
35-
"docker-start": "docker-compose run --rm php71 php -S localhost:8000 -t public/"
27+
"docker-test-no-coverage-php56": "docker-compose --file docker/docker-compose.yml run --rm php56 php composer.phar test-no-coverage",
28+
"docker-test-no-coverage-php70": "docker-compose --file docker/docker-compose.yml run --rm php70 php composer.phar test-no-coverage",
29+
"docker-test-no-coverage-php71": "docker-compose --file docker/docker-compose.yml run --rm php71 php composer.phar test-no-coverage",
30+
"docker-test-include-functional": "docker-compose --file docker/docker-compose.yml run --rm php71 php composer.phar test-include-functional",
31+
"docker-lint": "docker-compose --file docker/docker-compose.yml run --rm php71 php composer.phar lint",
32+
"docker-db-setup": "docker-compose --file docker/docker-compose.yml run --rm php71 php composer.phar db-setup",
33+
"docker-start": "docker-compose --file docker/docker-compose.yml run --rm php71 php -S localhost:8000 -t public/"
3634

3735
},
3836
"repositories" : [
@@ -54,7 +52,7 @@
5452
}
5553
],
5654
"require": {
57-
"php": "^5.4.0 || ^5.5.0 || ^5.6.0 || ^7.0.0 || ^7.1.0",
55+
"php": "^5.6.0 || ^7.0.0 || ^7.1.0",
5856
"ext-pdo": "*",
5957
"ext-gd": "*",
6058
"nategood/httpful": "^0.2.20",
@@ -146,6 +144,11 @@
146144
"name": "Cooper Fellows",
147145
"homepage": "https://github.com/cooperfellows",
148146
"role": "Contributor"
147+
},
148+
{
149+
"name": "Sean Hernandez",
150+
"homepage": "https://github.com/seanlh",
151+
"role": "Contributor"
149152
}
150153
]
151154
}

config/herokuConfig.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@
1414
/* Tool name for display in Canvas Navigation */
1515
$canvas_nav_item_name = getenv('CANVAS_NAV_ITEM_NAME');
1616

17+
/* File Scan Size Limit */
18+
$file_scan_size_limit = getenv('SCAN_FILE_SIZE_LIMIT') ?: 52428800;
19+
20+
/* Alt Text Length Limit */
21+
$alt_text_length_limit = getenv('ALT_TEXT_LENGTH_LIMIT') ?: 125;
22+
1723
/* Database Config */
1824

1925
$db_url = parse_url(getenv('DATABASE_URL'));
@@ -42,6 +48,9 @@
4248
/* Google/YouTube Data Api Key */
4349
define('GOOGLE_API_KEY', getenv('GOOGLE_API_KEY')?:'');
4450

51+
/* Vimeo API Key */
52+
define('VIMEO_API_KEY', '');
53+
4554
/* Google Analytics Tracking Code */
4655
define('GA_TRACKING_CODE', '');
4756

@@ -54,3 +63,7 @@
5463
// send logs into the heroku logs
5564
$log_handler = new \Monolog\Handler\ErrorLogHandler();
5665
$log_handler->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true));
66+
67+
// Sets CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST
68+
// This should be true for production environments
69+
$curl_ssl_verify = true;

config/localConfig.template.php

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,18 @@
1919
/* Tool name for display in Canvas Navigation */
2020
$canvas_nav_item_name = (getenv('CANVAS_NAV_ITEM_NAME')) ?: 'UDOIT';
2121

22+
/* File Scan Size Limit */
23+
$file_scan_size_limit = getenv('SCAN_FILE_SIZE_LIMIT') ?: 52428800;
24+
25+
/* Alt Text Length Limit */
26+
$alt_text_length_limit = getenv('ALT_TEXT_LENGTH_LIMIT') ?: 125;
27+
2228
/* Google/YouTube Data Api Key */
2329
define('GOOGLE_API_KEY', '');
2430

31+
/* Vimeo API Key */
32+
define('VIMEO_API_KEY', '');
33+
2534
/* Google Analytics Tracking Code */
2635
define('GA_TRACKING_CODE', '');
2736

@@ -38,13 +47,22 @@
3847

3948
$debug = false;
4049

41-
// added in v2.3.0
42-
// Background worker Options (See Background Workers in Readme)
50+
/* Background worker Options (See Background Workers in Readme) */
4351
$background_worker_enabled = false;
4452
$background_job_expire_time = 20; // after x Minutes, mark job as expired
4553
$background_worker_sleep_seconds = 7;
4654

47-
// OVERRIDE the default of ENV_PROD
48-
// $UDOIT_ENV = ENV_PROD;
49-
// $UDOIT_ENV = ENV_DEV;
50-
// $UDOIT_ENV = ENV_TEST;
55+
/* Set the Environment (default value is 'ENV_DEV' */
56+
// Valid values are 'ENV_PROD', 'ENV_DEV', or 'ENV_TEST'
57+
// If '$UDOIT_ENV' is not 'ENV_PROD' UDOIT is loaded with
58+
// set display errors to 1
59+
// add test reports to 'View Old Reports' page in UDOIT
60+
// doesn't validate Canvas tokens
61+
// returns "test-token" when getting refresh token for Canvas
62+
// Course Scanner doesn't scan, simply contains already loaded test reports
63+
// $UDOIT_ENV = ENV_PROD; // default
64+
65+
/* Ignore SSL Certificates */
66+
// For use while developing with self-signed SSL Certificates
67+
// Sets CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST
68+
$curl_ssl_verify = true; // This should be true for production environments

config/localConfig.test.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,21 @@
1515
/* Tool name for display in Canvas Navigation */
1616
$canvas_nav_item_name = 'test udoit';
1717

18+
/* File Scan Size Limit */
19+
$file_scan_size_limit = getenv('SCAN_FILE_SIZE_LIMIT') ?: 52428800;
20+
21+
/* Alt Text Length Limit */
22+
$alt_text_length_limit = getenv('ALT_TEXT_LENGTH_LIMIT') ?: 125;
23+
1824
/* Google/YouTube Data Api Key */
1925
define('GOOGLE_API_KEY', 'TEST_API_KEY');
2026

2127
/* Google Analytics Tracking Code */
2228
define('GA_TRACKING_CODE', 'TEST_GA_TRACKING');
2329

30+
/* Vimeo API Key */
31+
define('VIMEO_API_KEY', 'TEST_VIMEO_KEY');
32+
2433
/* Database Config */
2534
$db_type = 'test'; // 'mysql' or 'pgsql'
2635
$db_host = ''; // localhost or ip
@@ -40,6 +49,10 @@
4049
$background_job_expire_time = 20; // after x Minutes, mark job as expired
4150
$background_worker_sleep_seconds = 1;
4251

52+
// Sets CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST
53+
// This should be true for production environments
54+
$curl_ssl_verify = true;
55+
4356
// send logs into the phpunit output
4457
$log_handler = new \Monolog\Handler\TestHandler(null, \Monolog\Logger::WARNING);
4558
$log_handler->setFormatter(new \Monolog\Formatter\LineFormatter(null, null, true, true));

config/settings.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
define('ENV_TEST', 'test');
33
define('ENV_PROD', 'prod');
44
define('ENV_DEV', 'dev');
5-
define('UDOIT_VERSION', '2.3.1');
5+
define('UDOIT_VERSION', '2.3.2');
66

77
// SET UP AUTOLOADER (uses autoload rules from composer)
88
require_once(__DIR__.'/../vendor/autoload.php');
@@ -32,7 +32,7 @@
3232
isset($UDOIT_ENV) || $UDOIT_ENV = ENV_PROD; // !! override in your localConfig.php
3333

3434
// SET UP OAUTH
35-
UdoitUtils::setupOauth($oauth2_id, $oauth2_key, $oauth2_uri, $consumer_key, $shared_secret);
35+
UdoitUtils::setupOauth($oauth2_id, $oauth2_key, $oauth2_uri, $consumer_key, $shared_secret, $curl_ssl_verify);
3636

3737
// SET UP DATABASE
3838
UdoitDB::setup($db_type, $dsn, $db_user, $db_password);

0 commit comments

Comments
 (0)