real-world-devops-with-nix
real-world-devops-with-nix copied to clipboard
An example project for building containers with Nix and deploying them to Kubernetes
Real world DevOps with Nix
This example project is meant to demonstrate the power of Nix in a DevOps context. You can see this repo in action in my talk Real world DevOps with Nix, which was part of the Summer of Nix video series in 2022.
Moving parts
- A very simple "TODOs" web service written in Go in
cmd/todos/main.go. This service is built to be deployed on a Kubernetes cluster running on Digital Ocean. - That cluster is stood up using a Terraform configuration in
main.tfandterraform.tfvars. - The Kubernetes configuration in
k8s/deployment.yamldefines the Kubernetes Deployment for the service. - The GitHub Actions pipeline
- Builds a Docker image for the TODOs service using Nix
- Pushes the image to Docker Hub
- Updates the existing Deployment to use the new image
- Restarts the Deployment to complete the upgrade
Some other things to note:
-
The Kubernetes configuration for the Digital Ocean cluster, named
real-world-devops-with-nix, is provided under theKUBE_CONFIGenvironment variable in the CI pipeline. To get that configuration as a base64 string:doctl kubernetes cluster kubeconfig show real-world-devops-with-nix | base64