Support of MongoDB

96 views
Skip to first unread message

Yannick Heinrich

unread,
Jun 28, 2016, 3:53:11 PM6/28/16
to ory-hydra
Hello :)

I just discovered this amazing piece of software. The works seems to be great. As mentioned in the README, other database could be used instead of RethinkDB. Did this work already out of the box ?
Is there any way we could help to support other databases ?


Regards
Yannick Heinrich

Aeneas Rekkas

unread,
Jun 28, 2016, 4:02:54 PM6/28/16
to ory-...@googlegroups.com

Hey,

thanks for your intrest! yes, other databases can be supported, but adapters have to be implemented for it. all storages are interfaces and can easily be replaced. currently, in memory and rethinkdb are supported / implemented. if you need assistance let me know.

before you go ahead and start hacking, i suggest to check out the demo and play around with the CLI and HTTP api. if you encounter bugs, ask here, in gitter or on github! this is right now the best way you can help and you will learn to use hydra and see if it really fits your needs!

if it's possible, i recommend to stick with the rethinkdb backend. rethinkdb was chosen because it supports pub/sub. this allows hydra to keep all data in memory and make it super fast and reliable. every request to your api will be authorized using hydra, so it's important to keep it fast :) with traditional polling based databases, this is not possible without using caches.

right now, hydra is in a state of bugfixing and preparing a stable release. if you decide to stick with mongodb, it might be good to wait for some fixes to land, so you have less work!

best

--
You received this message because you are subscribed to the Google Groups "ory-hydra" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ory-hydra+...@googlegroups.com.
To post to this group, send email to ory-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ory-hydra/fcc3bd7c-2e67-45d8-af4c-4a55a72a493e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jan Olszak

unread,
Jun 29, 2016, 5:01:27 AM6/29/16
to ory-hydra
Well I still think MongoDB storage backend would be awesome. 

@Yanninc: If you decide to write a mongodb backend you have my sword. 

Yannick Heinrich

unread,
Jun 29, 2016, 7:54:31 AM6/29/16
to Jan Olszak, ory-hydra
If I could help I would be glad. But are you sure everything is implemented as interface ?

I did a quick search within the sources of hydra where this string is present "gopkg.in/dancannon/gorethink.v2" and it seems that some elements do not have an equivalent as an interface or am I wrong ?


Regards
Yannick

--
You received this message because you are subscribed to a topic in the Google Groups "ory-hydra" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ory-hydra/9a6l8iQGak4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ory-hydra+...@googlegroups.com.

To post to this group, send email to ory-...@googlegroups.com.

Aeneas Rekkas

unread,
Jun 29, 2016, 7:58:27 AM6/29/16
to ory-...@googlegroups.com

gorethink is the concrete adapter for connecting to rethinkdb. the abstraction is in hydra, e.g. here:

https://github.com/ory-am/hydra/blob/master/client/manager.go

usually all storage interfaces are called manager.go

You received this message because you are subscribed to the Google Groups "ory-hydra" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ory-hydra+...@googlegroups.com.

To post to this group, send email to ory-...@googlegroups.com.

Yannick Heinrich

unread,
Jun 29, 2016, 9:44:10 AM6/29/16
to Aeneas Rekkas, ory-hydra
My bad ... One last question why do we need to perform some operation of the manager within a mutex lock ?



Aeneas Rekkas

unread,
Jun 29, 2016, 11:37:44 AM6/29/16
to Yannick Heinrich, ory-hydra

if you keep data in memory you need a mutex lock, because http handlers (who access the manager) are called in parallel

https://gobyexample.com/mutexes

Yannick Heinrich

unread,
Jul 1, 2016, 2:09:16 AM7/1/16
to Aeneas Rekkas, ory-hydra
I understand that. I meaned, the purpose is to read a value from the database right ? 

Is it mandatory to keep a value in memory as well ?

Aeneas Rekkas

unread,
Jul 1, 2016, 3:13:08 AM7/1/16
to Yannick Heinrich, ory-hydra

If you don't keep data in memory, you don't need a mutex :)

No it's not mandatory, but it saves network roundtrips and reduces latency significantly. depending on your use case, this might be important. keep in mind that hydra might get hit often, for example when validating access tokens.

Reply all
Reply to author
Forward
0 new messages