Skip to content

Installation Instructions

Tyler edited this page Jul 25, 2019 · 6 revisions

Chagrade install instructions

External Requirements: AWS Storage Bucket, SendGrid Account (Optional: Email)

sudo usermod -aG docker <your_username>
exit
  • Verify Docker works: docker run hello-world

  • Install Docker-Compose: https://docs.docker.com/compose/install/

  • Verify Docker-Compose works: docker-compose version

  • Install Git if it's not installed on the machine already:

  • Clone the develop branch and change directory into the new project folder

  • Copy .env_sample to .env: cp .env_sample .env

  • Edit the .env with correct configuration variables: vim .env

The following variables need to be set/changed:

DB_NAME : The name of your DB in postgres (chagrade_website should be fine)

AWS_ACCESS_KEY_ID : Your AWS ACCESS KEY ID
AWS_SECRET_ACCESS_KEY : Your AWS Access Key
AWS_STORAGE_BUCKET_NAME : Your AWS Storage Bucket
AWS_LOCATION : What dir inside your bucket to store files in (EG: chagrade)

CADDY_DOMAIN : The domain you would like Caddy to serve to. This should either be the instance's IP, or the corresponding DNS (IE: chagrade.lri.fr)
CADDY_TLS_EMAIL : The email to use when requesting SSL Certificates from LetsEncrypt through Caddy. If you do not wish to use SSL, leave this blank.

(If official instance, please ask tyler@ckcollab.com)
The way this works will probably change in the future
CODALAB_SUBMISSION_USERNAME : Bot user's username on codalab instances to use when making submissions
CODALAB_SUBMISSION_PASSWORD : Bot user's password on codalab instances to use when making submissions

(Optional)
SENDGRID_FROM_EMAIL : The from email to display
SENDGRID_USERNAME : The username of your SendGrid user
SENDGRID_PASSWORD : The password of your SendGrid user
ACME_AGREE : Set to True if using SSL, to automatically accept the license agreement from LetsEncrypt (Requires input which is not possible in the container)
  • Make sure CADDY_DOMAIN=<whatever IP/DNS you're serving> and append :80 to specify port 80 if using an IP.

  • Make sure the env variable ACME_AGREE=true is set in .env if using SSL for a DNS

  • Start/Update all docker containers: docker-compose up -d

  • Enter the django container: docker-compose exec django bash

  • Run migrations: python manage.py migrate

  • Create an admin user: python manage.py createsuperuser

  • Collect Static Files: python manage.py collectstatic

  • Ensure you can connect through your browser

  • (Optional) Run py.test inside the django container to verify everythings working:

#If not already in the container
docker-compose exec django bash
py.test

Note: Currently the develop branch has 2 outdated tests that will fail.

Specific Instructions for Github Integration Branch:

Note: This branch is still under development, and will receive updates/changes fairly frequently.

You will need to create an OAuth2 application on Github to communicate with: https://developer.github.com/apps/building-oauth-apps/creating-an-oauth-app/

The callback URL should be configured as http://<domain/ip-you-are-serving-chagrade-from>/social/complete/github If you are serving on a different port than port 80 (Regular HTTP), then you must specify it here as well.

  • From git, checkout the branch github_social_auth

git checkout github_social_auth

  • Open up the .env for editing again and add these two variables, corresponding to the secret/key of your Github Oauth Application:
SOCIAL_AUTH_GITHUB_KEY=
SOCIAL_AUTH_GITHUB_SECRET=
  • Update the docker containers: docker-compose up -d

  • Enter the django docker container, run migrations and collecstatic again:

docker-compose exec django bash
python manage.py migrate
python manage.py collecstatic
  • (Optional) Run py.test inside the django container to verify everythings working:
#If not already in the container
docker-compose exec django bash
py.test