- Frontend deployed on vercel (Independent)
- Database hosted on cloud servers (Auto manage)
- Backend connects with jenkins webhook
- On each code push webhook triggers, test happens, builds image, pushed on docker hub
- Image updates and deployed on kubernetes cluster
Tech Stack : ReactJS, NodeJS, ExpressJS, MongoDB, Redis, Docker, Kubernetes, Jenkins, AWS ELB, Prometheus, Grafana
- Decoupled Frontend
- CI/CD with jenkins
- Docker base image optimization with layered caching
- Secure env with jenkins credential manager
- Conditional dependency installation (storage cache)
- Image scan for vulnerabilities and issues
- EKS image update rollout confirmation
- Auto rollback in case image updation fails
- Email alert post pipeline execution
- Kubernetes container orchestration with AWS EKS
- Load balancing using AWS ELB
- Application and cluster monitoring with prometheus and grafana
Requirements : AWS account, Docker Hub account
- Create two EC2 instances (master, agent)
- On master :
- Install jdk latest
- Install jenkins
- Attach elastic IP (optional but recommended)
- Add inbound rule for port : 8080
- Copy IPv4 and open in new tab with :8080 -> http://ipv4-address:8080
- Create jenkins account
- Connect EC2 with local machine or use AWS terminal :
- navigate to .ssh folder
- run command : ssh-keygen
- Store private key on safe place
- Copy public key (will use later)
- On agent :
- Install jdk latest
- Install docker, nodejs, npm, kubectl, aws cli
- Create a role for EC2 to communicate with EKS and attach the policy with agent EC2
- Navigate to .ssh folder > authorized_keys
- Paste master public key on authorized_keys
- Save and exit
- Copy agent node username (ubuntu)
- Copy private IP (if master and agent are within same VPC) otherwise allocate elastic IP for agent and copy IPv4
- In jenkins dashboard :
- Settings > credentials > add global credentials > type : ssh with username & private key
- Add username : ubuntu
- Add host : private IP
- Add secret/private key : master private key
- Save and exit
- Again on settings :
- Manage nodes
- Add a new agent/node
- Enter basic details
- Add authentication method and select from global credentials
- Save and exit
- Ready for jobs and pipeline 🎉
- Open github > repo you want to connect > repo settings
- Webhooks > add webhook
- url : http://ipv4-address:8080/github-webhook/ (IPv4 should not change that's why elastic IP is recommended)
- Content type : application/json
- SSL verification : disable
- Check event type
- Save and exit
- Done 🎉
- dashboard > new item > pipeline
- Select git scm polling
- Add repo url, branch, pipeline file script path (Jenkinsfile)
- Add authentication method : username with password or (personal access tokens)
- Save and exit
- Pipeline connected 🎉
- Create cluster in aws console with VPC settings and subnets (recommended : 3 subnets)
- Attach a role for EKS with EKSClusterPolicy
- Create one nodegroup with all the selected subnets
- Specs : atleast t3.small / t3.medium with 20GB storage and 1 node max. (for small deployments)
- Attach roles and policy to nodegroup :
- IAM > roles > select EC2
- Attach policy EC2WorkerNode, ContainerRegistry, CNI
- Save and exit
- Attach this role to the nodegroup
- On jenkins agent EC2 :
- Select IAM role and find ARN
- Copy ARN > navigate to EKS > cluster > select cluster > access
- Create a new principle access role and add the ARN
- Add policy of EKSClusterAdminPolicy
- Save and exit
- Now jenkins EC2 can make access to EKS cluster and run commands
- Create auto image update rollout in jenkins pipeline
- Done 🎉
