Skip to content

Mutagen

Derschatta edited this page Aug 31, 2023 · 9 revisions

To speed up filesystem performance on MacOS you can use a two-way-sync tool called Mutagen

It runs in the background and keeps syncing your files onto a volume inside your docker containers. It's pretty performant and the delay is minimal even if you change a lot of files at once.

To install mutagen on Mac OS you have two options:

  1. Use Docker Desktop extension (recommended)
  2. Standalone installation

Docker Desktop extension (recommended)

The latest version of Docker Desktop supports extensions. There is an official Mutagen extension which makes using mutagen with the containers very easy.

Instructions:

  1. Set up the docker dev as usual (using the regular mounts)
  2. Install the extension from the marketplace
  3. Create a new cache (choose same folder as LOCAL_SRC of your .env file)
  4. When creating the cache just choose the default ownership settings
  5. Set the context by running this CLI command: docker context use desktop-linux-mutagen
  6. Wait until the cache is fully setup
  7. Start the docker containers with tup as usual
  8. The cache should now be in use

For more details check out the Mutagen extension documentation: https://mutagen.io/documentation/docker-desktop-extension

Standalone (deprecated)

This method instals mutagen as a service (daemon) and uses our own implementation of what the extension offers.

To install either use homebrew (see below), or alternatively download the appropriate release file.

Note that this is deprecated and will be removed in a future version.

brew install havoc-io/mutagen/mutagen

Make sure you have at least version 0.10.0 runnning.

To have mutagen automatically start up with your machine

mutagen daemon register

Then start the daemon. This is a background process without the sync does not work. If you have registered the daemon with the command above you won't need to do this every time.

mutagen daemon start

To activate the use of mutagen, your .env file, set the USE_MUTAGEN variable to:

USE_MUTAGEN=1

If you then use the commands tup and tdown (see the Usage page), then the correct sync session is automatically created for you.

Monitoring

To find out if your sync is working you can use the following command:

mutagen sync list

which shows something like:

⇒  mutagen sync list
--------------------------------------------------------------------------------
Name: totara
Identifier: ddc06807-2554-47f4-ba8a-230f37c5e577
Labels: None
Alpha:
	URL: /your/local/path/to/totara/src
	Connection state: Connected
Beta:
	URL: docker://totara_sync/var/www/totara/src
		DOCKER_HOST=
		DOCKER_TLS_VERIFY=
		DOCKER_CERT_PATH=
	Connection state: Connected
Status: Watching for changes
--------------------------------------------------------------------------------

You can use the session id or any part of the paths to monitor the session, for example:

mutagen sync monitor totara
Clone this wiki locally