CI/CD Production Deployment
Deploying to production requires careful attention, as it involves updating the live environment. To ensure that all changes have been thoroughly tested, we only deploy to production after the changes have been merged into the main
branch via a pull request (PR) from the staging
branch.
Once the pull request is approved and merged, our CI/CD pipeline will automatically trigger the deployment process.
Deployment Trigger:
- Production: Changes are deployed when a PR from
staging
is merged intomain
.
⚠️ Please ensure that all changes are tested thoroughly in the staging environment before submitting a pull request for production deployment.
Step-by-Step
-
Submit a Pull Request
When you're confident in your changes, create a pull request from thestaging
branch to themain
branch.- Click on
New pull request
.
- Select
base:main
andcompare:staging
. Click onCreate pull request
.
- Add a title and click on
Create pull request
.
- Click on
-
Merge into Main
Merge the changes into themain
branch. This will automatically trigger the deployment to the production environment.
-
CI/CD Workflow
As soon as the pull request is merged, themain.yml
workflow will be executed. This workflow will:- Skip the
test
stage as the environment from staging has already been tested. - Deploy the application to the production environment.
- Apply any necessary migrations and updates to the production database.
- Skip the
-
Verify the Production Deployment
Once the workflow is complete, head over to the AWS Management Console of the Production account. Navigate toLoad balancers
and copy theDNS name
for the production environment.Paste the DNS name into the browser to verify that your changes have been successfully deployed.
💡 Always merge with caution! Production deployments affect the live environment, so ensure thorough testing on staging
first.
By following these steps, you can confidently deploy updates to production while maintaining a stable and reliable environment for your users.
Great job! Now we can deploy our changes via CI/CD, and the process is fully automated! Next, let’s configure your domain for the backend API.