Monorepo -vs- Multirepo


the local dev env should die!

A.K.A.

Tradeoffs and tooling of having all the code base in one place

Julien Bisconti

SRE / Data Engineer

Google Cloud Platform icon

contact

g.dev/julien

slides: bisconti.cloud

How do you know how to

build, test, run, debug, deploy

a project ?

Julien Bisconti

SRE / Data Engineer

Google Cloud Platform icon

contact

g.dev/julien

slides: bisconti.cloud

❌ Monorepo β‰  monolithic app 🧐

It’s about the development workflow πŸ‘©β€πŸ’»
And sharing surrounding code with colleagues
(build scripts, e2e tests, dependencies, docs, config,…)

Multiple languages ?

Multiple projects ?

What size ?

Everybody should do monorepo?

mono all the things
  • mono cloud provider account
  • mono k8s cluster
  • mono VPC
  • mono slack channel
  • mono computer (mainframe)
  • mono office space (open office)
  • mono chair (bench)
  • mono coffee machine
  • mononucleosis

Monorepo: please don't

@mattklein123/monorepos-please-dont-e9a279be011b

  • βœ… Easier collaboration and code sharing
  • βœ… Single build / no dependency management
  • βœ… Code refactors are easy / atomic commits
  • ❌ tight coupling and OSS
  • ❌ scalability
  • Demo: babel (js)

    babel

    Inside a monorepo

    • core + plugins?
    • libraries?
    • frameworks?
    • infrastructure?
    • every microservices?
    • all backend projects?
    • all frontend projects?
    • each fullstack projects?
    • each departments code?
    • whole company code ?

    πŸ‘‰ different levels of abstraction

    different levels of abstraction

    different levels of abstraction

    Archives of the History of American Psychology, The Center for the
    History of Psychology, The University of Akron army report uniformity

    gitlab: from idea to production

    gitlab from idea to production

    Multirepo

    1 microservice = 1 repository

    Why microservices ?

    πŸ‘‰ to ship your organization

    conway's law
    source

    Jeff Bezos 2002:

    • All teams will henceforth expose their data and functionality through service interfaces.
    • Teams must communicate with each other through these interfaces.
    • There will be no other form of inter-process communication allowed: no direct linking, no direct reads of another team’s data store, no shared-memory model, no back-doors whatsoever. The only communication allowed is via service interface calls over the network.
    • It doesn’t matter what technology they use.
    • All service interfaces, without exception, must be designed from the ground up to be externalizable. That is to say, the team must plan and design to be able to expose the interface to developers in the outside world. No exceptions.
    • Anyone who doesn’t do this will be fired.
    • Thank you; have a nice day!

    https://plus.google.com/+RipRowan/posts/eVeouesvaVX
    amazon org

    credit: Manu Cornet

    google org

    credit: Manu Cornet

    facebook org

    credit: Manu Cornet

    microsoft org

    credit: Manu Cornet

    apple org

    credit: Manu Cornet

    oracle org

    credit: Manu Cornet

    tooling

    GIT

    git
    GOTO 2015 β€’ Deep Dive into Git β€’ Edward Thomson

    monorepo with git

    • plain git
    • git subtree (folder)
    • git submodules (black box)
    • custom scripts
    git branches

    code storage β‰  deployment

    Toolling diagram

    tooling

    tooling (cont'd)

    Archive git history

    
    git clone file:///Users/$USER/Projects/myProject myClonedProject \
    --shallow-since=2016-09-02
        

    source

    getting good at monorepo means

    1. getting good at git and its internals
    2. being disciplined about code reuse and dependencies
    3. being disciplined for branches, PR size and documentation
    4. implementing features toggle and A/B testing
    5. having the whole picture ie. the whole code base on your hard drive (Linux kernel repo is ~20GB)
    6. understanding versioning
    7. immutable build (uniformity)

    Being disciplined relates to engineering culture

    What about the developer environment ?

    Developer environment

    • what's an environment ?
    • how to reproduce ?
    • how to make changes ?
    • code << project code

    Dev Env with Git submodules

    • opt-in ✌️
    • lightweight πŸ₯—
    • focus on developers πŸ‘©β€πŸ’»
    • faster onboarding πŸ™‹β€β™‚οΈ

    github blog - submodules

    + github/scripts-to-rule-them-all

    demo

    IDEA

    instead of trying to reproduce locally / mock:

    • all the microservices
    • all DBs (cluster?)

    on your 16GB laptop, why not a

    • cloned
    • on-demand
    • pre-setup

    environment ?

    Efficient -vs- Effective

    # minimalist

    gitpod.io

    codesandbox.io

    in browser editor:

    THANK YOU

    and I'm sorry πŸ™
    If you had to maintain my code
    I hope you learned more by maintaining it
    than me by writing it

    contact

    https://bisconti.cloud/

    @julienBisconti

    Slides made with Reveal.js and hugo-reveal