services-flake icon indicating copy to clipboard operation
services-flake copied to clipboard

feat: Add support for mongodb

Open greg-hellings opened this issue 1 year ago • 6 comments

Adds support for running MongoDB, based off the Redis workflow.

greg-hellings avatar Sep 26 '24 14:09 greg-hellings

Thanks! Could you add some basic docs? See

https://community.flake.parts/services-flake/contributing#service-doc

srid avatar Sep 26 '24 14:09 srid

image

This dependency seems to be broken on Darwin. If the tests run on Linux you can conditionally disable it on Darwin (linking to upstream issue, if any):

https://github.com/juspay/services-flake/blob/23e40bdae913b64ffaeb774201b5a6f868ce19ca/test/flake.nix#L50-L55

shivaraj-bh avatar Sep 26 '24 15:09 shivaraj-bh

You can use python311 since the default now is 3.12 which suffers from the breakage

adrian-gierakowski avatar Sep 26 '24 21:09 adrian-gierakowski

Btw mongodb is never built by official nix hydra due to licence but I’ve seen it in devenv’s cache (including macOS). Might have to pull it from older nixpkgs commit

adrian-gierakowski avatar Sep 26 '24 21:09 adrian-gierakowski

I'll get on docs right now (sorry, I was at a company off-site last week when I put the PR together and haven't gotten back to it since getting home), along with setting the restriction on Darwin if it is indeed completely broken there.

As for there not being a binary cache, that was apparent the first time I fired up the test environment while I was rolling this for some dev work I was doing. On my work issued laptop (recent gen mobile Intel i7) the compile takes around 2 to 3 hours the first time it compiles Mongo, but it did go through without a hitch. After that first build, it's just as fast as anything else that you have locally cached. I know there are ways to set binary cache hints in a flake or such. But that would necessitate integrating with a binary cache, so I don't know if that's what you want to do here. Maybe I will just put a disclaimer in the docs letting people know that compiling.

From the point of view of the CI testing in this repo, though, I don't know what you might want to do.

greg-hellings avatar Oct 01 '24 20:10 greg-hellings

I've updated the test to be dependent on the jaraco-path.meta.broken value. If that gets unblocked in the future by fixing jaraco-path, this test will be automatically re-enabled. If the dependency gets worked around in the future then this can be revisted.

greg-hellings avatar Oct 02 '24 14:10 greg-hellings

Thanks!

shivaraj-bh avatar Oct 10 '24 06:10 shivaraj-bh

Nice stuff ! Just a very quick information, mongodb-ce can be used to use pre-compiled binaries.

drupol avatar Oct 12 '24 12:10 drupol

Nice stuff ! Just a very quick information, mongodb-ce can be used to use pre-compiled binaries.

What do you mean? They it will be built official nix hydra and available nix official binary cache?

Doesn’t looks like this to me: licence is the same as original mongodb package and there is not completed builds on hydra: https://hydra.nixos.org/job/nixos/trunk-combined/nixpkgs.mongodb-ce.x86_64-linux/latest

adrian-gierakowski avatar Oct 12 '24 13:10 adrian-gierakowski

This is the pre compiled binories from mongodb directly.

drupol avatar Oct 12 '24 14:10 drupol

This is the pre compiled binories from mongodb directly.

Damn! I tried replacing mongodb package with mongodb-ce and the tests pass (see: https://github.com/juspay/services-flake/pull/360).

@drupol Thanks for packaging this upstream!

Edit: We also get macOS compatibility as a bonus, which was broken earlier.

shivaraj-bh avatar Oct 12 '24 14:10 shivaraj-bh

I will also document this information in https://github.com/juspay/services-flake/pull/360, just in case someone doesn’t want to use pre-built binaries.

shivaraj-bh avatar Oct 12 '24 14:10 shivaraj-bh

Oh dang, that's sweet. Especially because my laptop sometimes fails to build mongodb due to the OOM-killer terminating some of the link steps!

greg-hellings avatar Oct 12 '24 15:10 greg-hellings

This is the pre compiled binories from mongodb directly.

Ah, cool. Should have looked more closely

adrian-gierakowski avatar Oct 12 '24 15:10 adrian-gierakowski