CI/CD Staging Deployment
We initially deployed to AWS using the cdk deploy CLI commands to get our infrastructure up and running. That was essential for the first deployment and setup.
Going forward, whenever we make changes to our code, we can just commit and push like usual. Thanks to our CI/CD pipeline, these updates will automatically trigger a deployment to our AWS infrastructure.
We've already configured the necessary secrets and variables in GitHub Actions, so our main.yml will take care of the rest—deploying everything for you as soon as you push your changes.
Deployment Trigger:
- Staging: Deploys when you commit and push to the
stagingbranch.
⚠️ Make sure that you have cloned the AWSLaunchGOAT-Backend repository and have your own GitHub repository prepared.
Step-by-Step
- Create a new branch
stagingfrom themainbranch.

Ensure that you are working on staging branch.
![]()
- Let's update our code in
src/app.tsby adding three exclamation marks:!!!

- Commit and sync changes (push). You can also do this via the command line.

- Go to GitHub Actions, and you will see that your workflow is now running.

- Click on the updated app.ts workflow, and you will notice that it is running the
teststep first.

⚠️ At the testing stage, docker-compose.test.yml is used in our CI/CD pipeline for staging. It loads Dockerfile.staging, replicating the staging environment to ensure that your changes are thoroughly tested before deployment.
- Apply the migration file to populate the tables and columns.

- After a few minutes, the entire workflow will fail because it encountered an error during the
teststage.

- Let's update the test script. Go to
tests/endpoints.test.tsand add three exclamation marks. Commit and push again. Go back to the GitHub Actions.

- Your
teststage should now be successful, and the workflow will proceed toDeploy to Staging.

- Once completed, let's check our endpoint. Go to
Load balancersfrom the AWS Management Console.

- Copy the
DNS nameand paste it into the browser.

- If you see three exclamation marks, then you're right on! (Make sure you are on http, not https)

- Lastly, since the migration file has been applied and the user table is populated, we can check if the
/usersendpoint is working.

404, Users not found is the message we want to see.