Skip to content

Deployments and Environment variables

Neil van Beinum edited this page May 5, 2022 · 7 revisions

Environment Variables

Note that we store environment variables for deployed environments in two places. Commands to help us find out what changed are further below.

  • AWS Parameter store - this contains every private (server) environment variable, e.g. group names, DRS secrets, etc. Referenced in serverless.yml.

  • Circle CI - This contains every PUBLIC environment variable we want in the project. This needed when building the project and is referenced in .circleci/config.yml.

Deploying to production - what to do first

Make sure main is updated with all features we want from the develop branch

Check what's going to be deployed using these commands:

git checkout main

git pull

Visit Circle CI main success builds and find the most recently deployed branch (ie all steps green) and copy the SHA. (see highlight, right of image below).

circleci_recent

Next, look at some key parts of the config and what may change on deployment. Terminal commands to help you know you what to check are listed below:

git diff <SHA>..HEAD serverless.yml

This may show changes to public environment variables. Refer to the Circle CI config for the expected values.

git diff <SHA>..HEAD .circleci/config.yml

May contain references to values stored in AWS parameter store. E.g. group names and other private variables only used by the Node backend. Check that production AWS parameter store has the right value for everything here.

git log <SHA>..HEAD --oneline | grep Merge

Check merged PRs. You can skip all PRs that were merged to develop

Deploying and rolling back

Once happy with the above, visit Circle CI main builds.

Find the most recent build and approve the deploy by clicking the thumbs up.

circleci_approve

If the deploy succeeds but we get unexpected behaviour and we can't debug the issue, we have the option to redeploy the previous version. Just find the previous build and click rerun from start, then approve the deploy step

circleci_rerun