-
Notifications
You must be signed in to change notification settings - Fork 62
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
Support ferretdb to replace mongodb #142
Comments
I was able to get the keyserver to start with this change,
I could upload keys and receive verification emails, but after verifying emails, search gives an error "unknown operator: email" and trying to remove a key results in "User ID not found" when clicking on the verification link received via email. Not sure if this is related to the above change or something missing in ferretdb. |
npm test shows 6 failing tests
|
Here you can revert bf2b856 to bring back unverified key purges without requiring TTL. |
Does not sound like these errors are related to the change. |
|
git revert does not work for this commit, so I checked out its parent commit. But same error for searching. I created the recommended indexes too. Any ideas for further debugging? |
When I run db.publickey.find() in mogosh, I see all uploaded keys have verified: false, so it seems the problem is in key verification.
Though clicking on the email link says "Email address praveen@onenetbeyond.org successfully verified" |
We should probably double check verified field is actually set to true before showing the verification successful message. Could this be a problem with ferretdb missing some features or behaving differently? |
The verified field is set here: https://github.com/mailvelope/keyserver/blob/master/src/modules/public-key.js#L212 |
Searching for .$. gave this https://github.com/FerretDB/FerretDB/blob/def90a13a31e901361d04038792452f14e78a534/internal/handler/common/projection.go#L106 so it looks like positional projection can only be used at the end. Is there another way to express the same? |
Looking at https://www.mongodb.com/docs/manual/reference/operator/projection/positional/#positional-operator-placement-restriction this seems invalid |
The update query matches nothing with ferretdb
This is likely because ferretdb does not support nested arrays. And userIds is a nested array (an array of embedded documents). So the query there which includes This diff might help to get past this:
But that's again going to be heartbreak as when you search you'll get a new error: "unknown operator: email" which arises from keyserver/src/modules/public-key.js Lines 265 to 266 in 60da5dc
The $elemMatch seems to have different behaviour in ferret supporting only comparison operators like "$eq". You could perhaps work around that too, but at this point, it might be easier to just write a module to make keyserver store data directly in postgres instead of this mongo -> ferret -> postgres incompatibilities |
@asdofindia thanks, with this, search by keyid works. For example, https://keys.puri.sm/pks/lookup?op=get&search=0xD30863E26020E543F4719A838F53E0193B294B75 |
@toberndo do you think switching directly to PostgreSQL is possible? |
With the following change, search by email is working.
|
Now removing a key is failing with 'User ID not found' when clicking on the link received by email. We need to replace 'userIds.$.nonce' like before in https://github.com/mailvelope/keyserver/blob/master/src/modules/public-key.js#L342 |
With this change, I'm able to remove by email as well,
|
I have pushed these changes here https://source.puri.sm/Purism/keyserver/-/commits/ferretdb-compat/?ref_type=HEADS I'd be happy if this is maintained as separate branch in this repo itself. |
@pravi happy to hear you got it working. I've done only an eyeball review. In the remove part, as per the code the key can be removed by keyId as well. I'm not sure if your patch supports that. Other changes in https://source.puri.sm/Purism/keyserver/-/compare/master...ferretdb-compat?from_project_id=3240&straight=false looks like they will work (although I'm not sure whether that breaks compatibility with any mongo version) |
@asdofindia I saw the remove by keyid part in the code as well, but there is no such option in the web ui. So I thought I could skip that for now. |
I pushed the changes to branch https://github.com/mailvelope/keyserver/tree/ferretdb-compat |
FerretDB aims to replace MongoDB since the latter is no longer Free Software.
At present it fails with MongoServerError: Index option "expireAfterSeconds" is not implemented yet
But it could be worked around until this is implemented, FerretDB/FerretDB#2415 (comment) "include a check for the property in question in your actual query, so results that are too old just don't come back, and do your own purges of stuff older than that periodically."
It would be nice to be able to setup mailvelope keyserver with fully Free Software dependencies.
The text was updated successfully, but these errors were encountered: