Tokaido uses Unison for synchronising files between your local and Tokaido environments.

If you’re familiar with rsync, you can consider Unison as a bi-directional rsync utility.

Syncing Environments using Background Sync

Inside your Tokaido environment, a Unison service runs inside a Docker container. It awaits connections from your local system to transfer changed files to and from your Tokaido environment.

By default on Mac and Linux, Tokaido provisions a background sync service that maintains this transfer process on any running Tokaido environment (that is, an environment you have run tok up against). On Mac, this sync service is provided by launchd, and on Linux by systemd.

Repairing Sync

Although it is rare, sometimes the background sync process can fail. The quickest way to resolve this is to run tok up on your project again. Each time tok up is run, it regenerates and restarts the background sync process, so this will most often solve the problem.

If you do encounter issues with sync, we would be grateful if you could contact us and provide us with debug output by running tok up -d

Manual Sync

On Windows or other sytems where a background sync process is not available, you can use two commands to sync your environment using Unison. This process is otherwise known as ‘foreground sync’.

When you run tok sync, Unison will perform a one-time sync of any changed files.

When you run tok watch, Unison will perform an ongoing sync in the foreground. On Windows, this is the recommended behavior: to keep tok watch running in a separate window whenever you are working on your Drupal site.

Disabling Automated Sync

You can disable the automatic creation of the background sync service with the createsyncservice: false config setting. If you do this, you can manually sync with the tok sync command, or start your own (foreground) sync process with tok watch. This command will re-sync whenever changes are detected in your filesystem.