4 ms·
This sounds like the right way to do it. For me it has been tough to come up with principles that don't sound like they apply to any system. You start off with
by jrvarela56 4y ago
This sounds like the right way to do it. For me it has been tough to come up with principles that don't sound like they apply to any system. You start off with a generic CRUD app but as it grows the default/usual web framework constructs tend to leave you with a ball of mud. You can couple anything in there together and since you're pressed for time, you tend to do it. Abstractions feel premature and when they start emerging there's lack of conviction to push through with them and clean up the whole thing.
Do you have any starter resources to come up with principles for a system? Maybe something showing how certain principles lead you to implementation choices that would've been different under another philosophy.
- r3trohack3r 4y agoFor a 2 week Terraform audit, these are the high level philosophy points I put together. The final doc was 10 pages. Each point lists the reason for choosing this approach and any trade-offs that come with it. * Small composable Terraform modules * Don't manage IaC declarations alongside code in a polyrepo * Direnv for managing env configs across repos * Manage k8s using k8s manifests and not terraform files (kubectl provider gives us this) * Delegate flux management to flux-cli * Auto-unseal Vault to capture and protect the vault token Then a list of recommended reading: * Terraform Up and Running * Building Microservices * Site Reliability Engineering This list is more tactical since we didn't build the system, we were auditing their current setup.
- mattacular 4y ago> Don't manage IaC declarations alongside code in a polyrepo Can you elaborate on this one? (And thanks for the interesting comments)
- r3trohack3r 4y ago> The source code for services should not be coupled to their deployments when managed in SCM. The lifecycle of changes for infrastructure are different than the lifecycles of artifacts for services. Any artifact should be able to be configured and deployed into any (supported) infrastructure configuration. For example, running git revert on a service should be able to yield a deployable artifact regardless of how the infrastructure is configured. By coupling these, you tie changes to infrastructure to changes in services. A rollback for your service can also unintentionally rollback how that service gets deployed – and avoiding that requires an engineer hold both the context of the infrastructure and the context of the service in their head whenever they are manging git history. It becomes difficult to deploy an older version of a service for testing. It also breaks git-bisect since, now, searching for a regression in software also changes how that software is getting deployed. This is an extension of managing IaC as small composable modules. The source code for a service should, itself, be viewed as a composable module. That module may take on a different format than other pieces of IaC (i.e. a .tar.gz, a .deb, or a docker image instead of a terraform module or a terraform provider) – but it’s API contracts are still drawn around the unit of deployment and not the monolithic infrastructure stack that will be deployed with it. This, of course, does not apply to projects using a monorepo.
- perfmode 4y agohow would one manage independent infra and services in a monorepo?
- deleted 4y ago[deleted]
- r3trohack3r 4y agoThe philosophy is the same, but the implementation is different. You still keep them separate but your monorepo tooling handles that separation. When multiple changes go out together, some being infra some being code, the tooling should be aware of those dependencies (just like any other) and handle resolving the infra first. The muscle memory of devs in a monorepo tend to be different too. Folks are used to scoping their SCM changes to folders instead of working at the top level of the git repo (i.e. you usually don't find yourself doing a `git reset --hard HEAD~10` in a monorepo outside of a feature branch - other teams get grumpy when you blow away their changes on the mainline branch). I make this distinction between polyrepos and monorepos for IaC because I've seen this advice result in folks splitting their monorepo into a birepo, or using IaC adoption as a driving reason to migrate their company to a polyrepo. There isn't anything wrong with the birepo approach, but it can be accomplished inside the monorepo all the same.