moodlehq / moodle-docker

A docker environment for moodle developers
GNU General Public License v3.0
376 stars 245 forks source link

Use NFS for Mac users #183

Closed odeialba closed 1 year ago

odeialba commented 2 years ago

Docker is very slow for mac users (mainly when installing the db from scratch or setting up behat and phpunit and running them). To fix that, we are able to use NFS. This PR uses NFS for Mac users instead of the old :cached.

Source: https://vivait.co.uk/labs/docker-for-mac-performance-using-nfs

crazyserver commented 2 years ago

This is working very well for me, can we get that integrated?

stronk7 commented 2 years ago

Hi @odeialba ,

nice improvement, if it really helps the mac experience.

I've not been able to review it with detail... but wanted to share something that, IMO, is a requirement for new code like this to land.

And it's that we must guarantee backwards compatibility 100%, making new stuff completely optional.

So, if I'm using here moodle-docker via scripts (or in some CI/pipeline) it MUST continue working without modifications (or will break badly everywhere). And I'm not sure that this PR supports that (it seems that the new nfs stuff is called unconditionally).

I'd suggest some optional env var, well documented in order to "activate and use" the nfs thing. Guaranteeing that, if that option isn't enabled... old behaviour is 100% the same.

Surely the bash script can be set with execution perms in git (like the rest of shell scripts are) and we don't need to perform the manual chmod.

Also... it must be clear if that script needs to be executed only once or always and, maybe, there should be a way to move aways from nfs (back to normal) too.

Ciao :-)

mouneyrac commented 1 year ago

The current Mac performance solution is to enable both the experimental settings (virtualisation and VirtioFS) in the preferences of Docker Desktop.

Docker Desktop Preference Settings

See https://www.docker.com/blog/speed-boost-achievement-unlocked-on-docker-desktop-4-6-for-mac/

skodak commented 1 year ago

I find the performance on M2 mac satisfactory if "new virtualisation framework" and "VirtioFS" enabled from experimental settings.

crazyserver commented 1 year ago

Thanks @mouneyrac and @skodak , I also think this issue can be closed.

stronk7 commented 1 year ago

Thanks all!