I'm working on a project to mange multiple Gameservers at the same time.
Basically each gameserver has its own database and the user can switch between dropdown menu between the servers. The amount of gameservers is unknown, so it can be 1 or 20
Now the "real" issue - the database connections since all of them use the same schemas, but ofcourse every db has different content.
For requests I would be able to check the requested Server (which is part of the url for shareability) either in a Service Provider or Middleware, but for backend jobs (using the queue system) i can't really do that because every model is meant to be bound to one connection.
Also a deciding factor for me is that the database servers are kind of slow - they lack performance so i want to keep the amount of Database interactions as low as possible
Possible Methods (which I'm not happy with alltogether)
a) Save all possible gameservers in one main database - then on every quest check the values from session, url and database which connection to use and run \Config::set()
That solution works somehow, but does not really offer a way to deal with Background Jobs/Schedules
b) Simply make an application for each gameserver! and the applications database gets shared
This would work perfectly fine, but extremly hinders User experience - especially because I want to be able to show some statistics on the dashboard which would become more and more of a hassle, especially because ACID becomes more and more of a problem the more applications are running.
c) Add the connection to each Database interaction in the code
Again: How to figure out in schedules and jobs - also the code somewhat would look ugly with that.
d) Simply create a model for each Server for each Table
No, just no - thats an insane amount of duplicated code which becomes nearly impossible to maintain at some point
e) Run a SPA and let some smart ass api handling do the rest by implementing a api for each server
This also would be a solution - but unfortunatly I'm not that good with vue/react and I don't have the time to learn it that in-depth for that project
Has anyone ever encountered this issue and has come up with a practical solution to fix this?
For me it looks like the most practical solution would be the last solution using an spa with multiple apis - but is that really the only way?