Slide 1

Slide 1 text

Monorepo vs Multirepo Which is the superior approach? Jochen Lillich @geewiz ● DrupalCamp Scotland 2019 1 / 28

Slide 2

Slide 2 text

Multirepo aka Manyrepo @geewiz ● DrupalCamp Scotland 2019 2 / 28

Slide 3

Slide 3 text

Monorepo Centralisation Visibility Synchronisation Completeness Standardisation @geewiz ● DrupalCamp Scotland 2019 3 / 28

Slide 4

Slide 4 text

Example SaaS product Web application API Client applications (iOS, Android) Shared libraries @geewiz ● DrupalCamp Scotland 2019 4 / 28

Slide 5

Slide 5 text

About me Jochen Lillich Founder/CTO freistil.it freistilbox.com Managed Drupal Hosting @geewiz ● DrupalCamp Scotland 2019 5 / 28

Slide 6

Slide 6 text

Monorepo users Google, Facebook, Twitter as well as Symfony, Laravel, Symplify, Shopsys, Contao, ... @geewiz ● DrupalCamp Scotland 2019 6 / 28

Slide 7

Slide 7 text

Multirepo Management overhead Silos Dependency hell Complex cross-project changes @geewiz ● DrupalCamp Scotland 2019 7 / 28

Slide 8

Slide 8 text

Monorepo Visibility Synchronisation Completeness Standardisation @geewiz ● DrupalCamp Scotland 2019 8 / 28

Slide 9

Slide 9 text

Visibility Finding and discovering code Development in the open Code sharing Cross-pollination @geewiz ● DrupalCamp Scotland 2019 9 / 28

Slide 10

Slide 10 text

Synchronisation Single history timeline Full-scope CI/CD Version-less dependency management Atomic cross-cutting changes @geewiz ● DrupalCamp Scotland 2019 10 / 28

Slide 11

Slide 11 text

Dependency management From "pull" to "push": Pull Dependency Management: Consumer is responsible Push Dependency Management: Maintainer is responsible @geewiz ● DrupalCamp Scotland 2019 11 / 28

Slide 12

Slide 12 text

You break it, you fix it. @geewiz ● DrupalCamp Scotland 2019 12 / 28

Slide 13

Slide 13 text

Completeness No external dependencies No downloads No "download failed" @geewiz ● DrupalCamp Scotland 2019 13 / 28

Slide 14

Slide 14 text

Standardisation Central issue tracking Common tooling Common practices (testing etc) Single CI integration Shared coding style guides @geewiz ● DrupalCamp Scotland 2019 14 / 28

Slide 15

Slide 15 text

Strengths More transparency Easier access Less overhead Simplified workflows Faster feedback loops Higher code quality Improved application security @geewiz ● DrupalCamp Scotland 2019 15 / 28

Slide 16

Slide 16 text

Weaknesses Volume of code Intimidating Long build times IDE lag Unclear ownership New tooling Broken master ! @geewiz ● DrupalCamp Scotland 2019 16 / 28

Slide 17

Slide 17 text

Monorepo best practices Build everything from source for every change Have clear ownership Set a file size limit Avoid breaking changes Use feature flags Use only short-lived branches @geewiz ● DrupalCamp Scotland 2019 17 / 28

Slide 18

Slide 18 text

Trunk Based Development "A source-control branching model, where developers collaborate on code in a single branch called ‘trunk’, resist any pressure to create other long-lived development branches by employing documented techniques. They therefore avoid merge hell, do not break the build, and live happily ever after." trunkbaseddevelopment.com @geewiz ● DrupalCamp Scotland 2019 18 / 28

Slide 19

Slide 19 text

Build tools Bazel (Google, Asana, Braintree, Dropbox) Buck (Facebook) Lerna (Babel, Cloudflare, WP Gutenberg) monobuild symplify/monorepobuilder shopsys/monorepo-tools @geewiz ● DrupalCamp Scotland 2019 19 / 28

Slide 20

Slide 20 text

Which approach should you choose? @geewiz ● DrupalCamp Scotland 2019 20 / 28

Slide 21

Slide 21 text

Why not both? " @geewiz ● DrupalCamp Scotland 2019 21 / 28

Slide 22

Slide 22 text

The "Splitrepo" hybrid A monorepo split into read-only project repositories Example: symfony/symfony splits into: symfony/console symfony/dom-crawler etc @geewiz ● DrupalCamp Scotland 2019 22 / 28

Slide 23

Slide 23 text

Splitting a monorepo git subtree split git filter-branch Monorepo-specific tools, e.g. split.sh @geewiz ● DrupalCamp Scotland 2019 23 / 28

Slide 24

Slide 24 text

Using git (lter-branch to split a monorepo @geewiz ● DrupalCamp Scotland 2019 24 / 28

Slide 25

Slide 25 text

Learn more @geewiz ● DrupalCamp Scotland 2019 25 / 28

Slide 26

Slide 26 text

Background Awesome Monorepo Monorepos in Git Monorepo: From Zero to Hero Advantages of Monolithic Version Control Monorepo? Please do! Why don't you have a monorepo? Advantages and Disadvantages of a Monolithic Codebase @geewiz ● DrupalCamp Scotland 2019 26 / 28

Slide 27

Slide 27 text

Case studies "Why is Babel a monorepo?" "Monorepo to Multirepo and back again" "The Symfony Monolith Repository" "The Many Benefits of a Monorepo" @geewiz ● DrupalCamp Scotland 2019 27 / 28

Slide 28

Slide 28 text

Thanks! Slides: http://bit.ly/monorepo-dcscot19 Feedback: @geewiz [email protected] @geewiz ● DrupalCamp Scotland 2019 28 / 28