Skip to content

Commit

Permalink
Merge pull request #1864 from raft-tech/feat/1746-new-routes-and-serv…
Browse files Browse the repository at this point in the history
…ices-tanf-staging-space

feat/1746-new-routes-and-services-tanf-staging-space
  • Loading branch information
andrew-jameson authored Jul 18, 2022
2 parents df4d981 + e73ad73 commit f9d9946
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 18 deletions.
35 changes: 34 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,27 @@ jobs:
cf-space: tanf-staging
cf-username: CF_USERNAME_STAGING

deploy-infrastructure-develop:
executor: terraform/default
working_directory: ~/tdp-deploy
steps:
- deploy-infrastructure:
cf-password: CF_PASSWORD_STAGING
cf-username: CF_USERNAME_STAGING
cf-space: tanf-staging
tf-path: ./terraform/staging

deploy-develop:
executor: docker-executor
working_directory: ~/tdp-deploy
steps:
- deploy-cloud-dot-gov:
backend-appname: tdp-backend-develop
frontend-appname: tdp-frontend-develop
cf-password: CF_PASSWORD_STAGING
cf-space: tanf-staging
cf-username: CF_USERNAME_STAGING

deploy-project-updates-site:
parameters:
cf-org:
Expand Down Expand Up @@ -668,10 +689,22 @@ workflows:
filters:
branches:
only:
- develop
- main
- deploy-staging:
requires:
- deploy-infrastructure-staging
filters:
branches:
only:
- main
- deploy-infrastructure-develop:
filters:
branches:
only:
- develop
- deploy-develop:
requires:
- deploy-infrastructure-develop
filters:
branches:
only:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,5 @@ tfapply
*.tfvars
*.lock.hcl
*.tfstate

*.~undo-tree~
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
# 8. Deployment Flow

Date: 2021-01-27 (_Updated 2022-04-05_)
Date: 2021-01-27 (_Updated 2022-07-18_)

## Status

Accepted

## Context

Our Cloud.gov organization currently has three Spaces -- dev, staging, and prod. The vendor team currently has access to the dev Space only.
Our Cloud.gov organization currently has three Spaces -- `tanf-dev`, `tanf-staging`, and `tanf-prod`. The vendor team currently has access to the tanf-dev space only.

Since the recent changes to our [Git workflow](https://github.com/HHS/TANF-app/blob/main/docs/Architecture%20Decision%20Record/009-git-workflow.md) we believe our current deploy strategy should be updated to more closely match the workflow. Previously, since we had approvals on two different repositories we decided that it made sense to maintain [two separate staging sites](https://github.com/HHS/TANF-app/blob/main/docs/Architecture%20Decision%20Record/008-deployment-flow.md). We would deploy to one with approval in the raft-tech repository, and another with approval to HHS. Since we now have all approvals made in raft-tech, the deploy after approval serves the same purpose as deploying to the Government staging site would have.
Since the recent changes to our [Git workflow](https://github.com/HHS/TANF-app/blob/main/docs/Technical-Documentation/Architecture-Decision-Record/009-git-workflow.md) we believe our current deploy strategy should be updated to more closely match the workflow. Previously, since we had approvals on two different repositories we decided that it made sense to maintain [two separate staging sites](https://github.com/HHS/TANF-app/blob/837574415af7c57e182684a75bbcf4d942d3b62a/docs/Architecture%20Decision%20Record/008-deployment-flow.md). We would deploy to one with approval in the raft-tech repository, and another with approval to HHS. Since we now have all approvals made in raft-tech, the deploy after approval serves the same purpose as deploying to the Government staging site would have.

Additionally, as of January 2021, the project has only a single deployment environment on Cloud.gov, which we are calling `development`. This poses challenges to the vendor development team. The team works on multiple features or fixes at any one time, but only has a single environment to test deployed code. This is leading to "crowding", where multiple in-progress features by different devs all want to be deployed to the same environment for testing.
Additionally, as of January 2021, the project has only a single deployment environment in the `tanf-dev` space on Cloud.gov. This poses challenges to the vendor development team. The team works on multiple features or fixes at any one time, but only has a single environment to test deployed code. This is leading to "crowding", where multiple in-progress features by different devs all want to be deployed to the same environment for testing.

As of Spring 2022, following [ADR 018](https://github.com/HHS/TANF-app/blob/main/docs/Technical-Documentation/Architecture-Decision-Record/018-versioning-and-releases.md), the project needs more than one deployment environment in the `tanf-staging` space on Cloud.gov to ensure that there is a dedicated environment for release-specific features.

## Decision

Deploy Environment | Cloud.gov Space | Cloud.gov Dev Access | Role | Deploys when ... |
-------------------|-----------------|----------------------|--------------------------------------------------|---------------------------------------------------|
Dev | Tanf-Dev | Vendor & Gov | Deploy code submitted for gov review | Relevant github label assigned as shown below |
Staging | Tanf-Staging | Gov | Deploy code once gov-approved | Code merged to `raft-tech/TANF-app:develop` |
Production | Tanf-Prod | Gov | Deploy code tested in staging & ready for prod | Code merged to `HHS/TANF-app:master` |
Dev | Tanf-Dev | Vendor & Gov | Deploy code submitted for gov review | Relevant github label assigned as shown below |
Develop | Tanf-Staging | Vendor & Gov | Deploy code once gov-approved | Code merged to `raft-tech/TANF-app:develop` |
Staging | Tanf-Staging | Gov | Deploy code once gov-approved | Code merged to `HHS/TANF-app:main` |
Production | Tanf-Prod | Gov | Deploy code tested in staging & ready for prod | Code merged to `HHS/TANF-app:master` |

### Gitflow and Deployments
We will be following the Gitflow process which is an industry standard. You can read more about it [in our ADR](./018-versioning-and-releases.md). I will just highlight the parts relevant for our deployment strategy. Release branches will be merged to `HHS/TANF-app:master` which will deploy to our production sites. Code merged to `raft-tech/TANF-app:develop` will be deployed to our staging sites.
Expand All @@ -42,11 +45,12 @@ Within the dev space, there is no correlation for branch to environment as these
* Code deploys automatically upon gov approval, but does not deploy immediately to prod, leaving room for further gov testing. Any mistakes that make it past gov review will not deploy immediately to prod.
* Vendor dev team "crowding" should be reduced through this solution.
* Only need to maintain/monitor vendor dev access to a single Cloud.gov Space using this solution -- least privilege, simplified account management.
* Frees up memory and disk space in the dev environment
* Frees up memory and disk space in the dev environment.
* Dedicated environment for release-specific features.

**Risks**
* None that we can see at this time

## Notes

- As of April 2022, merges into `HHS/TANF-app:master` do not deploy to any environment, since we are pending activation of the production space (#895).
- As of June 2022, CircleCI supplies environment variable key-value pairs to multiple environments (e.g. vendor's CircleCI deploys applications to dev and staging environments). The values from CircleCI are expected to be unique per environment, so until [#1826](https://github.com/raft-tech/TANF-app/issues/1826) is researched and addressed, these values will need to be manually corrected in cloud.gov immediately following the execution of the execution of the [`<env>-deployment` CircleCI workflow](../../.circleci/config.yml) CircleCI workflow. This workaround applies to backend applications in the TDP staging environment.
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ The proposed workflow below provides a remedy to these issues, as well as many o
* When satisfied, the Government reviewer `approves` the PR and tags with the `ready-to-merge` and removes the `QASP review` label.

7. `abottoms-coder` (or his back-up) merges changes into `develop`. This includes:
* This will trigger a deployment to tanf-staging:develop
* opening a PR from `develop` to `HHS:main`
* updating the PR template to change `addresses` to `closes` so that issue [can be automatically closed when the Government merges](https://docs.github.com/en/github/managing-your-work-on-github/linking-a-pull-request-to-an-issue#linking-a-pull-request-to-an-issue-using-a-keyword)
* ensuring the CI/CD pipelines are green
Expand Down
6 changes: 5 additions & 1 deletion docs/Technical-Documentation/TDP-environments-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@

## Staging

Unlike Development, the Staging environment contains a single frontend and backend deployment.
The Staging environment contains two frontend and backend deployments.

| Frontend URL | Backend URL | Purpose |
| -------- | -------- | -------- |
| https://tdp-frontend-staging.app.cloud.gov | https://tdp-backend-staging.app.cloud.gov/admin/ | Space for government users to test in a deployed, production-like environment |
| https://tdp-frontend-develop.app.cloud.gov | https://tdp-backend-develop.app.cloud.gov/admin/ | Space for government users to test in a deployed, production-like environment |

### Dependencies

Expand All @@ -38,11 +39,14 @@ Unlike Development, the Staging environment contains a single frontend and backe
**Cloud.gov AWS RDS `(tanf-staging)`**

- `tdp-db-staging` - Stores application-level models (e.g. Users, Reports).
- `tdp-db-develop` - Stores application-level models (e.g. Users, Reports).

**Cloud.gov AWS S3 `(tanf-staging)`**

- `tdp-staticfiles-staging` - Stores static HTML/CSS for Django Admin.
- `tdp-staticfiles-develop` - Stores static HTML/CSS for Django Admin.
- `tdp-datafiles-staging` - Stores the files uploaded by STTs (no real STT data to be stored in staging).
- `tdp-datafiles-develop` - Stores the files uploaded by STTs (no real STT data to be stored in staging).

**Cloud.gov AWS S3 `(tanf-staging)`**

Expand Down
Loading

0 comments on commit f9d9946

Please sign in to comment.