CICD Pipeline - Midterm Exam of Spring 2025 DevOps Class

 

Introduction 

This project was making CICD pipeline with Git Action, Docker, EC2, RDS, ECR, and Route53.

I used my side project Jake(Social Media platform for international students) as source code. The flow of CI/CD pipeline goes like below.

  • Source Repo contains Dockerfile and Docker-Compose.yml. It needs to run locally without any error.
  • Infra Repo contains GitAction workflow codes. This triggers launching a temporary EC2 and fetch codes from source repo. It builds docker files and conducts smoke test.
  • If smoke test succeeds, it pushes docker image to ECR, and it is deployed in EC2 as a QA Server.
  • Route 53 directs IP address to domain name.

The Issue 

There were many issues and errors while building the CI/CD pipeline. 

  • Source Repo Local test
    • CORS Error : Connecting FrontEnd and BackEnd caused CORS error, which is not letting other origin use same address. To fix it, I used Reverse Proxy by Nginx, and added annotation in SpringBoot controller(@CrossOrigin). 
    • ORM : JPA, or the ORM of SpringBoot caused error as no database schema existed in the db. I made database in MySQL(RDS) to fix the issue. 
  • Configuring Nightly Build in Infra Repo 
    • Need to add AWS Access Key Id, AWS Secret Access Key, and AWS Session Token info in Action Secret of Github. Those info were used in GitAction Workflow scripts to conduct tasks.
    • Needed Security Group for EC2 and RDS. 
    • Entering EC2 needed SSH key. Also to approach 22 port or SSH port, we need SSH Private Key. It is the code from pem key and it is saved in Action Secret.
    • Grant proper permission to run docker, such as the one for docker socket. 
    • Needed to add waiting steps in order to prevent errors originating from servers not being ready. Cloud servers need some time to be activated and run normally so I added sleep command combined with for/while statement to make it wait until servers are ready. 
    • For configuring ECR, I had to make the repository in advance and insert it properly with environment variables or Action Secrets. Finding correct path of Dockerfile and name of image to state it in GitAction Workflow Script was tricky and made couple of errors.
  • Deploy QA EC2
    • To deploy image in ECR, I had to make GitAction Workflow script. After log in EC2 with credential info from GitAction Secret, I needed to grant EC2 IP address and SSH Key to fetch docker image. 
    • Again, matching proper filename and path made several errors and made me spend time debugging. I could solve it by leaving logs, by logging with echo statement.
  • Add domain name and enable SSL
    • After buying domain at Name.com, I used AWS Route53 to map it with EC2 address. At Route 53, I added A record and did the same at name.com. Then I could access the running website with the domain name. 
    • Downloaded SSL credential in EC2 and redirected requests to 80 to 443 to enable https.

Tech stack

  • SpringBoot(JPA)
  • React.js
  • Nginx
  • Docker, Docker-Compose
  • AWS[EC2, RDS, ECR, Route53]

  • Git Action

Result / Lesson Learned

It looked simple but took much more time to finish the project. Every step needed debugging and required some time to find solution. However, it was worth it and I could grasp fundamentals of building CI/CD pipeline with Git, Git Action, Docker, and AWS. While it took time to make script, making automated workflow with it enabled swift integration and deployment. If there is some changes in code, CI/CD pipeline will help you deploy it right away.
Also I could understand unit test and integration test as a step to deployment process. For upcoming class, we will cover IaC, container orchestration, monitoring etc and I really look forward to it.


-Link (Video Demo) : link



Comments

Popular posts from this blog

2025 Spring CS686 DevOps - Final Project

Open Source Project - Open Energy Dashboard