Skip to content

Commit 023b7d2

Browse files
authored
Merge pull request #154 from iturgeon/master
Mesa CTL security updates, finalized templates, tons of code cleanup / standardization
2 parents c380676 + 9c768e4 commit 023b7d2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3607
-2037
lines changed

.travis.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
language: php
2+
cache:
3+
directories:
4+
- $COMPOSER_CACHE_DIR
5+
- vendor
6+
install:
7+
- 'composer install --no-scripts'
8+
php:
9+
- '5.4'
10+
- '5.5'
11+
- '5.6'
12+
script: ./vendor/phpunit/phpunit/phpunit

HEROKU.md

Lines changed: 58 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,34 @@
1-
## Deploy on Heroku
1+
# Heroku Button
2+
Use the button below to quick start your deploy.
3+
4+
[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)
5+
6+
# Manual Deploy on Heroku
7+
8+
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).
9+
10+
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)
11+
12+
13+
Create The App: **MAKE SURE you modify the env values**
14+
15+
```
16+
curl -n -X POST https://api.heroku.com/app-setups \
17+
-H "Content-Type:application/json" \
18+
-H "Accept:application/vnd.heroku+json; version=3" \
19+
-d '{"source_blob": { "url":"https://github.com/ucfopen/UDOIT/tarball/master/"}, "overrides": {"env": { \
20+
"OAUTH2_ID":"<YOUR_ID_HERE>", \
21+
"OAUTH2_KEY":"<YOUR_KEY_HERE>" \
22+
}}}'
23+
```
24+
25+
Read the result to make sure it returned an id, not an error.
26+
27+
Check your Heroku dashboard or run `heroku apps` to see if a new app shows up. If all goes well, it should be running.
228

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
929

1030
## Configure
11-
Set Heroku config variables using `heroku config:set VAR=value1`
31+
These variables can be set in the curl post above. You can also set them later using `heroku config:set VAR=value1`
1232

1333
* `CONSUMER_KEY` - LTI consumer key entered when adding UDOIT LTI to Canvas
1434
* `SHARED_SECRET` - LTI secret entered when adding UDOIT LTI to Canvas
@@ -18,34 +38,38 @@ Set Heroku config variables using `heroku config:set VAR=value1`
1838
* `GOOGLE_API_KEY` - add a google api key for youtube video support
1939
* `USE_HEROKU_CONFIG` - set to `true` to enable the Heroku configuration
2040

21-
## Create Database Tables
22-
You'll need to have postgresql installed on your own system to connect to the Heroku postgresql database.
41+
# Develop using Heroku
42+
43+
To modify the code on your running Heroku server, you'll need to push code to it.
44+
45+
Set up the git repository:
46+
```
47+
git clone git@github.com:ucfopen/UDOIT.git
48+
cd UDOIT
49+
```
50+
51+
Link the git repository to your Heroku App
52+
```
53+
heroku git:remote --app <YOUR_HEROKU_APP_NAME>
54+
```
55+
56+
Build and Deploy
57+
```
58+
git push heroku master:master
59+
```
60+
61+
## Peeking at Database Tables
62+
The Heroku install process should create the tables for you.
63+
64+
If you need to check that the tables exist, you can connect to Postgres using some convenient Heroku functions. You'll need to have **Postgresql installed on your own system** to do the following commands.
2365

2466
* `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
2667
* `\dt` will show you a list of the tables you just created
68+
* `\d reports` and `\d users` should describe the tables
69+
* `Select * from users;` or `Select * from reports;` will show you their contents
2770
* `\q` quits the psql terminal
2871

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 timestamp with time zone,
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-
```
72+
If needed, you can manually run the table creation script: `Heroku run php lib/db_create_tables.php`
73+
74+
## Table Schema
75+
The table schema can be found in [lib/db_create_tables.php](lib/db_create_tables.php)

0 commit comments

Comments
 (0)