- Now on to automating the flow using GitHub Action CI(How to replicate this at your end):
- Step1: Setup the following secrets for secret injection into pipeline in a secure way.
-
- DOCKER HUB USERNAME - to push image to docker hub
-
- DOCKER HUB PASSWORD- to push image to docker hub
-
- AWS_ACCESS_KEY_ID- for terraform to provision EKS CLUSTER
-
- AWS_SECRET_ACCESS_KEY- for terraform to provision EKS CLUSTER
-
- STATE_BUCKET_NAME - where TF will store its state file(S3 bucket was setup from portal)
-
- STATE_PATH - where TF will store its state file(S3 bucket was setup from portal)
-
Step2: Setup bucket with proper permission to store state file
-
Step4: Docker Image build pipeline
-
Trigger whenever Dockerfile in the repo is update.Comment explain what each step does.
-
Step5: Terraform INIT PLAN APPLY:
-
Run the TF Workfflow. Runs whenever the folder hosting the tf code i.e. "terraform" folder in the repo is updated.
-
Step6: If you want to destroy the complete infra run the TF Destroy(if needed). Run on manual trigger.
-
Capture of Pipeline runs:
-
Deployed with TF:
-
Unable to start the webserver to the the server bind. Will use better sample code to fix this.
-
FIX: Used code from this repo: https://github.com/jakshaym1234/rubysampleadjust
- Binded the application to port 8000 as the non root user cant bind to port 80
- Added liveliness and readness port also to watch for /index
-
SUCCESS AT LAST. APPLICATION IS AVAILABLE USING THE ALB PROVISIONED BY THE HELM CHART:
-
Write to me at kmjakshay@gmail.com if something is not working for you. Thanks