magento2-dockergento icon indicating copy to clipboard operation
magento2-dockergento copied to clipboard

Add mutagen support

Open arendarenko opened this issue 5 years ago • 6 comments

Description

These changes is related to #64

Working with dockergento on Mac is really challenging because you always need to run sync manually when modifying something on the host.

Using mutagen.io tool developers who use Mac can eliminate this step and be more focused on coding.

This PR adds mutagen support without breaking "unison-way" sync.

How to test

  • Install homebrew: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  • Install mutagen: brew install havoc-io/mutagen/mutagen
  • Setup dockergento project and add USE_MUTAGEN_SYNC="1" to properties file
  • Start dockergento & enjoy coding without worrying about files sync

Other notes

  • In order to check Mutagen sync status you can run: mutagen sync list

arendarenko avatar Mar 28 '20 21:03 arendarenko

this need to be added:

  • check if mutagen is installed during creating project - add it to the properties file to use by default.

arendarenko avatar Apr 30 '20 12:04 arendarenko

@ihor-sviziev I agree with @danielozano . The purpose of this tool was always to keep it as simple as possible without needing to install anything but docker.

I do not doubt that mutagen might improve it but in that case it should be optional. You could create a pull request to update the docs instead. Add a new section with the couple of steps needed for mutagen for those who want to use it. I think that would be the best for now. What do you think?

jalogut avatar Jul 04 '20 15:07 jalogut

I checked the PR again and noticed that a lot of changes are needed, so this could be difficult to explain in the docs. I noticed that you use the param USE_MUTAGEN which is great. To approve this PR, you should update the setup command to give the user the option to use mutagen or not during the setup. If yes is selected, then the parameter should be set automatically to 1 and the docker-compose.yml for mac can be changed accordingly. Do you know how to implement that?

jalogut avatar Jul 04 '20 17:07 jalogut

Hi @ihor-sviziev, @danielozano, @jalogut. Thanks for your comments.

Tbh I don't see any reason to use unison any further since mutagen is working in background and you don't need to enable/disable sync manually anymore. But I'm agree with @jalogut that for backward compatibility sake we need to have both: unison and mutagen tools support for mac, so I will update this PR and let you know.

arendarenko avatar Jul 05 '20 07:07 arendarenko

Yes, for that I think the simplest would be to add a check on the watch command. If USE_MUTAGEN is enabled, just return a comment like "this command is not needed with mutagen" and stop the execution. That way the unison container is no started.

jalogut avatar Jul 05 '20 08:07 jalogut

How about this https://docs.docker.com/docker-for-mac/mutagen-caching/? I have already tried edge and it works fine.

gallyamov avatar Jul 06 '20 08:07 gallyamov