jorundur
jorundur

Reputation: 670

Implementing multitenancy in KeystoneJS

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.

Upvotes: 2

Views: 1061

Answers (2)

Max Ma
Max Ma

Reputation: 1130

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.

Upvotes: 0

jnes
jnes

Reputation: 1083

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.

Upvotes: 1

Related Questions