Udacity AWS Cloud DevOps Engineer Nanodegree - Capstone Project
My Capstone project is a simple web server written in Go, which serves a basic web page with some styling. I used the gorilla/mux router for routing rather than just the standard library. I've included a few 'extra' features as well, namely graceful shutdown, custom filesystem to prevent directory listings and usage of the 'go:embed' directive to embed static assets in to the binary.
The Dockerfile is a multi-stage docker build, in order to reduce the size of the image.
You can run the unit tests for this project as follows
go clean -testcache ./... && \
go test -v -race ./...
You can run the web server locally by compiling the code and running the binary/executable
go build -o server .
./server
You can run the web server inside Docker
./run_docker.sh
You can also run inside Kubernetes on your own machine, using Minikube for example
./run_kubernetes.sh
The CICD tool of choice is CircleCI. As such, any commits will trigger the pipeline.
Any commits on the main branch, will also trigger a deployment to the AWS Cloud. This will perform a rolling deployment to a Kubernetes cluster running in Amazon EKS.
- Lint the Dockerfile and the Go code
- Vet the Go code
- Compile the Go code
- Run the unit tests
- Build the Docker image
- Tag the Docker image and push to Docker Hub
- Create an Amazon EKS cluster with Kuberneres version 1.18
- Apply the Kubernetes deployment and service to the cluster
- Perform a rolling deployment/restart
Build artifacts including test results, load balancer url and output from 'kubectl describe all' are all stored in the CircleCI artifacts tab of each build.