Spent some time thinking about a #DevOps flow for agency-sized orgs working on web applications.
The idea is using #nix to pack a reproducible dev environment and build a docker image from it, which will be deployed on a container-host OS like #flatcar .
Principles:
- must be usable for small-sized projects on private infra or cloud providers
- must be development-first, so 1:1 parity between a local environment and production and no DevOps gates during deployments
- everything outside the dev env should be minimally intrusive
- OSS and lightweight sw is preferred
Locally we would have a nix-shell with runtime, toolchain (dependency managers and such) and a webserver. Also obv the app's git repo.
Then we would have a *build node* that acts as a docker registry and an online dev env. A simple pipeline would:
- pull the git repo
- build the docker image with nix
- push it to the local docker registry
- run the image and serve it.
This is automatable in a number of ways, including Ansible straight from the dev's machine without external CI tools.
The *prod node* would leverage Flatcar's init system to pull the latest the docker image and run it at boot, the provisioning can be done manually or via Terraform.
All testing (including security) runs in the dev environment.
Environment variables are also managed inside the application (with something like dotenvx) with appropriate secret management, keeping in mind that every build is a prod build, and all else is dev.
Database and observability systems are to be considered external dedicated services. Static assets (like media files) on the prod node are stored in a volume keeping the same paths as dev's.
Basic status-based orchestration can be done in docker leveraging healthchecks.