Skip to content

Commit

Permalink
Merge pull request #154 from iturgeon/master
Browse files Browse the repository at this point in the history
Mesa CTL security updates, finalized templates, tons of code cleanup / standardization
  • Loading branch information
bagofarms authored Dec 14, 2016
2 parents c380676 + 9c768e4 commit 023b7d2
Show file tree
Hide file tree
Showing 50 changed files with 3,607 additions and 2,037 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: php
cache:
directories:
- $COMPOSER_CACHE_DIR
- vendor
install:
- 'composer install --no-scripts'
php:
- '5.4'
- '5.5'
- '5.6'
script: ./vendor/phpunit/phpunit/phpunit
92 changes: 58 additions & 34 deletions HEROKU.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
## Deploy on Heroku
# Heroku Button
Use the button below to quick start your deploy.

[![Deploy](https://www.herokucdn.com/deploy/button.svg)](https://heroku.com/deploy)

# Manual Deploy on Heroku

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).

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)


Create The App: **MAKE SURE you modify the env values**

```
curl -n -X POST https://api.heroku.com/app-setups \
-H "Content-Type:application/json" \
-H "Accept:application/vnd.heroku+json; version=3" \
-d '{"source_blob": { "url":"https://github.com/ucfopen/UDOIT/tarball/master/"}, "overrides": {"env": { \
"OAUTH2_ID":"<YOUR_ID_HERE>", \
"OAUTH2_KEY":"<YOUR_KEY_HERE>" \
}}}'
```

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

Check your Heroku dashboard or run `heroku apps` to see if a new app shows up. If all goes well, it should be running.

1. `git clone [email protected]:ucfcdl/UDOIT.git` to grab a copy of the git repo
2. `heroku create` will set up a Heroku project
3. `heroku addons:create heroku-postgresql:hobby-dev` add a database addon
4. `heroku buildpacks:set https://github.com/heroku/heroku-buildpack-multi` may be required
5. `git push heroku master:master` will build build the server using our master branch
6. set up the Heroku config variables below

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

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

## Create Database Tables
You'll need to have postgresql installed on your own system to connect to the Heroku postgresql database.
# Develop using Heroku

To modify the code on your running Heroku server, you'll need to push code to it.

Set up the git repository:
```
git clone [email protected]:ucfopen/UDOIT.git
cd UDOIT
```

Link the git repository to your Heroku App
```
heroku git:remote --app <YOUR_HEROKU_APP_NAME>
```

Build and Deploy
```
git push heroku master:master
```

## Peeking at Database Tables
The Heroku install process should create the tables for you.

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.

* `heroku pg:psql` will open a psql connection to the remote Heroku database
* copy and paste the postgresql table schemeas for the users and reports table into the prompt
* `\dt` will show you a list of the tables you just created
* `\d reports` and `\d users` should describe the tables
* `Select * from users;` or `Select * from reports;` will show you their contents
* `\q` quits the psql terminal

```sql
/* postgresql */
CREATE TABLE reports (
id SERIAL PRIMARY KEY,
user_id integer,
course_id integer,
file_path text,
date_run timestamp with time zone,
errors integer,
suggestions integer
);
```

### Users Table

```sql
/* postgresql */
CREATE TABLE users (
id integer CONSTRAINT users_pk PRIMARY KEY,
api_key varchar(255),
date_created integer
);
```
If needed, you can manually run the table creation script: `Heroku run php lib/db_create_tables.php`

## Table Schema
The table schema can be found in [lib/db_create_tables.php](lib/db_create_tables.php)
Loading

0 comments on commit 023b7d2

Please sign in to comment.