Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi Tenancy for existing nodejs applications #3

Open
manjeshpv opened this issue Sep 28, 2019 · 0 comments
Open

Multi Tenancy for existing nodejs applications #3

manjeshpv opened this issue Sep 28, 2019 · 0 comments

Comments

@manjeshpv
Copy link
Collaborator

manjeshpv commented Sep 28, 2019

mailtrain version 1 focussed on building email campaign manager

v2(https://github.com/Mailtrain-org/mailtrain/tree/development) focussed on making multi tenancy,

Is there any way without changing the code of existing nodejs app, we can add multi tenancy to a nodejs/express app already built

Benefits

  • running multiple instances of nodejs consumes more memory and cpu, multi tenancy will load only sequelize multiple times, express and other modules load once
  • automation of migrations will greatly reduces installation costs and people can signup and start using

Current Challenges while setup

  1. DB Creation - we do in manually phpmyadmin, can be easily automated as we using common db to keep track of tenants https://github.com/AnishLushte07/multi-tenant-application/blob/master/sample.env#L7
  2. Migration - we do manually via ssh - need feature Procedure to add tenant dynamically or run migration automatically  #2
  3. Load models: additional api need to developed to add connections on the fly https://github.com/AnishLushte07/multi-tenant-application/blob/master/server/conn/sqldb/dynamicConnection.js#L46

With above 3 steps we can automate setup process,

Expectation is run migration of another existing nodejs application so we can add a add a field sequelizerc in client(tenant) table

sequelizerc: DataTypes.JSON

above field will be updated with

{
"config": "./server/config/sequelize.js",
"migrations-path": "./server/conn/sqldb/tenant-migrations",
"seeders-path": "./server/conn/sqldb/seeders"
}

https://github.com/AnishLushte07/multi-tenant-application/blob/master/server/api/client/client.property.js#L11

NOTE: In other words, if we make a provisioning tool, then it will help developers to focus on domain, Automatic Provisioning tool will automate tenant signup process

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant