New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MCLOUD-5859: Fix for conflicting volumes - #43 #168
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple whitespace fix needed
@@ -105,9 +107,9 @@ public function build(Config $config): Manager | |||
} | |||
|
|||
$manager->setVolumes([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better if the concatenation of the prefix and volumes fit inside the "Manager" object
Thus, you would not need to add a prefix every time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started to work on your comment but I have a few questions, this change introduces 4 if statements inside setVolumes() alone is this fine?, other than this should addService() and update service() present in Manager Class be able to prefix the volumes, or directly prefixing them in DeveloperBulider /ProductionBuilder is enough(Current Approach)?
Example snippet: like this 4cases should be done inside setVolumes()
if(array_key_exists( "magento-db", $volumes))
{
$oldkey= "magento-db";
$keys = array_keys($volumes);
$keys[array_search($oldkey, $keys)] = $this->config->getName().'-'.$oldkey;
$volumes= array_combine($keys, $volumes);
$extConfig["volumes"]=$volumes;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The main idea of my proposal was that prefix concatenation be implemented in the Manager class
After that, in the Manager, we can add a method to get the mounts for a specific service.
Now, in order to expedite the delivery, I suggest for now just updating the branch without rework.
I suppose we should automatically change port. Because port 80 will be occupied in case of few docker projects |
The same for TLS (port 443) |
This ticket only covers conflicting volumes. This will still fix the issue with multiple projects on the same VM, as the volumes being names the same means DATA conflicts if you try to switch projects. I do not think Magento Cloud Docker can support multiple projects running at the same time, without some drastic changes to the containers. This ticket was just to allow multiple projects to not conflict, which they do now. |
Test:
Approved |
Description
https://jira.corp.magento.com/browse/MCLOUD-5859
Currently, the Magento Cloud Docker uses magento-sync volume and other volumes with no prefix for project. This causes collision and conflict when trying to switch projects.
To solve this, it should use a prefix for all volumes, this should probably be from .magento.app.yaml or .magento.docker.yaml and is by default set as follows:name: mymagento
This would then create volumes as mymagento-magento-sync and mymagento-magento-db. This allows projects to set this name and have it generate volumes that can persist.
Fixed Issues (if relevant)
Manual testing scenarios
Contribution checklist
releasenotes
Fixed an issue that can cause volume conflicts when using multiple Docker environments.