I do have an app that has multi-tenant architecture and does create a new database via executing shell command calling exec() in PHP code. The thing is that because of such a call, I can’t use multiple docker images for multiple databases. I need a single docker image with mutliple databases. Is that possible?
Righto. The secondary image will allow you to pass the database name and credentials to create for the first database. Then, in a run step, run a SQL script against the database using these credentials to run additional CREATE DATABASE commands.
If you get stuck, show us your config.yml here, in a code-formatting block.
Actually, it did work when I tried to rebuild with SSH connection and sshed manually inside. When adding a run command it did not work saying connection refused.
In your build, you are not waiting for MySQL to accept connections, and I suspect that although the container is started, the database server itself needs more time. However, in SSH, MySQL always has time to get ready. To fix this, add a new run step to wait for the database to spin up - checking the TCP socket is usually enough.
Now I have started setting up the tests for the second project. I did similar yml but swapping projects and added my key to “Checkout keys” and started getting problems that I cant even checkout the project