Skip to content

Commit 7d2ffff

Browse files
committed
Merge branch 'issue/47-heroku-deployable' of github.com:iturgeon/UDOIT into issue/47-heroku-deployable
2 parents ba4a1ad + 3fe8ef7 commit 7d2ffff

File tree

14 files changed

+306
-30
lines changed

14 files changed

+306
-30
lines changed

.bowerrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"directory": "assets/js/vendor"
2+
"directory": "public/assets/js/vendor"
33
}

.buildpacks

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
https://github.com/heroku/heroku-buildpack-nodejs
2+
https://github.com/heroku/heroku-buildpack-php

HEROKU.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
## Deploy on Heroku
2+
3+
1. `git clone git@github.com:ucfcdl/UDOIT.git` to grab a copy of the git repo
4+
2. `heroku create` will set up a Heroku project
5+
3. `heroku addons:create heroku-postgresql:hobby-dev` add a database addon
6+
4. `heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi` may be required
7+
5. `git push heroku master:master` will build build the server using our master branch
8+
6. set up the Heroku config variables below
9+
10+
## Configure
11+
Set Heroku config variables using `heroku config:set VAR=value1`
12+
13+
* `CONSUMER_KEY` - LTI consumer key entered when adding UDOIT LTI to Canvas
14+
* `SHARED_SECRET` - LTI secret entered when adding UDOIT LTI to Canvas
15+
* `OAUTH2_ID` - from the developer api key created by your admin
16+
* `OAUTH2_KEY` - from the developer api key created by your admin
17+
* `OAUTH2_URI` - full url to your oauth2responce.php - EX: `https://your.herokuapp.com/oauth2response.php`
18+
* `GOOGLE_API_KEY` - add a google api key for youtube video support
19+
* `USE_HEROKU_CONFIG` - set to `true` to enable the Heroku configuration
20+
21+
## Create Database Tables
22+
You'll need to have postgresql installed on your own system to connect to the Heroku postgresql database.
23+
24+
* `heroku pg:psql` will open a psql connection to the remote Heroku database
25+
* copy and paste the postgresql table schemeas for the users and reports table into the prompt
26+
* `\dt` will show you a list of the tables you just created
27+
* `\q` quits the psql terminal
28+
29+
```sql
30+
/* postgresql */
31+
CREATE TABLE reports (
32+
id SERIAL PRIMARY KEY,
33+
user_id integer,
34+
course_id integer,
35+
file_path text,
36+
date_run bigint,
37+
errors integer,
38+
suggestions integer
39+
);
40+
```
41+
42+
### Users Table
43+
44+
```sql
45+
/* postgresql */
46+
CREATE TABLE users (
47+
id integer CONSTRAINT users_pk PRIMARY KEY,
48+
api_key varchar(255),
49+
date_created integer
50+
);
51+
```

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ UDOIT uses the [QUAIL PHP library](https://code.google.com/p/quail-lib/), which
2828

2929
## Installing
3030

31-
UDOIT uses php, apache or nginx, and mysql or postresql. For instructions on installing to Heroku, view [HEROKU.md](HEROKU.md).
31+
UDOIT uses php, apache or nginx, and mysql or postresql. For instructions on installing to Heroku, view [HEROKU.md](HEROKU.md). We also support instantly deploying UDOIT: [![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
3232

3333
### System Requirements
3434
*PHP 5.4 is required* to run UDOIT without any modifications. We have not tested it on 5.5 or 5.6, but some users have been able to modify the code to work on 5.3.

app.json

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"name": "UDOIT",
3+
"description": "The Universal Design Online content Inspection Tool, or UDOIT identifies and fixes accessibility issues in Canvas by Instructure.",
4+
"keywords": [
5+
"education",
6+
"canvas",
7+
"CDL",
8+
"EDU",
9+
"UCF",
10+
"Instructure",
11+
"508"
12+
],
13+
"website": "http://online.ucf.edu/teach-online/resources/udoit/",
14+
"repository": "https://github.com/ucfcdl/UDOIT",
15+
"success_url": "/",
16+
"env": {
17+
"CONSUMER_KEY": {
18+
"description": "LTI consumer key entered when adding UDOIT LTI to Canvas",
19+
"generator": "secret"
20+
},
21+
"SHARED_SECRET": {
22+
"description": "LTI secret entered when adding UDOIT LTI to Canvas",
23+
"generator": "secret"
24+
},
25+
"OAUTH2_ID": {
26+
"description": "Oauth ID from the developer api key created by your admin",
27+
"generator": "secret"
28+
},
29+
"OAUTH2_KEY": {
30+
"description": "Oauth Key from the developer api key created by your admin",
31+
"generator": "secret"
32+
},
33+
"OAUTH2_URI": {
34+
"description": "Full url to your oauth2responce.php file",
35+
"value": "https://your.herokuapp.com/oauth2response.php"
36+
},
37+
"GOOGLE_API_KEY": {
38+
"description": "add a google api key for youtube video support",
39+
"required": false
40+
},
41+
"USE_HEROKU_CONFIG": {
42+
"description": "needed to use the Heroku configuration",
43+
"value": "true"
44+
}
45+
},
46+
"addons": [
47+
"heroku-postgresql:hobby-dev"
48+
],
49+
"buildpacks": [
50+
{
51+
"url": "https://github.com/heroku/heroku-buildpack-nodejs"
52+
},
53+
{
54+
"url": "https://github.com/heroku/heroku-buildpack-php"
55+
}
56+
],
57+
"scripts": {
58+
"postdeploy": "php db_pg_setup.php"
59+
}
60+
}

composer.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,19 @@
66
"repositories": [
77
],
88
"require": {
9-
"php": ">=5.4.0",
9+
"php": "^5.4.0 || ^5.5.0 || ^5.6.0",
1010
"nategood/httpful": "*",
1111
"zaininnari/html-minifier": "dev-master",
1212
"mpdf/mpdf": "dev-master",
1313
"league/plates": "~3.1",
1414
"ext-pdo": "*"
1515
},
1616
"require-dev": {
17-
"symfony/var-dumper": "*"
17+
"symfony/var-dumper": "*",
18+
"heroku/heroku-buildpack-php": "*"
1819
},
1920
"scripts": {
20-
"post-install-cmd": [
21-
"bower install"
22-
],
23-
"post-update-cmd": [
21+
"compile": [
2422
"bower install"
2523
]
2624
}

composer.lock

Lines changed: 114 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/herokuConfig.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
<?php
22

3-
$debug = getenv("DEBUG"):?false;
4-
5-
/* This tests to see if the user came from something other than the URL of your LMS */
6-
$referer_test = getenv('REFERER_TEST');
7-
8-
/* Set the path for the base directory (where the user will start choosing from) */
9-
$base_url = getenv('BASE_URL'); // Without trailing slash
3+
$debug = (getenv("DEBUG")) ?: false;
104

115
/* Oauth 1.0 Settings (For use when installing the app in Canvas) */
126
$consumer_key = getenv('CONSUMER_KEY');

config/settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
require_once('localConfig.php');
1313
}
1414

15-
require_once('../vendor/autoload.php');
15+
require_once(__DIR__.'/../vendor/autoload.php');
1616
require_once('tests.php');
1717

1818
/* Prevent Caching */

db_mysql_setup.php

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
require_once('config/settings.php');
3+
4+
$reports_sql = "CREATE TABLE IF NOT EXISTS `{$db_reports_table}` (
5+
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
6+
`user_id` int(10) unsigned NOT NULL,
7+
`course_id` int(10) unsigned NOT NULL,
8+
`file_path` text NOT NULL,
9+
`date_run` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
10+
`errors` int(10) unsigned NOT NULL,
11+
`suggestions` int(10) unsigned NOT NULL,
12+
PRIMARY KEY (`id`)
13+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
14+
15+
$users_sql = "CREATE TABLE IF NOT EXISTS `{$db_user_table}` (
16+
`id` int(10) unsigned NOT NULL,
17+
`api_key` varchar(255) NOT NULL,
18+
`date_created` date NOT NULL,
19+
PRIMARY KEY (`id`),
20+
UNIQUE KEY `id` (`id`)
21+
) ENGINE=InnoDB DEFAULT CHARSET=latin1;";
22+
23+
$dbh = include('lib/db.php');
24+
$sth = $dbh->query($reports_sql);
25+
$sth->execute();
26+
27+
$sth = $dbh->query($users_sql);
28+
$sth->execute();
29+

0 commit comments

Comments
 (0)