Fork me on GitHub
#tools-deps
<
2022-04-30
>
hkjels10:04:47

Have any of you worked on a hybrid of monolithic and split repo? And by that, I mean a monolith that include child-libraries via git submodules, so that others can make use of these child-libraries via deps.edn , while still working with it as if it was a monolith. I’m starting a project where I think it would make sense, but I would like to hear if others have some gotchas and bad experiences with it.

hkjels10:04:39

Or good experiences for that matter 🙂

lispyclouds10:04:32

we use this approach in #babashka https://github.com/babashka/babashka worked out fairly well I think, cc @U04V15CAJ

lispyclouds10:04:50

for me forgetting to do a submodule update was the worst of the issues 😅

pavlosmelissinos11:04:01

I don't get it! Why do you need git submodules if you have deps.edn?

borkdude11:04:45

because those git submodules are projects of their own. The alternative is to use them as git deps, but this allows me to quicker iterate

borkdude11:04:27

It sounds I've been doing exactly what @U0B1SDL67 is asking

borkdude11:04:56

You can use local/root in your parent project while the git submodules are still their own independent project

pavlosmelissinos11:04:25

> independent project > You mean like a separate repo? Oh I'm sure there's a reason but I'm wondering how this is better than having everything on the same git repo.

borkdude11:04:10

Yes, a separate repo. E.g.: https://github.com/babashka/sci https://github.com/babashka/fs are projects on their own but also used in babashka. I don't want to bump a git sha every time I make a small change to SCI or fs, so I use them as git submodules. Putting all those projects inside the babashka repo doesn't make sense since those projects can be independently used from babashka.

pavlosmelissinos11:04:16

Oh, I get it now, thanks for the explanation. I was going to recommend #polylith but if you need your projects to be separate repos it wouldn't work, obviously.

borkdude11:04:09

That and maybe some problems can be solved using lighter weight ways

hkjels11:04:10

Great! This put me at ease about the idea. Thanks

hkjels11:04:23

I’ve looked briefly at polylith, but it seems a bit cumbersome and overkill

hkjels11:04:51

might be that I just haven’t quite understood it though

lispyclouds11:04:37

The way i think about it is if i have bunch of code deploying as a single purpose set of microservices, polylith seems to be a good fit. ie, one repo and multiple deployable artifacts/services. If its a single deployable artifact, use submodules and/or git/maven deps. Both approaches try to address the code resuse problem but for me it depends on what am I trying to build.

lispyclouds11:04:56

git/maven deps vs submodules comes down to your dev practices/iteration needs etc like borkdude mentioned

borkdude11:04:45

well in theory I could also make a small (bb) script that quickly updates the git/shas of the libraries that I'm developing

1
👍 1
borkdude11:04:11

babashka is the only repo where I'm working like this. in other projects I usually switch between local/root and then back to git shas

borkdude11:04:16

in the babashka case, the build is also still based on leiningen which doesn't support git deps, which is why I chose git submodules initially. I needed uberjar, etc to work which wasn't there a few years ago in the deps.edn world

borkdude11:04:38

for development I use deps.edn there, but the deployment is done with lein

borkdude11:04:51

I will probably switch over in the future, but it wasn't a huge priority so far

borkdude11:04:39

it's occurring to me that you can switch between local/root and git shas also via an -Sdeps argument perhaps, for development

Alex Miller (Clojure team)12:04:08

Just fyi, Clojure CLI does not work with git deps using sub modules

borkdude12:04:19

in bb's case that's not a problem, but good point in general

steveb8n07:05:39

I'd like to do this as well. Ideally with different access control on submodules. Sadly I don't think cloud hosts support access control on modules