/edith

Request help in any situation

Primary LanguagePython

Edith

Development

Install Docker and Docker-Compose. Start your virtual machines with the following shell command:

docker-compose up --build

If all works well, you should be able to create an admin account with:

docker-compose run backend python manage.py createsuperuser

Testing

E-mail

View sent e-mails in Mailgun.

http://0.0.0.0:8025

Deployment

Deployment occurs in a series of steps. Some deployment steps do not need to be performed very often.

At a high-level, the steps are:

  1. Deploy VPC and RDS (once)
  2. Deploy frontend (as-needed)
  3. Deploy backend (as-needed)

Deploying with CDK

First, install the CDK dependencies:

  • npm install -g aws-cdk
  • cd deploy
  • pip install -r deploy/requirements.txt

Next, deploy using cdk.

  • cdk deploy edith-networking-db
  • cdk deploy edith-frontend

Deploying the backend

Update the backend Lambda instance by running the following commands:

  • cd backend
  • source .venv/bin/activate
  • pip install -r requirements/deploy.txt
  • zappa update prod

You'll also want to perform some post-deployment tasks:

  • Migrate the DB: zappa manage prod migrate
  • Build static files and copy to S3: zappa manage prod "collectstatic --noinput
  • Copy secret env variables to S3: aws s3 cp env.json s3://prod.edith.app/

Deploying the frontend

The frontend has to be built before it can be deployed.

Run make build to build the frontend from the project directory.

Next, cd deploy then run cdk deploy edith-frontend, which will handle creating/updating an S3 bucket and Cloudfront distribution, upload the frontend files to S3, and invalidate the Cloudfront cache.

Finally, mark the release on Sentry:

  • sentry-cli releases new <version>
  • sentry-cli releases files <version> upload-sourcemaps frontend/dist/js/
  • sentry-cli releases finalize <version>

Resources