Hi, in the architecture of Ory, can we have a cent...
# ory-selfhosting
b
Hi, in the architecture of Ory, can we have a central database for all component (kratos, keto, hydra and oauth)?
b
It is possible but generally better to have separate databases for each of time to maintain data integrity.
b
So, you mean a database to each component which mean 4 databases to maintain?
b
Yes it is better to do so. I now have a combined database for kratos and hydra and already regretting it πŸ˜…
b
This add a very huge worklaod for maintenance, operation and HA. One of my client setup oauth and hydra on the same mysql database and it work fine, so for me kratos and keto could use the same database as well
b
Upto you. Like I said, I am doing the same and regretting my choice. Hope you don't regret your choice πŸ™
b
thanks for sharing
e
we would recommend running a separate db object for each application, but all of them can run inside 1 database instance
b
Thanks a lot for your feedback !!!
does all module have its own database/schema running on the host or they can share the same database/schema?
e
they have their own schemas πŸ™‚
b
When I try to do schema migrations on a database that is shared between Kratos and Hydra, I get an error that the Network table can’t be migrated. @enough-yak-81379
Kratos v1.0.0 and Hydra v2.1.2
e
database that is shared
can you elaborate?
b
The database instance is the same
Both Kratos and Hydra share the same DSN
e
uhm, then they are running in the same db object? That would be a bad practice imho, i d suggest running them like here https://github.com/ory/k8s/blob/master/hacks/values/postgres.yaml where you have separate db objects inside a single postgres instance
b
Ah ok that makes sense. I was getting confused between instances and objects
Thanks for the clarification!
e
yeah, sorry! Not a db expert so might have chosen poor wording πŸ˜…
b
Not at all! Your explanation was on point. Thank you for the link and clarification
b
The instance is the main process running database software (postgres, mysql or mariadb) on the host, the database is created within the instance and can be shared by one or more application (eg. kratos-db, keto-db or common-db), the objects (tables, index...) are items within a specific database (eg. kratos-db) and their own schema/attribute.
πŸ‘ 1
b
Yea once instance can have different objects and each object can have its own tables
So as long as Kratos, Hydra are on different database objects, it should be fine