Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add support for mongodb #339

Merged
merged 1 commit into from
Oct 10, 2024
Merged

Conversation

greg-hellings
Copy link
Contributor

@greg-hellings greg-hellings commented Sep 26, 2024

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

@srid
Copy link
Member

srid commented Sep 26, 2024

Thanks! Could you add some basic docs? See

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

@shivaraj-bh
Copy link
Member

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):

] ++ lib.optionals pkgs.stdenv.isLinux [
# Broken on Darwin: https://github.com/NixOS/nixpkgs/issues/316954
"${inputs.services-flake}/nix/services/grafana_test.nix"
# Broken on Darwin: https://github.com/NixOS/nixpkgs/issues/321329
"${inputs.services-flake}/nix/services/searxng_test.nix"
]));

@adrian-gierakowski
Copy link
Contributor

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

@adrian-gierakowski
Copy link
Contributor

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

@greg-hellings
Copy link
Contributor Author

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 greg-hellings force-pushed the add-mongo branch 2 times, most recently from d4101b8 to 18a962e Compare October 2, 2024 14:40
@greg-hellings
Copy link
Contributor Author

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.

test/flake.nix Outdated Show resolved Hide resolved
doc/mongodb.md Outdated Show resolved Hide resolved
Copy link
Member

@shivaraj-bh shivaraj-bh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just a few more changes and I can merge

nix/services/mongodb.nix Outdated Show resolved Hide resolved
nix/services/mongodb.nix Show resolved Hide resolved
MongoDB currently fails to build on Darwin because of a transitive build
dep on jaraco-path. So we make the test dependent on that. I do not,
however, choose to completely disable MongoDB because someone might have
workarounds for the package building in their environment.
@shivaraj-bh shivaraj-bh merged commit a5b0c00 into juspay:main Oct 10, 2024
2 checks passed
@shivaraj-bh
Copy link
Member

Thanks!

@drupol
Copy link
Contributor

drupol commented Oct 12, 2024

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

@adrian-gierakowski
Copy link
Contributor

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

@drupol
Copy link
Contributor

drupol commented Oct 12, 2024

This is the pre compiled binories from mongodb directly.

shivaraj-bh added a commit that referenced this pull request Oct 12, 2024
…le test on `macOS`

`mongodb` is not built by official hydra due to license restrictions,
see:
#339 (comment).
Hence, we use the pre-built binaries.
@shivaraj-bh
Copy link
Member

shivaraj-bh commented Oct 12, 2024

This is the pre compiled binories from mongodb directly.

Damn! I tried replacing mongodb package with mongodb-ce and the tests pass (see: #360).

@drupol Thanks for packaging this upstream!

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

@shivaraj-bh
Copy link
Member

I will also document this information in #360, just in case someone doesn’t want to use pre-built binaries.

@greg-hellings
Copy link
Contributor Author

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!

@adrian-gierakowski
Copy link
Contributor

This is the pre compiled binories from mongodb directly.

Ah, cool. Should have looked more closely

shivaraj-bh added a commit that referenced this pull request Oct 13, 2024
…le test on `macOS`

`mongodb` is not built by official hydra due to license restrictions,
see:
#339 (comment).
Hence, we use the pre-built binaries.
shivaraj-bh added a commit that referenced this pull request Oct 13, 2024
`mongodb` is not built by official hydra due to license restrictions,
see:
#339 (comment).
Hence, we use the pre-built binaries given by `mongodb-ce`
shivaraj-bh added a commit that referenced this pull request Oct 13, 2024
`mongodb` is not built by official hydra due to license restrictions,
see:
#339 (comment).
Hence, we use the pre-built binaries given by `mongodb-ce`
shivaraj-bh added a commit that referenced this pull request Oct 13, 2024
`mongodb` is not built by official hydra due to license restrictions,
see:
#339 (comment).
Hence, we use the pre-built binaries given by `mongodb-ce`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants