Deployment Environments & CI/CD Workflow
What are Deployment Environments?
Berkeleytime has three deployment environments: production, staging, and development. The production environment refers to the live deployed website seen by users of Berkeleytime and should contain code already tested in the other two environments. The staging and development environments are primarily used by Berkeleytime developers/designers to test new code.
- Production: Finalized changes merged in
mainare manually deployed here at berkeleytime.com - Staging: Changes already merged in
mainare automatically deployed here at staging.berkeleytime.com - Development: Specific git branches can be manually deployed here.
The CI/CD Github Actions
We use GitHub actions to build our CI/CD workflows.1 All three CI/CD workflows2 are fairly similar to each other and can all be broken into two phases: the build and the deploy phase.
-
Build Phase: An application container and Helm chart are built and pushed to a registry. We use Docker Hub. This process is what
.github/workflows/cd-build.yamlis responsible for and is run in the Github Action environment. -
Deploy Phase: After the container and Helm chart are built and pushed to a registry, they are pulled and deployed onto
hozer-51. This process is what.github/workflows/cd-deploy.yamlis responsible for and is run in the Github Action environmentssh'd intohozer-51.
Comparing Deployment Environment Actions
The differences between the three environments are managed by each individual workflow file: cd-dev.yaml, cd-stage.yaml, and cd-prod.yaml.
| Development | Staging | Production | |
|---|---|---|---|
| k8s Pod Prefix | bt-dev-* | bt-stage-* | bt-prod-* |
| Container Tags | [commit hash] | latest | prod |
| Helm Chart Versions3 | 0.1.0-dev-[commit hash] | 0.1.0-stage | 1.0.0 |
| TTL (Time to Live) | [GitHub Action input] | N/A | N/A |
| Deployment Count Limit | 8 | 1 | 1 |
Datapuller suspend | true | false | false |
In the past, we have used a self-hosted GitLab instance. However, the CI/CD pipeline was obscured behind a admin login page. Hopefully, with GitHub actions, the deployment process will be more transparent and accessible to all engineers. Please don't break anything though!
Development, Staging, and Production
Ideally, these would follow semantic versioning, but this is rather difficult to enforce and automate.