Installation and Deployment

Local installation

To run a local development server (assuming a Linux/Unix/OSX environment):

  1. Install Python 3.4 and git
  2. git clone the repository and cd into it
  3. Run make install. This sets up a virtual environment and installs all dependencies.
  4. Set up the necessary environment variables. See Keys and Config.
  5. Run ./manage.py init_db <this_year> to bootstrap the minimal initial data needed for the site to work.
  6. Run make (or just ./manage.py runserver) to start the development server. Visit localhost:8000/db. You should be redirected to login via WebAuth.
  7. Once you are logged in (and your User info is in the database) run ./manage.py setsuperuser <your_netid> to give yourself superuser privileges and access to the whole database.

Once you have set up authentication with the current Heroku deployment (see Deploying to Heroku, you can run make db_from_remote to copy all data from the remote database to your local machine.

Keys and Config

TODO: keys for Heroku

You only need the AWS keys if you are going to be messing with Leader and Croo applications. Likewise, Google Maps is only used by the transportation app.:

DEBUG="True"
SECRET_KEY="some secret key"

AWS_ACCESS_KEY_ID="your key id"
AWS_SECRET_ACCESS_KEY="your secret key"
AWS_STORAGE_BUCKET_NAME="a bucket name"

GOOGLE_MAPS_KEY="your google maps key"
GOOGLE_MAPS_BROWSER_KEY="your google maps browser key"

When working locally, I put the environment variables in a local config.sh file that looks like:

export DEBUG="True"
...

and run source venv/bin/activate && source config.sh when I start work.

Deploying to Heroku

The site is deployed on Heroku and uses AWS S3 for file storage. Trips Directors and Bo have the passwords for the current Heroku and AWS accounts.

  1. Install git, heroku toolbelt.
  2. Setting up Heroku:
    1. TODO
  3. Setting up AWS S3:
  1. Create AWS account
  2. Create an AWS bucket, e.g. ‘doc-trips’. Set the environment variable AWS_STORAGE_BUCKET_NAME to be the bucket name.
  3. Create a new user in the AWS IAM manager. Give the user the AmazonS3FullAccess permission. Save the user’s security credentials, setting the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables. (Don’t use the master user’s login credentials!)
  1. I highly recommend setting up a Heroku dev/staging instance with a separate AWS bucket for testing, especially if you are going to make deep changes to the codebase.
  2. Sentry ? #. TODO
  3. Google Maps keys. What permissions do you need to set?

Note

Most of the time the database runs fine on two Heroku dynos. During high-load periods (when Leader and Croo applications are due, and possibly when Trippee Registrations are due) the site will crash unless you increase the number of dynos. Be sure to reset the site back to two dynos afterwards, or Trips will have some hefty server bills!