Simple demo backend that checks weather in London via OpenWeatherAPI, CA on "/" path deployed to EKS in GitOps way.
The application is called weather-backend and is written in Golang, supports several paths: / - returns HTML with current weather in London, CA
~ ❯ curl development.s0rl0v.com ✘ INT
Temperature in London, Canada is 5.990000 C <br/>
~ ❯
/ping - returns PONG /health - returns JSON with status /metrics - http total requests, http request codes and golang metrics exposed by prometheus sdk /version - build metadata
Deployment instructions for EKS cluster with NGINX ingress, external secrets and argocd could be found here.
THere is GitOps repository for ArgoCD with manifests to deploy and continuously sync applications.
The app is containerized and pushed to ECR registry via GitHub Actions pipeline, then ArgoCD Image Updater (that continiously monitors application ECR repo) modifies the image to the new one for corresponding environment, thus triggering rollout.
This app uses trunk based development - main
branch for development, release/*
branches for releases.
The artifacts built from main
branch are deployed to development
environment, release/*
branches - to staging
and tagged changesets trigger deployment to production
environment.
# go mod download
# go run -ldflags "-X main.version=1.0.0 -X 'main.build=$(date)' -X main.version=1" ./main.go
OpenWeather API key AWS programmatic access
- Navigate to infrastructure repo and deploy according to the provided README:
NOTE: Write down the output - this will come handy in next steps.
-
Navigate to ArgoCD deployments repo and review IAM roles, repositories URLs (if you want to use different that defined here), helm values (especially ingress for weather-backend), replace IAM roles in annotations (search by arn) with values aquired in step 1.
-
Add your API key to SSM:
aws ssm put-parameter --name "/sorlov/weather/OWM_API_KEY" --type "String" --value "******"
-
Navigate to ArgoCD deployment repo and apply manifests README.
-
Point application DNS name to nginx controller:
k get svc -n ingress-nginx ingress-nginx-controller
- Test deployment by commiting something to the repo.
- Remove all the ArgoCD applicatons first (execute from ArgoCD deployments repo):
cd apps-registry && kustomize build | k delete -f-
- Execute terraform destroy.