This section provides a Mutagen orchestration workflow demonstration using the Mutagen codebase itself.


If you wish to run the example command in this section, you’ll need Mutagen v0.10.0+ and Docker® Compose installed. You’ll also need a Docker daemon to run the containers.

Configuration files

An example mutagen.yml file can be found in the Mutagen repository, along with a corresponding Docker Compose configuration and underlying Dockerfile.

To grab a copy of these files, you can simply git clone the repository:

git clone https://github.com/mutagen-io/mutagen.git

Starting the project

To start the Mutagen development environment, you can switch to the Mutagen repository root and do:

# Start Docker Compose services
docker-compose up --build --force-recreate --detach
# Start Mutagen project sessions
mutagen project start

This starts up a Linux®-based development container and initializes a synchronization session that pushes code into the container and forwards godoc HTTP traffic into the container. Changes you make to the code in the repository will be reflected inside the container.

Using the container

To work interactively inside the development container, you can start shells with:

docker-compose exec development /bin/sh

Once inside the container, you can build the Mutagen codebase:

go run scripts/build.go

Or run tests:

go test -p 1 ./pkg/...

Monitoring and managing sessions

Outside of the container, you can use the mutagen project list command to monitor sessions, and the mutagen project flush, mutagen project pause, and mutagen project resume commands to manage sessions.

Shutting down the project

Once you’re done using the development container, you can terminate Mutagen sessions and the container itself using the following commands:

# Terminate Mutagen project sessions
mutagen project terminate
# Terminate Docker Compose services
docker-compose down --rmi=all

Next steps

Once you have that workflow set up, you can even move the entire development infrastructure off of your laptop using the DOCKER_HOST environment variable when invoking docker-compose up, mutagen project start, and docker-compose down (Mutagen will lock in DOCKER_HOST and other Docker environment variables and doesn’t need them re-specified for each command).