I know this subject has been discussed among many in SO but I have a specific issue that I would like to get your opinions on. I apologize in advance since this is exactly not a coding issue.
I am a self learnt developer and I do not have CS degree exposure or any sort. Majority of everything I know is learnt through the web.
I am planning on developing a multi tenant app which uses angular for front end, laravel for backend/api connecting and mysql to store data.
I plan on assigning a unique key for each tenant identified by 2 or 3 letters (to be decided later) which the user will have to type upon login to identify the tenant. Let's call it the tenantId. Also, I am contemplating of using a subdomain and getting the subdomain as the tenant id for seperation. Lets assume for this scenario that I have the tenantId with me.
Also, laravel will have 2 connections defined. Lets say tenantconnection(to hold individual tenant db credentials) and masterconnection.
Masterconnection holds db credentials for a database that holds the tenantkey, db username, db password, db name, mysql server address in one of it's tables.
Upon getting the db credentials from mastertenant, laravel will update the tenantconnection initialised in the database.php file in the config folder.
So every API call, laravel will have to connect to master get credentials for tenantconnection and then call the db.
In your opinion/experience how practical/applicable is this?
Can this pose any latency even if the db server and app server is within the same datacenter?
Is this method of connecting an accepted method of connecting in a multi tenant environment?
Also, on every API call to laravel i plan on sending the tenantid through JWT. I am not really comfortable of saving tenantid on localstorage.
Can localstorage be manipulate by using any tools such as firebug or something similar of that nature?
I thought of using sharing the db and using schemas in the same db,but the app is designed to hold financial data so I thought that separating them would be the best. I have researched the pros and cons and decided that using a seperate db for each tenant is the best.
Your feedback is greatly appreciated. Sorry if posted on the wrong stack site. Sorry about the long read time.
via Ela Buwa