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

Minio client and extra initialization options #716

Merged
merged 6 commits into from
Jul 11, 2023

Conversation

stephank
Copy link
Contributor

This adds mc to the profile if minio is enabled, and configures it to connect to the local minio using the conventional local alias.

I added services.minio.clientConfig = null as an opt-out. I imagine configuring other endpoints via Nix isn't ideal, because the config contains credentials, so this provides a way out to using your regular user config.

I also added a after option to allow running some additional initialization following minio startup.

Copy link
Member

@domenkozar domenkozar left a comment

Choose a reason for hiding this comment

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

Nice! I'd ask you to add an example/minio/ and example/minio/.test.sh to test the basics here as this service is getting more complex and it's good to have regression tests.

src/modules/services/minio.nix Outdated Show resolved Hide resolved
@domenkozar
Copy link
Member

You can test it like:

$ devenv shell
$ devenv-test-example minio

@stephank
Copy link
Contributor Author

Looks like devenv shell at the toplevel tries to rebuild nix itself for me, there's no cache. But I managed to write a test without it.

@stephank
Copy link
Contributor Author

It looks like minio doesn't actually generate credentials when left empty, it just uses minioadmin:minioadmin, so I made options reflect that, and that makes it work without configuring credentials at all.

@domenkozar
Copy link
Member

I've pushed a fix for making timeout available for tests, could you rebase?

@stephank stephank force-pushed the feat/minio-client branch 2 times, most recently from fea2ae8 to bc9790c Compare July 11, 2023 12:40
@stephank
Copy link
Contributor Author

Failure was because of default = defaultClientConfig; on an option, but that value was derived from config that was not available if minio is disabled.

I now use mkBefore, so that you could add aliases with just services.minio.clientConfig.aliases.foo = { ... }, and so that version is also set in that case. But unlike mkDefault, that means simply clientConfig = null doesn't work anymore, and mkForce is required.

@domenkozar domenkozar merged commit 7eb7515 into cachix:main Jul 11, 2023
@stephank stephank deleted the feat/minio-client branch July 11, 2023 16:28
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.

2 participants