docksal / unison

Docksal Unison container

Home Page:https://docs.docksal.io/core/volumes/#unison-volumes

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Docksal Unison

Unison container suited for Docksal needs. Continuously syncs files between two directories.

See https://docs.docksal.io/core/volumes/#unison-volumes for more details.

Usage

  1. Add to the docksal.env:

    DOCKSAL_VOLUMES=unison
    
  2. If your project was running before, then remove old containers and volumes with fin project remove

    NOTE: fin project reset will not work here, as it does not remove named volumes

  3. fin project start

Additional environment variables

You do not need to set any additional variables for the container to work, but you can override them if you understand what you are doing.

This container uses values from a handful of environment variables. These are documented below.

  • SYNC_SOURCE (default: /source): The path inside the container which will be used as the source of the file sync. Most of the time, you probably shouldn't change the value of this variable. Instead, just bind-mount your files into the container at /source and call it a day.
  • SYNC_DESTINATION (default: /destination): When files are changed in SYNC_SOURCE, they will be copied over to the equivalent paths in SYNC_DESTINATION. If you are using bg-sync to avoid filesystem slowness, you should set this path to whatever path the volume is at in your application container. In the example above, for instance, this would be /var/www/myapp.
  • SYNC_PREFER (default in image: /source, default in Docksal: newer): Control the conflict strategy to apply when there are conflicts. The "newer" option will pick up the most recent files.
  • SYNC_MAX_INOTIFY_WATCHES (default in image: '', default in Docksal: '524288'): If set, the sync script will attempt to increase the value of fs.inotify.max_user_watches. IMPORTANT: This requires that you run this container as a privileged container. Otherwise, the inotify limit increase will not work. As always, when running a third party container as a privileged container, look through the source thoroughly first to make sure it won't do anything nefarious. sync.sh should be pretty understandable. Go on - read it. I'll wait.
  • SYNC_EXTRA_UNISON_PROFILE_OPTS (default: ''): The value of this variable will be appended to the end of the Unison profile that's automatically generated when this container is started. Ensure that the syntax is valid. If you have more than one option that you want to add, simply make this a multiline string. IMPORTANT: The ability to add extra lines to your Unison profile is supported by the bg-sync project. The results of what might happen because of this configuration is not. Use this option at your own risk.
  • SYNC_NODELETE_SOURCE (default in image: '1', default in Docksal: '0'): Set this variable to "0" to allow Unison to sync deletions to the source directory. This could cause unpredictable behavior with your source files.
  • UNISON_UID (default: '0'): Specify UNISON_UID and UNISON_GID to ensure that unison has the correct permissions to manage files. Note that the UNISION_USER and UNISON_GROUP options were deliberately removed. Specifying UNISON_UID and UNISON_GID will cause SYNC_DESTINATION to have these id's.
  • UNISON_GID (default: '0'): See UNISON_UID.

Credits

About

Docksal Unison container

https://docs.docksal.io/core/volumes/#unison-volumes


Languages

Language:Shell 84.6%Language:Dockerfile 15.4%