Skip to content

This repo contains all files and codes for AltSchool of Cloud Engineering 3rd Semester Exam Submission

Notifications You must be signed in to change notification settings

Onyekachukwu-Nweke/altschool-sem3-final

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AltSchool-of-Cloud-Engineering-3rd-Semester-Exam-Submission

CircleCI

This project deploys two applications to the same kubernetes cluster using IaC and CI/CD approach.

The following tools where used for this project which are:

  • Kubernetes : an open-source container orchestration system for automating software deployment, scaling, and management.

  • Kubectl: a tool used to interact with kubernetes clusters

  • CircleCI: Is a cloud based CI/CD pipeline tool

  • Terraform: Is a cloud agnostic IaC tool used to provision of the app

  • Prometheus: Is a tool used for monitoring and alerting incase things starts get weary

  • Grafana: Is an open source analytics and interactive visualization web application used to visualize performance metrics

  • AWS: Is the cloud provider used for this project

  • Docker and Dockerhub

  • Git and Github

Step1: Setting up the Infrastructure with Terraform

Terraform Backend Setup

In the terraform folder, we have another folder called backend, this folder contains the configuration of where the terraform state file will be stored. I created an S3 bucket to store the file and an AWS DynamoDB to ensure state locking and consistency of the state file.

The bucket and DynamoDB set up by the CircleCI Pipeline

s3_bucket

dynamodb

Setting up the Kubernetes, IAM, Metrics and Logging

In the same terraform folder, there is a folder called infrastructure, the files in the folder has the configuration to provision an EKS cluster, create the VPC, set up an IAM role to secure access to who interacts with the cluster and other networking dependencies like lb and security group.

EKS_cluster

IAM_role

VPC

Route Table

SG

ASG

Also I setted up AWS Cloudwatch for logging and Metrics of the EKS cluster

cloudwatch

Deployment of Application

This folder contains the deployment files which I used to setup domain name for the web application and the microservice application and also the kubernetes manifest file (```complete-demo.yaml```) used to install the apllication on the cluster and exposing of ports used in the various applications.

r53

In the microservices application, I setted up a service called front-end and gave it a ```LoadBalancer```, also the web application I dockerized it and pushed it to dockerhub built from Nginx image and connected it to a ```mysql-db``` also exposing the service ```3306```

Step2: Dockerization of Udagram

In the udagram-app folder, there is a dockerfile used to dockerize the application and push to docker through the pipeline

dockerhub

Step3: CI/CD Pipeline with CircleCI

CI/CD was implemented for this project using CircleCI. The code for the CI/CD pipeline can be found in the .circleci folder which contains a config.yml file containing the code for the CI/CD pipeline. The CI/CD pipeline has six jobs;

  1. build_docker_image: this job builds the docker image for the portfolio app and pushes the built image to dockerhub image repository.

  2. create_backend_state_store: this job applies the terraform script(s) in the terraform-files/backend directory. This will create and S3 backend and DynamoDB for storing and locking state. This job will only execute if the backend branch of the repository is triggered.

  3. create_infrastructure: this job applies the terraform script(s) in the terraform-files/infrastructure directory. This will create the network infrastructure as earlier stated.

  4. deploy_applications: this job applies the terraform script(s) in the terraform-files/deployment directory. This will deploy the two applications to the EKS cluster created in the previous job. It also creates two subdomains and maps the loadbalancers from the two applications to the subdomains.

  5. configure_monitoring: this job applies the terraform script(s) in the terraform-files/monitoring directory. This will deploy prometheus and grafana to the cluster.

  6. destroy_everything: this job will destroy the whole deployment and infrastructure by executing terraform destroy --auto-approve in the terraform-files/monitoring, terraform-files/deployment and terraform-files/infrastructure directories. This job will only execute if the destroy branch of the repository is triggered.

CICD image

cicd-deploy image

The images shows the successful execution of the jobs in the CI/CD pipeline after it was triggered.

Step4: Provisioning a Monitoring system with Prometheus and Grafana

In the terraform, another folder called monitoring, has a series of yaml files (kubernetes manifest files) used to setup monitoring and alerting tools such as prometheus and grafana in the kubernetes. Using the cloud watch logs to analyze system performance/

In the grafana-svc and prometheus-svc files I changed NodePort to `LoadBalancer`

prometheus

Step5: Encryption of Sensitive Data in the Pipeline

I used CircleCI's envrionment variable to store sensitive data

env

View of Deployed Applications

blog

socks

About

This repo contains all files and codes for AltSchool of Cloud Engineering 3rd Semester Exam Submission

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published