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

How to keep keys when restarting Meilisearch #2905

Open
CaroFG opened this issue Jul 8, 2024 · 2 comments
Open

How to keep keys when restarting Meilisearch #2905

CaroFG opened this issue Jul 8, 2024 · 2 comments

Comments

@CaroFG
Copy link
Contributor

CaroFG commented Jul 8, 2024

I've seen recently some user wondering about deterministic API keys, they want to know how to keep the same keys when restarting an instance.

I'm using Meilisearch in Render and every month they update the server manually and so the API keys are updated, which causes problems in my applications because I have to update the API keys.

Is there any way to keep the API keys fixed even if the server restarts? Can I generate the API keys and pass them on via an environment variable?

Also they seem confused about which keys are deterministic:

I'm running meilisearch with the same master key (and backed by the same EBS volume) and I'm sometimes getting different
admin API keys

I was under the impression keys were deterministically based on the master key, and would only change when the master key changes?
Is this assumption invalid or is this a bug (either in my code or Meilisearch)?

@guimachiavelli
Copy link
Member

Ok, took me some time, but finally made the time to dig a bit into this.

In short:

  1. API keys are, roughly speaking, a hash from the master key and an UUID
  2. If two instances share the same master key (e.g. carolina123), generating an API key with uuid 0000000-0000-0000-0000-00000000000 will result in exactly the same API key in both instances
  3. Since you cannot specify their uuids, users should not use the default API keys when they need their API keys to be deterministic

In the case of this user, they would have to stop using the default autogenerated API keys and add an extra step to their restart workflow where they create the keys they need by specifying their uuid.

@CaroFG
Copy link
Contributor Author

CaroFG commented Sep 13, 2024

Thank you! Yes, that's what I told them. I created the issue as a content piece or improvement suggestion. It seems some users expect to get the same default API keys if they run an instance with the same master key, which is not the case.

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

No branches or pull requests

2 participants