Local development
Local development is an integral part of the saferatday0 story. We advocate for development methodologies that can be executed on local workstation because they:
-
Are less expensive to operate,
-
Support more equal team participation,
-
Result in less starting friction,
-
Favor portable, openly available tooling that reduces the risk of lock-in,
-
Expose teams to operational considerations of their development choices, and
-
Facilitate remote and mobile work arrangements with low connectivity.
On this page, we make the case for supporting local development, and the case for the tools we have adopted for our library components. Adopters are constrained by these choices only to the extent that they wish to leverage our library components. There is nothing that limits saferatday0 methods to these tools specifically.
Pre-commit hooks
Pre-commit hooks solve two major problems that make it worthy of inclusion:
-
They help resolve CI/CD failures without the use of self-modifying projects.
-
They help avoid certain classes of errors, for example by preventing secrets from being committed.
The saferatday0 authors have adopted the aptly-named
pre-commit
tool, because it can be used to support a
wide variety of frameworks and tools.
Local cluster environment
Each developer maintains a local cluster for application development. For this
purpose, we tend to use minikube
, but
similar results can be had with kind
,
microk8s
, and similar.
Use the docker
driver
If you're using minikube, the docker
driver makes it lighter weight, easier to
manage, and faster to start.
minikube start --driver=docker
Increase cluster resources
Remember to pass CPU and memory configuration when starting a cluster. Our rule of thumb is half of whatever is available. For a 4-core machine with 16G of RAM:
Info
If hyperthreading is enabled, double the value for --cpus
.
minikube start --cpus=2 --memory=8G --driver=docker
Configuring your load balancer
Avoid sudo
with minikube tunnel
as this has a habit of using the wrong
cluster profile.
Run minikube tunnel
and type your password to configure your load balancer.
minikube tunnel
We recommend against NodePort because it is not consistent with a production use case.
Configuring local DNS
This comes most in handy for testing things like encryption, authentication, and so on.
Cluster application live-reloading
The saferatday0 authors use skaffold
for
live-reloading cluster applications. We avoid the functionality pertaining to
pushing to production clusters and use only the container re-build/re-deploy
functionality.
Configuration management
We use OpenTofu to manage production deployments, but it works just as well for managing local minikube deployments.
General project automation
The saferatday0 authors reach for make
because it is stable, mature, and ubiquitous.