In our Magento 2 development environment, we use separate frontend and backend servers for testing purposes. Everything Magento-related works fine in general, but I occasionally run into issues during deployment.
Most of the tasks are handled using phpdeployer: https://github.com/deployphp/deployer, and our general process looks like this:
• Code style checks
• Creating an artifact with Deployer, including some tests
• Deploying the artifact to both frontend and backend servers
Here’s where things get tricky:
Depending on the code changes we push, certain actions need to run on the servers. The most frequent issue happens when the pipeline tries to run bin/magento setup:db:upgrade. Since our deployment steps run in parallel, this command sometimes fails—presumably because it’s being executed simultaneously on both servers.
So my main question is:
Is there a flaw in the way we’ve set this up? Or should we restrict certain commands (like DB upgrade) to run only on a specific server, so they don’t conflict or run in parallel?
If anyone has experience with a similar split front-/backend setup, I’d really appreciate your input or suggestions.
Thanks in advance!