Ovation Ventures Ovation Developer Docs

Policies

Deployment/Release Process

By Carlos Cuba and the Team

Disregarding the environment we’re going to be deploying to (obviously, this is super important for Production), we need to take into consideration that, sometimes, the order of the deployments might cause some downtime (e.g.: we need to deploy web changes, but those need some Contentful updates or Infrastructure changes; otherwise, the site might break). If that’s the case, we should try to minimize the downtime as much as possible

Infrastructure

Make sure that you are using tfenv to isolate the same version of Terraform that everyone else is using. Refer to the README.md file in the terraform-infrastructure folder for details on installing and using tfenv .

New Products

New software products that will need to be deployed to the shared infrastructure should contain a module folder in their own GitHub repo. This module may be referred to by its GitHub URL like this:

source = "github.com/ovationventures/bravo-nextjs//terraform?ref=v0.1.0"

The double-slash // is intentional. See this documentation for more details. The ref may be a branch name in the infra-test environment, but, once you have demonstrated that your deployment works, it should be a tag corresponding to a target release sprint in the other repos to prevent premature or untested changes. Each product should be isolated as much as possible, so that it can be deployed without affecting any unrelated, existing infrastructure. The terraform-infrastructure repo should be for re-usable modules (like docker-island , which launches a single Docker container as an ECS/Fargate task). Your product’s module can make use of these re-usable modules as composable components.

In Each Environment

Make sure you have a Deployment Buddy to check each step. Make a PR of the changes you intend to deploy, and get approval from your Deployment Buddy. Your PR should be against the relevant environment branch (test, development , etc.) cd into the environment folder (infra-test, development , test or production ) Make sure to get the current version of the secrets for that environment.

aws --profile development-admin \ # You may use aws-vault or op to manage your creds
    secrets-manager get-secret-value \
    --secret-id dev.auto.tfvars \ # The name of the secret will vary per environment
    | jq -r .SecretString \
    > dev.auto.tfvars # This filename MUST be in .gitignore

Run terraform init -reconfigure to make sure your local environment matches the versions in the checked out files. Run terraform plan $(date +%F).plan and inspect the results to make sure every change is expected. Get a second opinion from your Deployment Buddy on your plan before proceeding. If sharing the plan over Slack, add the -no-color option to strip ANSI color codes from the output. Once you have approval from your Deployment Buddy, run terraform apply $(date +%F).plan to apply the changes. When you and your Deployment Buddy have verified that the change was applied without error, and the expected infrastructure is in place and functioning correctly, merge your PR (with any changes, approved by your Deployment Buddy, that you had to make) into the appropriate branch. …


Web App

Dev to Test

  1. Review Changelog

    1. All tickets that are included in the Unreleased section should be the ones that are going to be deployed
    2. All these tickets should be in DEPLOYED TO DEV (current Sprint’s Board)
    3. In ClickUp, select the tickets so they can be updated (in batch) later on (when the deployment is completed). This also helps on checking that everything is up-to-date
  2. Bump the project’s version:

    1. Update package.json with the corresponding new version (usually, a patch bump)
    2. Start the project (./startcli.sh) so the package-lock.json also gets updated: Bump version to `v1.1.3`
  3. Create a PR with the develop branch as source and the test branch as target: New Test build. Once the PR is created, feel free to double check the Changelog and the package.json (to make sure the current version is correct).

    1. To validate the correct version, please check the latest tag pushed within our main branch and confirm the bump is correct.
    2. Double-check the PR to make sure all the changes are the expected ones
  4. Merge the PR.

  5. An email notification from AWS (Test) should be sent when the deployment starts and succeeds or fails (if this is not happening, please make sure your email is configured within Amplify’s Build Notification settings)

  6. Once the deployment is completed, it is always a good practice to confirm the changes are working as expected within the Test environment.

  7. Move the selected tickets into the DEPLOYED TO UAT status and update their Deployed In field to the version that was deployed

Test to Prod

  1. Review Changelog

    1. All tickets that are included in the Unreleased section should be the ones that are going to be deployed
    2. All these tickets should be in READY FOR RELEASE (current Sprint’s Board)
    3. In ClickUp, select the tickets so they can be updated (in batch) later on (when the deployment is completed). This also helps on checking that everything is up-to-date
  2. Create a PR with the test branch as source and the main branch as target: New Production build. Once the PR is created, feel free to double check the Changelog and the package.json (to make sure the current version is correct).

    1. To validate the correct version, please check the latest tag pushed within our main branch and confirm the bump is correct.
    2. Double-check the PR to make sure all the changes are the expected ones
  3. Merge the PR.

  4. An email notification from AWS (Production) should be sent when the deployment starts and succeeds or fails (if this is not happening, please make sure your email is configured within Amplify’s Build Notification settings)

  5. Once the deployment is completed, it is always a good practice to confirm the changes are working as expected within the Production environment.

  6. Create a tag on the latest main commit with the corresponding version.

  7. Stamp changelog and bump the project’s version:

    1. Checkout the develop branch
    2. Update package.json with the corresponding new version (usually, a patch bump)
    3. Start the project (./startcli.sh) so the package-lock.json also gets updated
    4. Stamp the Changelog: Stamp changelog and bump version to `v1.1.3`
  8. Move the selected tickets into the DONE status and update their Deployed In field to the version that was was deployed

Contentful

When migrating Contentful contents, please always make sure you start from the Content Models that do not have children (nested Models); otherwise, the script might result in an error (as Contentful is not going to be able to publish entries with missing references)

Also, keep in mind that, for now, only WhiteLabels support assets migration.

Dev to Test / Test to Prod

Use https://github.com/ovationventures/paperwork-contentful-cli to migrate the required Contentful models/contents

Create a Management Token

To allow the project to interact with Contentful via the Content Management API (CMA), you need to create a personal access token. Follow these steps to generate and use the token:

  1. Go to the Account menu (the profile icon) and select Account Settings.
  2. Go to CMA tokens
  3. Click the “Create personal access token” button.
    1. Set a token name. It could be “name-contentful-cli”.
    2. Set an expiration date. For now, set it to “No expiration”.
  4. Go to the project and set the token in the MANAGEMENT_TOKEN field of the .env file.

Balance Reporting

Balance reporting use amd64 platform and the environment variable SENTRY_AUTH_TOKEN to pass the build locally.

Local build

Export variable using the following command: export SENTRY_AUTH_TOKEN="sntrys_ey..."

Local Build

docker build \
  --platform linux/amd64 \
  --build-arg SENTRY_AUTH_TOKEN="${SENTRY_AUTH_TOKEN}" \
  -t balance/reporting .

Deploy local without commit/pipelines

After build, tag and push the image to the environment (Ex development)

docker tag balance/reporting:latest 614522506954.dkr.ecr.us-west-2.amazonaws.com/balance/reporting:latest

Then push

docker push 614522506954.dkr.ecr.us-west-2.amazonaws.com/balance/reporting:latest

And force lambda update

aws lambda update-function-code \
  --function-name balance_reporting_dev \
  --profile development-admin \
  --image-uri 614522506954.dkr.ecr.us-west-2.amazonaws.com/balance/reporting:latest

Since the lambda use AWS services like RDS, Cognito and Athena, we can’t test the lambda to generate the real data but we can test the PDF generation. A .env file should created for that purpose.

docker run --rm -p 9000:8080 --env-file .env balance/reporting.

The .env file should contains:

ENV="local"
DOMAIN_BASE="local.org"
SENTRY_DSN="..."