Repository navigation
Use named volumes for MySQL volume - #340
Conversation
|
Did some install time metrics on a vanilla d8 installation. I did three passes:
It looks to be very consistent for me, at least. Tested on a macbook pro with a 2.5 GHz I7 and 16 gigs of ram. My docker-for-mac settings allocate 4 CPUs and 2.0 GB of ram. |
|
This approach seems to work well from my testing, and we don't incur any performance penalties going this route, which is preferable even if the penalty was determined to be negligible. I don't think I have any objections taking this approach, but we do need to figure out how data will be destroyed if desired. With the host mounted approach, we could potentially just instruct users to delete the directory to destroy. With volumes, we likely need a flag of some sort on the remove command, though I would have found one useful for the host-mounted approach as well. |
|
Based on initial feedback from @tannerjfco and @rickmanelius it feels like there is some momentum for this direction. As such, I've updated the PR to include the following items:
|
rickmanelius
left a comment
There was a problem hiding this comment.
Regarding your question of whether we should remove settings.php. There was a PR merged last week while you were out that adds a string to the settings.php to denote whether or not ddev manages it or not. If we're managing it (along with wp-config.php for WordPress), we should remove because it would be regenerated when running ddev import-db.
|
Other than my one requested change, I think the updated flag and helper text looks good. |
…destructive remove
|
I have added the requested functionality to this PR to remove ddev-generated settings files on remove. |
|
Noting that I'm beginning a test. |
Binary Setup
➜ ~ ddev version App Setup
Scenario TestsHere are the 4 things to test.
See #308 for details on removing settings.php and wp-config.php Test 1
Test 2
NOTES
|
rickmanelius
left a comment
There was a problem hiding this comment.
As per a conversation in Slack. The issues surrounding the generation and management of settings.php OR wp-config.php are not regressions but rather a misunderstanding on my part about the use cases when/where we consider this "managed". To that end, this functionality works as expected and I'd rather open a follow-up ticket to hash through that user flow rather than block this working functionality.
|
@beeradb Given that Tanner reviewed your previous work and that I already reviewed some of Tanner's additions, any objection to merging? |
* [named-volumes] Use named volumes for mysql so data persists * [named-volumes] Clean up tests and remove -y flag from ddev remove * [named-volumes] remove -y from cleanup * [named-volumes] remove AskForConfirmation * [named-volumes] Add volume check during removal * [named-volumes] Add removeData flag to remove data during site removal * [named-volumes] Add GetVolumes() util function * [named-volumes] update app.Down usage in local platform tests * [named-volumes] update docs * [named-volumes] add comment to exported function * configure site settings path on config read, remove site settings on destructive remove
The Problem:
This is an alternative approach to #337 which uses named volumes instead of host mounted directories.
It allows MySQL data to persist even when a site is removed using
ddev rm, but rather than host mounting the files, it uses the native docker volume functionality, https://docs.docker.com/compose/compose-file/#volume-configuration-reference. Personally, I think it will be easier to maintain in the long run if we just rely on what docker is giving us. That being said, I can also understand the potential UX benefits of exposing the volume as a directory.I mostly put this together to prove to myself it would work as I expected and from there the changes were small enough that it made sense to just open a PR to compare the approaches.
The Test:
you should also be able to change MySQL container versions without any data loss.
If we stick with this method, it might make sense to expand the
ddev rmcommand to have an option for cleaning up the volume as well, in case users really want to start completely from scratchAutomation Overview:
I removed the previous tests around the
-yflag, as ddev rm is no longer a destructive operation.Related Issue Link(s):
#208 #337