This project utilizes a CI/CD (Continuous Integration/Continuous Deployment) configuration file for automating the build, test, deployment, and maintenance processes. The CI/CD pipeline is implemented using CircleCI and consists of multiple jobs and workflows. Here is an overview of the project structure and how the CI/CD pipeline is set up.
The CI/CD configuration file (config.yml
) is written using CircleCI 2.1 syntax. It defines various jobs, workflows, and commands necessary to automate the software development lifecycle. The following sections describe the different components of the configuration file.
slack
: CircleCI Slack orb version 4.10.1 is utilized for integrating with Slack and sending notifications.
-
destroy-environment
: Destroys the backend and frontend cloudformation stacks for a given workflow ID.- Parameters:
WorkflowID
: The ID of the workflow. By default, it uses the first seven characters of the CircleCI workflow ID.
- Parameters:
-
revert-migrations
: Reverts migrations for a given workflow ID.- Parameters:
WorkflowID
: The ID of the workflow. By default, it uses the first seven characters of the CircleCI workflow ID.
- Parameters:
The following jobs are defined:
build-frontend
: Builds the frontend application.build-backend
: Builds the backend application.test-frontend
: Runs frontend tests.test-backend
: Runs backend tests.scan-frontend
: Performs security audit and analysis for the frontend.scan-backend
: Performs security audit and analysis for the backend.deploy-infrastructure
: Deploys the backend and frontend infrastructure using AWS CloudFormation.configure-infrastructure
: Configures the server and installs dependencies using Ansible.run-migrations
: Runs migrations for the backend.deploy-frontend
: Deploys the frontend artifacts to an S3 bucket.deploy-backend
: Deploys the backend artifacts using Ansible.smoke-test
: Performs smoke tests for both frontend and backend.cloudfront-update
: Updates the CloudFront distribution.cleanup
: Cleans up the resources associated with the previous workflow.
The project includes a single workflow named blue-green-deployment
, which orchestrates the different jobs in a specific order:
build-frontend
andbuild-backend
run in parallel.- After successful builds,
test-frontend
andtest-backend
jobs are triggered. - Following successful tests,
scan-frontend
andscan-backend
jobs are executed. - Once the scanning is complete,
deploy-infrastructure
deploys the backend and frontend infrastructure using AWS CloudFormation. - After infrastructure deployment,
configure-infrastructure
configures the server using Ansible. - Next,
run-migrations
runs migrations for the backend. - Upon successful migrations,
deploy-frontend
anddeploy-backend
deploy the frontend and backend artifacts, respectively. - After deployment,
smoke-test
performs smoke tests to validate the deployed application. cloudfront-update
updates the CloudFront distribution.- Finally,
cleanup
cleans up resources associated with the previous workflow.
To utilize the CI/CD pipeline and automate the software development lifecycle, follow these steps:
- Ensure CircleCI is set up and integrated with your repository.
- Configure the required environment variables and secrets in the CircleCI project settings.
- Customize the configuration file as per your project requirements, such as changing image versions, paths, or adding additional steps.
- Commit and push the
.circleci/config.yml
file to your repository. - CircleCI will automatically detect the changes and trigger the defined workflows based on the specified conditions.
Feel free to modify the configuration file, jobs, or workflows to suit your specific project needs.
For more information about CircleCI and its configuration, please refer to the official CircleCI documentation.
Note: This README provides a high-level overview of the CI/CD pipeline and its components. For detailed information on each job and workflow step, refer to the comments and commands in the config.yml
file.