Skip to content

Deployment

Rick Waldron edited this page Jan 7, 2021 · 17 revisions

Staging and Production Environment Setup

Deploying Staging or Production for the First Time

  • Create an app in Heroku
  • In the "Deploy" menu of your Heroku app, integrate your Github account with Heroku
  • Choose mit-teaching-systems-lab/dcss as your repo and the main branch as your branch to manually deploy
  • Click the manual deploy button to get make the latest changes to the main live on your app.
  • Create a database for your app
    • In "Resources" select the "Heroku Postgres" add-on and provision a database. This will add "DATABASE_URL" to your env variable in Heroku
  • Add all the env variables you need
  • Run all database migrations in the Heroku console
    yarn db-migrate-up
    

Seed the first admin user

Create your first super admin user. Be sure to fill in your account information in the double quotes below.

yarn workspace server seed:super-admin email="" username="" password=""

Going forward as a super admin, you can manage user permissions (and create other admins) from the Account Administration UI in the Teacher Moments app.

Deploying Updates to Staging

We currently have Github integrated with Heroku, so merges into the main branch will deploy automatically to our staging site, https://teacher-moments-staging.herokuapp.com/. Currently database migrations don't happen automatically, so you will need to run them in the Heroku console with the command yarn db-migrate-up.

Deploying Updates to Production

Once you've decided that your most recent changes look good on https://teacher-moments-staging.herokuapp.com/, you can choose to manually deploy the main branch to production. You can find the manual deploy button in the Deploy part of the Heroku dashboard towards the bottom. Don't forget to run yarn db-migrate-up in the Heroku console if you have any new migrations to add.

Required Environment Variables

The following environment variables must be set in Heroku:

  - ENV # production
  - SESSION_SECRET # any text you choose
  - DATABASE_URL # should be added automatically by your Herkou Postgres database
  - PGDATABASE # database name. You can find this and the rest of the database connection info can come from the DATABASE_URL (https://devcenter.heroku.com/changelog-items/438)
  - PGHOST # no port necessary
  - PGUSER
  - PGPASSWORD
  - WATSON_KEY # necessary for audio transcription
  - WATSON_URL
  - S3_BUCKET # set up an Amazon S3 account for storing audio
  - AWS_ACCESS_KEY_ID
  - AWS_SECRET_ACCESS_KEY

Optional Environment Variables

Use the variables below if you are setting up a private label deployment and need branding different from the TSL Teacher Moments project.

- DCSS_BRAND_NAME_TITLE # Title of your project
- DCSS_BRAND_LOGO # URL for where your project's logo is hosted