I’ve done quite a bit of digging into this and I can’t seem to find a complete answer/solution. How can I have a single (or cluster of) Meteor apps connect to a database dynamically based on the current subdomain?
Due to the nature of our app (education) each customer needs to have their own separate database. One reason for this, is that our school customers need to have their data hosted in a specific country for security/compliance reasons. So a simple multi-tenant solution won’t work here.
My current set up is to have each customer running their own instance of the app, with the MONGO_URL set via environment variable. (They also each have an individual settings.json file for their instance). This is becoming costly for us.
My idea setup is to have some nginx instances proxy requests to the Meteor app via subdomain, then have the meteor app sort out the MONGO_URL based on that.
Any idea how I can achieve this?