Multiple projects / multi-tenancy
-
Got a support ticket asking how to create multiple projects on Directus - https://docs.directus.io/guides/projects.html . Investigating this, I found that the Directus app will require access to separate databases for each project you want to create. The current Cloudron package only has access to a single database but the package can be modified to support multiple databases.
Is this something generally considered useful? If so, I can make the changes.
-
Wanted to mention that this will be a breaking change. Meaning, I have to create a new app pretty much since there is no easy way to migrate from a single database to multiple database package at this point. Most likely, users have to do some mysql based migration.
-
this is pretty odd design; and wording.
the docs cite multitenancy, fine, but entirely new DB is not it. It's just a new set of DB credentials and namespace, ie isolation (per tenant) in the same DB or separate DBs.
it doesn't make sense to have it single use only.
you can keep two versions, single and multitenant ;-/
since it's a fairly new app, it's a good time to 'fix' it too.
-
@robi right. I initially thought it was something like WP multi-site and you can give it some table prefix per project, but it doesn't work like that. It really wants a separate database.
Agree with you that since it's a fairly new app, we can fix this. But I am not sure what the common case is. Given that their docs have put this straight up, I am inclined to fix it. It's a pretty minor fix.
-
I have to take that back. I am not sure again anymore. It seems the users between projects are totally separate. I thought it was the same because I created them with the same username/password, so I thought there was some sort of shared user management going on, but there isn't. So, it's back to I think it's best not to support multi-tenancy.
I implemented the change itself - https://git.cloudron.io/cloudron/directus-app/-/commit/309a56c72021f82312fc66bb94101c6692ec0b96#691718f47a3089a202609bee65b689fdc9e57855 . But i won't make a new package.
-
@robi Each project (and thus each database) has it's own "system" tables with the prefix
directus_
. There is a directus_users table in each project/database. This means that there really are two separate users. If you change password in one, the other does not change.