Continuous Integration / Continuous Delivery
Workflows
CI/CD for ACUBE is achieved through the use of Github Workflows. A workflow is a configurable automated process that will run one or more jobs. These are used to automate ACUBE's testing, formatting and building of the source code, and docker image releases. Workflows are defined in the .github/workflows directory in a repository. Currently, most of the workflows are set to run upon creating a Pull Request to merge with main. A few are not and must instead be run manually.
A Github Workflow file exists for every single docker container, including:
- frontend
- authorization
- pipeline
- prisma
- every microservice
These workflows are responsible for formatting, testing (e.g. type checks and lint), and finally building the docker image for each respective image upstream. If any of these steps (jobs) fail, an error will be displayed on Github and must be resolved by the developer before merging.
An important workflow is the docker.yml workflow. This is automatically run when a Github Release is made, which creates an image with the tag of the release version. This workflow must be run manually to update the images with the main tag upon any changes to the main branch. This can be done so on the Actions page on Github by clicking on the docker tab on the sidebar and then executing the Run workflow action.
Upon completion, two sets of docker images will be created and available in the Releases page of Github. The images are categorized into these two sets based on if they are a service image or a main image. The images with the main tag can be found by searching for the rolling release.
main images refer to the docker images that are not microservice images, such as frontend, pipeline, authorization, etc.
Deployment
Once the docker workflow has been run and the docker images have been updated upstream, staging and production may be updated. This is done by simpling restarting the ACUBE service files:
sudo systemctl restart acubetotal-*
Once complete, make sure to verify that all services are up and running without any errors. The old images may be deleted with:
sudo docker image prune
Ensure that staging is running properly without any errors and perform sufficient testing before updating production as well.