by gdxhyrd · 6y ago · 0 comments
Monorepos should be straightforward unless you are managing the code of >1k engineers.
IME, most consternation comes from people adopting a mono repo without adopting a build/dependency graph tool (like Bazel, buck or pants).
An additional source of strain is from people abusing the repo (checking in large binaries, third party dependencies, etc).
A third is when people try to do branch-based feature development, instead of the “correct” practice of only deploying master (or weekly cuts of master).
I think even a simple list of these sort of “gotchas” would be valuable for the aspirational mono repo company.
My impression is that a lot of teams hit these early and painful roadblocks, and imagine that they’ll never go away (they do!!).
We host a private mirror for third party dependencies, so that “pip install”/“go get” fail on our CI system if the dependency isn’t hosted by us. This gives us reproducible builds, while allowing us to hold 3rd party libraries to a higher standard of entry than source code. For certain libraries we pin version numbers in our build system, but in general it allows us to update dependencies transparently. It also keeps our source repo size small, for developers, and allows for conflicting versions (example Kafka X.Y and X.Z) without cluttering the repo with duplicates.
It’s definitely a smaller gotcha than the others I listed, maybe to the point where it’s not a gotcha, but I stand by it :)
This is what confuses me about monorepos. Their design requires an array of confusing processes and complex software to make the process of merging, testing, and releasing code manageable at scale (and "scale" can even be 6 developers working on 2 separate features each across 10 services, in one repo).
But it turns out that you can also develop individual components, version their releases, link their dependencies, and still have a usable system. That's literally how all Linux distros have worked for decades, and how most other language-specific packaging systems work. None of which requires a monorepo.
So what I'd like to know is, of the 3 actual reasons I've heard companies claim are why they need a monorepo, is it impossible to do these things with multirepo? If it is indeed "hard" to do, is it "so hard" that it justifies all the complexity inherent to the monorepo? Or is it really just a meme? And are these things even necessary at all, if other systems seem to get away without it?
If your code/project/company uses the dependency in any way in production and it is not a part of the base system (which should be reproducibly installed), you include it; either in source or binary form.
Why is the size a problem? Developers should only be checking out once. If your repo hits the many-GiB mark, then you can apply more complex solutions (LFS, sparse, etc.) if it is a burden.
That seems like a build problem, not a Git problem.
> An additional source of strain is from people abusing the repo (checking in large binaries, third party dependencies, etc).
That is not necessarily abuse. In fact, it is a good practice in many cases!
> A third is when people try to do branch-based feature development, instead of the “correct” practice of only deploying master (or weekly cuts of master).
I am not sure what you mean by branch-based development, but I don't see why that would be a specific problem of monorepos.
A monorepo is just 1 repo. There is nothing more straightforward than that.