This repo provides an example of integrating Nix into a DevOps deployment pipeline. The scenario:
- Terraform stands up a Kubernetes cluster on DigitalOcean
- Nix provides a development environment for a simple—okay, silly—Go web service that tells you your horoscope based on your star sign.
- Nix also builds a Docker image for the web service.
- A GitHub Actions pipeline builds and then deploys the image to a Kubernetes cluster running on DigitalOcean.
This repo was created in conjunction with Deploying Nix-built containers to Kubernetes, which is published on our blog.
- Go web service
- Terraform config
- Terraform variable definitions and variable values
- Kubernetes Deployment config
- A Nix flake defines the development environment and package/app outputs
- Nix-defined continous integration logic
- GitHub Actions pipeline. Note: the
deploy
job in the Actions pipeline is expected to fail, as it assumes that the Kubernetes cluster is currently running. We're gonna go ahead and save costs (and electricity) byterraform destroy
ing the cluster when we're not using it 😀
GitHub Container Registry stores Docker images built by Nix.
See DEVELOPMENT.md for instructions on standing up the infrastructure and interacting with the Kubernetes cluster.