Automatically start and stop mutagen syncs when starting and stopping a Lando project.
One of the main issues in having your development environment fully Dockerized on Windows and Mac is performance. Jumping the filesystem boundary (e.g. Mac FS -> Linux container FS or vice versa) causes performance to tank dramatically.
Luckily, Lando provides us with a nice performance feature where directories defined in excludes
get one-way synced from the host to Docker named volumes. These Docker named volumes are then mounted at the appropriate locations in the containers. This solves the 'jumping-filesystem-boundary' performance issue.
A drawback of this is once files are in the named volumes, any changes to them do not get synced back to the host. This is problematic when developing, where your IDE needs the package folders (e.g. vendor
or node_modules
) for proper intellisense.
This is where this plugin comes in. Add a base Mutagen configuration file to your project, add some excludes
in your Lando file and the plugin will do the following:
- On
lando start
, create an amended mutagen configuration file with the appropriate directory syncs - After
lando start
, start up the mutagen syncs, such that modified files in theexcludes
directories will be synced back to the host - On
lando stop
, stop the mutagen syncs - After
lando stop
, remove the temporary amended mutagen configuration file
- Have an existing Lando project containing a
.lando.yml
file - Add an excludes configuration section to it. E.g.
excludes: - var - vendor
- Add a
.lando.mutagen.yml
file, which contains your base mutagen configuration. Example contents (enough to get started):sync: defaults: flushOnCreate: true ignore: vcs: false permissions: defaultFileMode: 644 defaultDirectoryMode: 755
- Add
*.mutagen.yml.*
to your gitingore. - Run
lando rebuild -y
. This might take some time due to the file syncs. - Profit! File changes in the
excludes
directories will now be synced back to the host and you can enjoy close-to linux-native Docker filesystem performance.