This is a simple website written in Golang. It uses the net/http
package to serve HTTP requests.
- To run the server locally, execute the following command:
go run main.go
- The server will start on port 8080. You can access it by navigating to
http://localhost:8080/courses
in your web browser
-
Write the Dockerfile
-
Setup the
Github action
pipeline flow for CI build -
Setup the
tag rules
in the github repository -
Setup the required tokens, username, password for the Github action flow
-
Set the Github action based on the proper tag push based on the environment
-
Configure Helm templates
-
We will deploy two deployments bassed on the environments, so environment specific values.yaml files should be specified
-
Configure the minikube cluster
-
Start Minikube and Enable Ingress
minikube start
minikube addons enable ingress
- Create the namespaces required
kubectl create namespace web-dev
kubectl create namespace web-prod
kubectl create namespace argocd
kubectl create namespace prometheus
kubectl create namespace grafana
- Create the argocd components
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
- Configure the argocd-server, change it to Service type LoadBalancer
kubectl patch svc argocd-server -n argocd -p '{"spec": {"type": "LoadBalancer"}}'
For Windows
kubectl patch svc argocd-server -n argocd -p '{\"spec\": {\"type\": \"LoadBalancer\"}}'
- Configure the
hosts
file
For Windows the file path : C:\Windows\System32\drivers\etc\hosts
Run the following command to get the Node IP
kubectl get nodes -o wide
or for minikube run this following command
minikube ip
configure the hosts file in the following pattern
192.168.59.101 go-web-portfolio.com
192.168.59.101 go-web-portfolio-dev.com
NOTE:
192.168.59.101
should be replaced with your Node IP
- Fetch the argocd secret and decode it with base64 --decode
- Open the argocd from browser
http://<node ip>:<argocd service nodeport>
Then login with the admin
username and the password that you fetched from the secret
- Configure the argocd setup
- Create two projects with the name web-go-dev, web-go-prod
- The sync should be automatic
- Check the auto-heal option
- Provide the correct Github URL where your Helm charts reside
- The argocd will detect the chart folder path from the repository
- While providing the vaules files provide the values.yaml, values-dev.yaml for the web-dev project
- Provide the values.yaml, values-prod.yaml for web-prod project
- Select the claster and the namespace where the Helm charts will be deployed
- Click on create
-
Commit all the changes in the Github repository
-
Create a git tag with the following pattern
Pattern of the tag <dev|prod>-release-<3 digits>-<tag message>
mismatch of the pattern will not run the pipeline
to trigger the pipeline for dev, tag with the following pattern should be pushed
git tag dev-release-001-Julyrelease
git push --tag
to trigger the pipeline for prod, tag with the following pattern should be pushed
git tag prod-release-001-Julyrelease
git push --tag
- Pushed git tag will trigger the CI build via github actions, which will build a new image
- You will notice for the specific git tag, based on whether it is a
dev-release
orprod-release
the corresponding values.yaml file is getting updated in the Helm folder - The configured argocd will detect the changes and deploy automatically in the cluster
- Setup the Prometheus configuration on the cluster via Helm charts
Add Prometheus Helm Repository
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts -n prometheus
Update Helm Repository
helm repo update
Install the Prometheus Helm Chart
helm install prometheus prometheus-community/prometheus -n prometheus
Expose Prometheus Service
This is required to access prometheus-server using the browser
kubectl expose service prometheus-server --type=NodePort --target-port=9090 --name=prometheus-server-ext -n prometheus
- Setup the Grafana configuration on the Cluster via Helm Charts
Add Grafana Helm Repository
helm repo add grafana https://grafana.github.io/helm-charts
Update Helm Repository
helm repo update
Install the Prometheus Helm Chart
helm install grafana grafana/grafana -n grafana
Expose Grafana Service
This is required to access grafana-server using the browser
kubectl expose service grafana --type=NodePort --target-port=3000 --name=grafana-ext -n grafana
-
Fetch the Grafana secret which will require to Login to grafana from the browser
-
Setup Grafana
-
Configure the dashboards for monitoring