Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Monorepo vs Manyrepos

A Monorepo vs Manyrepos

Fabien Potencier

April 25, 2016
Tweet

More Decks by Fabien Potencier

Other Decks in Programming

Transcript

  1. A Monolith Repository
    vs
    Many Repositories
    F A B I E N P O T E N C I E R
    @ F A B P O T

    View full-size slide

  2. A Monorepo
    vs
    Manyrepos
    F A B I E N P O T E N C I E R
    @ F A B P O T

    View full-size slide

  3. The monorepo
    https://github.com/symfony/symfony
    Bridge/
    5 sub-projects
    Bundle/
    5 sub-projects
    Component/
    33 independent sub-projects like Asset, Cache,
    CssSelector, Finder, Form, HttpKernel, Ldap,
    Routing, Security, Serializer, Templating,
    Translation, Yaml, ...
    43 projects, 25 000 commits, and 400 000 LOC

    View full-size slide

  4. The monorepo
    Agent
    PHP extension
    Signify
    Chrome Extension
    PHP SDK
    Player
    Docs
    Book
    Go
    C
    C
    JavaScript
    PHP
    PHP
    ReST
    ReST

    View full-size slide

  5. Development
    vs
    Distribution

    View full-size slide

  6. Monolith Repository

    Tightly coupled code

    View full-size slide

  7. Monorepos are

    awesome
    Make large

    backward incompatible changes easily...

    especially if they span

    different parts of the project

    View full-size slide

  8. Monorepos are

    awesome
    Old APIs can be removed with confidence

    View full-size slide

  9. Monorepos are

    awesome
    Change an API endpoint code

    and all its usages in all projects

    in one pull request

    View full-size slide

  10. Monorepos are

    awesome
    Code review are easier

    no manual coordination between multiple repos

    View full-size slide

  11. Monorepos are

    awesome
    Easy continuous integration
    for changes spanning several projects

    View full-size slide

  12. Monorepos are

    awesome
    Productivity increases

    View full-size slide

  13. Monorepos are

    awesome
    No switch from one repo to the next

    depending on which part of the codebase

    you are working on

    View full-size slide

  14. Monorepos are

    awesome
    Collaboration between teams becomes natural

    View full-size slide

  15. Monorepos are

    awesome
    Developers can fix bugs in all projects

    Noone owns code

    View full-size slide

  16. Monorepos are

    awesome
    Less management, everything is centralized

    View full-size slide

  17. Monorepos are

    awesome
    Dependency management is a non-issue,
    no need for version constraints for internal code

    View full-size slide

  18. Manyrepos are

    awesome

    View full-size slide

  19. Manyrepos are

    awesome
    Clean boundaries
    between projects
    for free

    View full-size slide

  20. Manyrepos are

    awesome
    Code more reusable in other contexts

    View full-size slide

  21. Manyrepos are

    awesome
    Access control is easy

    View full-size slide

  22. Manyrepos are

    awesome
    Continuous integration might be simpler as well

    View full-size slide

  23. Working with

    a monorepo
    and

    manyrepos?

    View full-size slide

  24. Manyrepos - 43
    https://github.com/symfony/asset
    https://github.com/symfony/console
    ...
    https://github.com/symfony/*
    A monorepo - 1
    https://github.com/symfony/symfony

    View full-size slide

  25. symfony/symfony
    src/Symfony/Component/Console
    CHANGELOG.md
    Command/
    Exception/
    LICENSE
    ...
    symfony/console
    CHANGELOG.md
    Command/
    Exception/
    LICENSE
    ...

    View full-size slide

  26. git log --oneline origin/2.0 src/Symfony/Component/Console
    3be3dde [Console] Fixed comment
    dc2cc6b [Console] fixed input bug when the value of an option is empty (closes #6649, closes #6689)
    151f2c1 Revert "merged branch egeloen/f-2.0-terminal-width (PR #6571)"
    5157693 merged branch egeloen/f-2.0-terminal-width (PR #6571)
    f299bd0 [Console] Make getTerminalWith & getTerminalHeight public
    df5c171 updated license year
    2fc41a1 [Console] fixed unitialized properties (closes #5935)
    9aec4c8 Show correct class name InputArgument in error message
    762649f shows correct class name InputOption in error message
    git log --oneline origin/2.0
    da9d86b [Console] Fixed comment
    5aaf6a3 [Console] fixed input bug when the value of an option is empty (closes #6649, closes #6689)
    efa6379 Revert "merged branch egeloen/f-2.0-terminal-width (PR #6571)"
    c9511da merged branch egeloen/f-2.0-terminal-width (PR #6571)
    47e1ce7 [Console] Make getTerminalWith & getTerminalHeight public
    f3168bf updated license year
    fc6e023 [Console] fixed unitialized properties (closes #5935)
    29e0ef3 Show correct class name InputArgument in error message
    03cec88 shows correct class name InputOption in error message

    View full-size slide

  27. tree 55adb57
    symfony/symfony
    f299bd0
    git ls-tree origin/2.0 src/Symfony/Component/Console

    View full-size slide

  28. symfony/symfony
    f299bd0
    git ls-tree origin/2.0
    src/Symfony/Component/Console
    symfony/console
    47e1ce7
    git cat-file -p origin/2.0
    tree 55adb57

    View full-size slide

  29. symfony/console
    47e1ce7
    symfony/symfony
    f299bd0
    55adb57
    a463ed5
    ade4572
    4f33efa
    978ac3e

    View full-size slide

  30. source of thruth
    "read-only"
    Code changes
    Access control
    Tags
    CI / CD
    ...
    ?
    ...
    repo repo repo repo repo
    Manyrepos
    Read-time sync
    commits, tags, ...
    Monorepo
    PR moves

    View full-size slide

  31. Splitting

    a monorepo

    to manyrepos
    git subtree split

    View full-size slide

  32. ... at scale
    git subtree split
    1 monorepo
    43 manyrepos
    5 maintained versions
    220 maintained branches

    View full-size slide

  33. split.sh, a rewrite in Go + libgit2
    Initial split
    From hours+ to < 1 minute
    Incremental splits
    From minutes+ to < 10ms

    View full-size slide

  34. split.sh
    a toolkit to manage mono/many repos

    View full-size slide

  35. split.sh
    Pull requests are automatically moved

    from the manyrepos to the monorepo

    View full-size slide

  36. split.sh
    CI/CD can happen

    from the monorepo

    and/or the manyrepos

    View full-size slide

  37. split.sh
    Contractors can have access

    to some manyrepos only

    View full-size slide

  38. split.sh
    and much more...

    View full-size slide

  39. split.sh for
    Agent
    PHP extension
    Signify
    Chrome Extension
    PHP SDK
    Player
    Docs
    Book
    Website
    Go
    C
    C
    JavaScript
    PHP
    PHP
    ReST
    ReST
    PHP/Symfony
    Open-Source
    Open-Source
    A contractor works
    on this part only
    Independant
    releases
    Deployed
    together

    View full-size slide

  40. Soon to be released as Open-Source
    Interested?

    Email me at [email protected]
    Thank you!

    View full-size slide