Implementing multitenancy in KeystoneJS

懵懂的女人 提交于 2019-12-12 05:25:30

问题


How can KeystoneJS be used to implement multi-tenancy? Is it possible at all?

Example use case: A company is creating a new blog platform using KeystoneJS and it wants to allow for multiple blog sites using the same models from one KeystoneJS instance but each blogger should only be able to control their own site.


回答1:


Keystonejs does not really support this. Something that you could do, however, is to use something like Docker with an image of the Keystonejs website, then add some configuration to give each instance a different db path.




回答2:


Or Spring up multiple Node Servers, something like this:

// Keystone 1
process.env.PORT=3000
// Keystone 2
process.env.PORT=3001
// ...

and Spring up one MongoDB server, and assign a unique database name to each node server / keystone instance, like

// Keystone 1: .env
MONGO_URI=mongodb://localhost:27017/KT_1
// Keystone 2: .env
MONGO_URI=mongodb://localhost:27017/KT_2

More info, check out Connection String URI Format[mongodb]

I like only use docker to spring up a MongoDB server and run Keystone locally since Docker works quite tricky with node.js.



来源:https://stackoverflow.com/questions/44634647/implementing-multitenancy-in-keystonejs

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!