HumanGov: Automating HumanGov SaaS Application Build and Deployment Process on Kubernetes with CI/CD Pipelines using the AWS Code Commit, AWS Code Pipeline and AWS Code Build
In this hands-on project, I ventured into the automation of cloud-based services, focusing on the HumanGov SaaS application. The objective was to streamline the build and deployment processes using Kubernetes and implement continuous integration and delivery with AWS services.
The project kicked off with the configuration of the AWS CodeCommit repository to manage and store source code, ensuring version control best practices. Following this, I orchestrated the continuous integration (CI) process using AWS CodeBuild, setting up automated builds that compile and package the HumanGov application into a deployable format.
The central piece of the automation was the creation of Kubernetes configurations to define the deployment, including services, pods, and other necessary resources. I defined a continuous delivery (CD) pipeline with AWS CodePipeline, linking the source code repository, build service, and Kubernetes clusters to enable a seamless flow from code commit to deployment.
For the application’s containerization, Docker came into play. I created Dockerfiles to build images of the HumanGov application, which were then pushed to the AWS Elastic Container Registry (ECR). These images were pulled during the deployment phase on the Kubernetes cluster, ensuring an efficient and reproducible deployment process.
With the CI/CD pipeline in place, any change made in the source code automatically triggered a build process, followed by a deployment to the Kubernetes cluster. This allowed for high agility in feature development and deployment, with minimal human intervention.
The automation process concluded with rigorous testing of the deployment, ensuring that the application was performing as expected in the AWS cloud environment. This project not only automated the application deployment but also provided valuable insights into cloud services, Kubernetes orchestration, and the power of CI/CD in maintaining a robust development workflow.
Key takeaways from this project included the intricacies of AWS services, the advantages of Kubernetes in managing containerized applications, and the efficiency gains from automating the build and deployment pipeline.
Below are few screenshots:
HumanGov Logo
Creating HumanGov Kubernetes Cluster
AWS Cloud 9 — kubectl get nodes, kubectl get service
IAM Service Account
Load Balancer
Listeners
HumanGov application for the state of California
Kubectl apply for the state of Florida
Route 53 DNS — humangovmkg.click
Records created can be seen for state of California and Florida(only one load balancer is needed for any no of states with Ingress)
HumanGov application for the state of Florida
Code PipeLine Create build project
Add build stage
Review Pipeline
Create Pipeline
Pipleline execution in progress
Pipleline logs — error due to permission
Added ‘AmazonContainerRegistryPublic FullAccess’ policy
Policy successfully attached.
CodepipelineBuild — Retry stage
Codepipeline Build — In Progress
Codepipeline Build logs
Codepipeline Build successful as seen in logs.
Codepipeline Build successful
HumanGovDeployToProduction in CodeBuild
‘HumanGovDeployToProduction’ set in Code Pipleline
The home.html file title is changed from “HumanGov” to “HumanGov Saas Application” to simulate a developer’s activity of making changes to code.
Files changed not in git.
Git push
Codepipline Build starts immediately once the Git push completes pushing code to CodeCommit repository
Code Pipeline Build successful
HumanGovDeployToProduction logs
HumanGov application for the state of California. We can see the title of the application has been changed from “HumanGov” to “HumanGov SaaS application”.
HumanGov application for the state of Florida. We can see the title of the application has been changed from “HumanGov” to “HumanGov SaaS application”.
Edit the Code Pipeline
The AWS Codepipeline Test environment is introduced into the Code Pipeline simulating the Software testing process
Added HumanGovTest Codebuild
HumanGovTest in the Code Pipeline
HumanGovTest run in progress
HumanGovTest log successful
HumanGovTest successful in Code Pipeline
HumanGovDeployToProduction run successful once the HumanGovTest is successful
HumanGovDeployToProduction logs successful
Now simulating a developer making a mistake by removing H from the text Human — making it to “uman” and pushed to Git.
Code Pipeline started
HumanGovTest failed as expected to check the mistake made by the developer
HumanGovTest logs shows the error
Adding back the H to the text “uman” and pushing the correct code to fix the developer mistake.
Code Pipeline Build starts immediately as the code is pushed to the Git repository and then HumanGovTest is successful later.
Adding a staging area simulating the Software deployment process before it goes into production where few selected users do the important tests and then give a final approval for deploying to Production
Adding kubectl Ingress for the Staging
Creating a record in Route 53 for the Staging
Record created for Staging in Route 53
HumanGov application for Staging
HumanGovDeployToStaging in CodeBuild
HumanGovDeployToStaging in Code Pipeline
Adding Manual Approval step for HumanGovDeployToStaging to simulate the real world Software companies follow. Until it is approved the code wont kick off in the Code Pipeline for Production
Manual Approval
Manual Approval added in Code Pipeline
Changed home page title back to “HumanGov” and pushed the code to Git repository
Code Pipeline started immediately once the code is pushed
HumanGovDeployToStaging failed
HumanGovDeployToStaging logs
Fixed the issue in CodeBuild stage and HumanGovDeployToStaging ran successfully
Only the HumanGov Staging application code change is reflected in the application page(the HumanGov application for the State of California and state of Florida still remaining unchanged as expected as the HumanGovDevployToStaging has a manual step of approval in order for the code to be moved to Production)
ManualApproval step in Code Pipeline
The Manager or the team responsible can only do the review process to approve it.
Once the manual approval step is complete the Code pipeline moves to the next stage which is HumaGovDeployToProduction
HumaGovDeployToProduction in progress
HumaGovDeployToProduction successful
HumanGov application with “HumanGov” text is reflected in the applicaiton for the state of California and Florida
Now we can really see how the Continuous Integration and Continuous Deployment process using AWS Code Pipeline is in action in a fully automated way. Amazing!!!