Hi.
I'm currently trying to setup a deployment using docker swarm and modx (2.5.2). For this I'm using the modx docker image. My plan would be, to have only one modx mysql instance and several modx instances deployed to different nodes to be able to load balance. In theory this should work out, but I'm currently struggling with the fact, that as soon as a second node is starting up, it tries to setup a new database and fails with "Table prefix is already in use in this database!". This would be fine (since there's already a setup modx DB instance created by the first node), if it wouldn't leave the setup in an uninitalized state. That means especially, that the config.inc.php is empty and invoking modx leads to a failure then, regarding XPDO.
So my question is, what would be the easiest way to accomplish this? I already looked into the installer code where the database is checked first (this is where it dies), and after that the config is created. So it's reasonable that the config.inc.php hasn't been created yet. Would it be as "simple" as moving the config creation part before the database check? So that the setup parameters from the config.xml are already transformed to the config.inc.php and then it exits with "already exists"? But then no cleanup of the setup would be done as well, right? Maybe I could do this manually then. Any hints how to tackle this?
Thanks!
-
MODX Staff
- 10,725 Posts
Just copy the already installed instance to any additional nodes. You don't want to run setup again on the same database.