File Synchronization on Mac
To work with an IDE like phpstorm or eclipse on your host system you need to sync your code into the container. The integrated file sharing solution from docker cannot be used because of very bad performance.
To have a good performance we need to sync the files from the host system into the container.
For the two way file-synchronization we use the great tool Unison.
Setup Unison on Mac
To work with Unison it's very important to have the right versions installed.
Please follow the instructions step by step.
Step 1: Download and Install Unision
Download and install Unision by Drag'n Drop into Application folder
Step 2: Install Unison command-line tool
Click on "Yes" to install the Unison command-line tool
Step 3: Open terminal and install xcode, pip and macfsevents which are needed for unison-fsmonitor
xcode-select --install sudo easy_install pip sudo pip install macfsevents sudo pip install watchdog
Step 4: Install unison-fsmonitor binary
sudo curl https://db5iu3k4j1efi.cloudfront.net/unison-fsmonitor-IKzJ1fQDsA. > /usr/local/bin/unison-fsmonitor && chmod 775 /usr/local/bin/unison-fsmonitor
Step 5: Create a sync.sh file for each project you want to sync
In our example we want to sync the files from our host system into the container from
For this we create the file:
with the following content:
#!/bin/bash #rm -rf /Users/$(whoami)/Library/Application\ Support/Unison/* unison -repeat watch /Users/stefan/PhpstormProjects/magento2.dev/ ssh://firstname.lastname@example.org//home/cloudpanel/htdocs/magento2.dev/ -ui text
Make sure the sync.sh file is executeable.
To make it executeable just run: chmod 775 sync.sh
Step 6: Start file-synchronisation
To start the file synchronisation execute the sync.sh file
Enter the password "root" to start the file-synchronization
If you see the error message "Fatal error: inconsistent state. The archive file is missing on some hosts" please do the following:
1) Delete unison archives on host system with the following command
rm -rf /Users/$(whoami)/Library/Application\ Support/Unison/*
2) Delete unison archive in container
ssh email@example.com rm -rf /root/.unison
3) Start sync process again