================================================
FILE: .idea/modules.xml
================================================
================================================
FILE: .idea/vcs.xml
================================================
================================================
FILE: README.md
================================================
This is a boilerplate for [docker-sync](https://github.com/EugenMayer/docker_sync).
Either as a starting point for your configuration or to try out what docker-sync offers in terms of performance and the toolchain in practical.
If you have any issues, create an issue at [docker-sync](https://github.com/EugenMayer/docker_sync)
**Start with**
1) Install docker-sync, if you did not yet
```
gem install docker-sync
```
There may be other dependencies that you will have to install but the `docker-sync-stack start` command should help with that. Known dependencies for Mac include: unison, macfsevent, fswatch. These are either installed automatically or you may have to `brew install` them.
2) Now get the boilerplate
```
git clone https://github.com/EugenMayer/docker-sync-boilerplate
cd docker-sync-boilerplate
```
3) Now start the sync, first choose the boilerplate either advanced, dynamic-configuration-dotnev, rsync, simplest, unison, unison-ftp-user, or unison-root-user. See [strategies](https://docker-sync.readthedocs.io/en/latest/advanced/sync-strategies.html) to understand the important differences
---
## Examples
For example rsync
```
cd default
docker-sync-stack start
```
This will start the sync, and start your app-stack defined by in the docker-compose file. All in one step
---
If you wonder, how you would keep the docker-compose.yml portable, see splitted-compose (there is an example in the advanced example of this). The changes for docker-sync are incorporated into an overlay-docker-compose file
In this case you do:
```
# To run development and mount your watched volume.
cd advanced
docker-sync-stack start
# Production would run docker-compose without mounting a watched volume.
cd advanced/docker-compose
docker-compose up -d
```
More about this in [the wiki](https://docker-sync.readthedocs.io/en/latest/getting-started/configuration.html?highlight=portable#portable-docker-compose-yml)
---
For example __dynamic-configuration-dotnev__ you will need to __copy__ `.env.dist` to `.env`
```
cd dynamic-configuration-dotnev
cp .env.dist .env
## Change your settings to whatever you want and then run docker-sync.
docker-sync-stack start
```
And after that start things as described above
## Reference
If you want to know, what options you actually have, see the [configuration-reference](https://docker-sync.readthedocs.io/en/latest/getting-started/configuration.html)
================================================
FILE: advanced/app/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: advanced/docker-compose/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the prodicker docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-advanced:
volumes_from:
- container:advanced-sync:nocopy # will be mounted on /var/www
# that the important thing
volumes:
advanced-sync:
external: true
================================================
FILE: advanced/docker-compose/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-advanced:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: advanced/docker-sync.yml
================================================
version: "2"
options:
compose-file-path: './docker-compose/docker-compose.yml'
compose-dev-file-path: './docker-compose/docker-compose-dev.yml'
verbose: true # make the whole sync verbose
syncs:
advanced-sync: #tip: add -sync and you keep consistent names as a convention
src: './app'
sync_host_ip: 'auto'
sync_host_port: 10872
sync_userid: '1001'
watch_args: '-v' # make watching verbose
================================================
FILE: default/app/index.html
================================================
inital, now change app/index.html and see if this will change me
assa
================================================
FILE: default/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-native-osx:
volumes:
- appcode-native-osx-sync:/var/www:nocopy # nocopy is important
# that the important thing
volumes:
appcode-native-osx-sync:
external: true
================================================
FILE: default/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-native-osx:
image: alpine
command: 'watch -n3 cat /var/www/index.html'
================================================
FILE: default/docker-sync.yml
================================================
version: "2"
options:
verbose: true
syncs:
appcode-native-osx-sync: # tip: add -sync and you keep consistent names as a convention
src: './app'
# sync_strategy: 'native_osx' # not needed, this is the default now
sync_excludes: ['ignored_folder', '.ignored_dot_folder']
================================================
FILE: default_monit/app/index.html
================================================
inital, now change app/index.html and see if this will change me
================================================
FILE: default_monit/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-native-osx:
volumes:
- appcode-native-osx-sync:/var/www:nocopy # nocopy is important
# that the important thing
volumes:
appcode-native-osx-sync:
external: true
================================================
FILE: default_monit/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-native-osx:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: default_monit/docker-sync.yml
================================================
version: "2"
options:
verbose: true
syncs:
appcode-native-osx-sync: # tip: add -sync and you keep consistent names as a convention
src: './app'
# sync_strategy: 'native_osx' # not needed, this is the default now
sync_excludes: ['ignored_folder', '.ignored_dot_folder']
monit_enable: true
# increase tolerance of high cpu if regular syncing uses a lot cpu
monit_interval: 10
monit_high_cpu_cycles: 6
================================================
FILE: default_with_user/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-native-osx:
volumes:
- appcode-native-osx-sync:/var/www:nocopy # will be mounted on /var/www
# that the important thing
volumes:
appcode-native-osx-sync:
external: true
================================================
FILE: default_with_user/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-native-osx:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: default_with_user/docker-sync.yml
================================================
version: "2"
options:
verbose: true
syncs:
appcode-native-osx-sync: # tip: add -sync and you keep consistent names as a convention
src: './app'
sync_userid: 33
# sync_strategy: 'native_osx' # not needed, this is the default now
sync_excludes: ['ignored_folder', '.ignored_dot_folder']
================================================
FILE: docker-compose-only/docker-compose-dev.yml
================================================
# This is our development docker-compose file, building on top of the prod one.
# This file adds a synchronisation between ./app and /var/www, that has the same
# performance characteristics as the default native_osxfs scheme defined in
# ../default/.
# This example configuration runs the same docker image as ../default, with the
# same environment. It does not need a docker-sync daemon running on your host
# though, so you can bring up your development environment using
# `docker-compose up -d` without first running `docker-sync start`. If you wish
# to read the logs of the sync process, use `docker-compose logs app-syncer`.
#
# If you have a native_osxfs based docker-sync configuration that you want to
# turn into a docker-compose only configuration, run `docker-sync start` and
# then use `docker inspect -f '{{ .Mounts }}' $container_id` and
# `docker exec $container_id env` to work out the elements needed to create a
# docker-compose based container definition.
version: "2"
services:
app-docker-compose-only:
volumes:
# If you wanted to do this via docker-for-mac's default osxfs mounts, you
# would simply write - ./app:/var/www. In our case, we want to
# improve our filesystem performance, by adding unison as a layer of
# indirection. To do this, we create a named volume (
# 'app-docker-compose-only-sync' by convention, to avoid clashing with
# other named volumes) and then start a second docker container which
# runs unison to sync ./app with app-docker-compose-only-sync.
- app-docker-compose-only-sync:/var/www:nocopy
app-syncer:
image: eugenmayer/unison:2.51.2.1
command: /entrypoint.sh supervisord
volumes:
# This container is configured to sync /host_sync to /app_sync. We bind
# ./app to /host_sync using docker-for-mac's osxfs, and then bind
# /app_sync to our app-docker-compose-only-sync named volume, so that it
# can be used by our `app-docker-compose-only` container, above.
- ./app:/host_sync
- app-docker-compose-only-sync:/app_sync
environment:
# These variables control which directories are synced by unison.
- HOST_VOLUME=/host_sync
- APP_VOLUME=/app_sync
- UNISON_SRC=/host_sync
- UNISON_DEST=/app_sync
- UNISON_DIR=/data
# The -ignore flags correspond to the line
# `sync_excludes: ['ignored_folder', '.ignored_dot_folder']`
# in `../default/docker-sync.yml`. Read the unison manual for details
# of their ignore patterns. All other flags are fine to leave as they are.
- UNISON_ARGS=-ignore='Name ignored_folder' -ignore='Name .ignored_dot_folder' -prefer /host_sync -numericids -auto -batch
- UNISON_WATCH_ARGS=-repeat watch
# A few extra environment variables to make C libraries behave sensibly.
- TZ=Europe/London
- LANG=C.UTF-8
- HOME=/root
# Named volumes must be declared in the `volumes` section, but don't need any
# other configuration.
volumes:
? app-docker-compose-only-sync
================================================
FILE: docker-compose-only/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-docker-compose-only:
image: alpine
command: ["sh", "-c", "while sleep 3; do cat /var/www/index.html; done"]
================================================
FILE: dynamic-configuration-dotnev/app/ignored_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: dynamic-configuration-dotnev/app/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: dynamic-configuration-dotnev/app/some_folder/.ignored_dot_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: dynamic-configuration-dotnev/app/some_folder/ignored_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: dynamic-configuration-dotnev/app/some_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: dynamic-configuration-dotnev/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production
# docker-compose, just mounting the sync image - not redefining anything else
version: "2"
services:
app-unison:
volumes:
- docker-sync:${DESTINATION_PATH}:nocopy # will be mounted on to the value of DESTINATION_PATH
# that the important thing
volumes:
docker-sync:
external:
name: "${SYNC_NAME}-unison-sync"
================================================
FILE: dynamic-configuration-dotnev/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-unison:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: dynamic-configuration-dotnev/docker-sync.yml
================================================
version: "2"
options:
verbose: true
syncs:
#IMPORTANT: ensure this name is unique and does not match your other application container name
${SYNC_NAME}-unison-sync: # tip: add -sync and you keep consistent names as a convention
src: '${APP_PATH}'
sync_excludes: ['ignored_folder', '.ignored_dot_folder']
================================================
FILE: not_default_config_name/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-native-osx:
volumes:
- appcode-native-osx-sync:/var/www:nocopy # will be mounted on /var/www
# that the important thing
volumes:
appcode-native-osx-sync:
external: true
================================================
FILE: not_default_config_name/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-native-osx:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: not_default_config_name/docker-sync-special.yml
================================================
version: "2"
options:
verbose: true
syncs:
appcode-native-osx-sync: # tip: add -sync and you keep consistent names as a convention
src: './app'
# sync_strategy: 'native_osx' # not needed, this is the default now
sync_excludes: ['ignored_folder', '.ignored_dot_folder']
================================================
FILE: rsync/app/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: rsync/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-rsync:
volumes:
- appcode-rsync-sync:/var/www:nocopy # will be mounted on /var/www
# that the important thing
volumes:
appcode-rsync-sync:
external: true
================================================
FILE: rsync/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-rsync:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: rsync/docker-sync.yml
================================================
version: "2"
options:
verbose: true
syncs:
#IMPORTANT: ensure this name is unique and does not match your other application container name
appcode-rsync-sync: #tip: add -sync and you keep consistent names as a convention
src: './app/'
sync_host_ip: 'auto'
sync_host_port: 10872
sync_strategy: 'rsync'
================================================
FILE: simplest/app/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: simplest/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the prodicker docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-simplest:
volumes:
- simplest-sync:/var/www:nocopy # will be mounted on /var/www
# that the important thing
volumes:
simplest-sync:
external: true
================================================
FILE: simplest/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-simplest:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: simplest/docker-sync.yml
================================================
version: "2"
syncs:
#IMPORTANT: ensure this name is unique and does not match your other application container name
simplest-sync: #tip: add -sync and you keep consistent names as a convention
src: './app'
================================================
FILE: unison/app/ignored_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison/app/index.html
================================================
aSome random HTML file hereasdasd
NEW
================================================
FILE: unison/app/some_folder/.ignored_dot_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison/app/some_folder/ignored_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison/app/some_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-unison:
volumes:
- appcode-unison-sync:/var/www:nocopy # will be mounted on /var/www
# that the important thing
volumes:
appcode-unison-sync:
external: true
================================================
FILE: unison/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-unison:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: unison/docker-sync.yml
================================================
version: "2"
options:
verbose: true
max_attempt: 30
syncs:
#IMPORTANT: ensure this name is unique and does not match your other application container name
appcode-unison-sync: # tip: add -sync and you keep consistent names as a convention
src: './app'
sync_strategy: 'unison'
sync_excludes: ['ignored_folder', '.ignored_dot_folder']
================================================
FILE: unison-ftp-user/app/ignored_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-ftp-user/app/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-ftp-user/app/some_folder/.ignored_dot_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-ftp-user/app/some_folder/ignored_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-ftp-user/app/some_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-ftp-user/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-unison:
volumes:
- appcode-unison-sync:/var/www:nocopy # will be mounted on /var/www
# that the important thing
volumes:
appcode-unison-sync:
external: true
================================================
FILE: unison-ftp-user/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-unison:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: unison-ftp-user/docker-sync.yml
================================================
version: "2"
options:
verbose: true
syncs:
#IMPORTANT: ensure this name is unique and does not match your other application container name
appcode-unison-sync: # tip: add -sync and you keep consistent names as a convention
src: './app'
sync_excludes: ['ignored_folder', '.ignored_dot_folder']
# example on how to let the files be owned by uid 22, thats the ftp user
sync_userid: '21'
sync_strategy: 'unison'
================================================
FILE: unison-new-user/app/index.html
================================================
eugen
================================================
FILE: unison-new-user/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-unison:
volumes:
- appcode-unison-sync:/var/www:nocopy # will be mounted on /var/www
# that the important thing
volumes:
appcode-unison-sync:
external: true
================================================
FILE: unison-new-user/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-unison:
image: alpine
container_name: 'your-app'
command: 'watch -n3 cat /var/www/index.html'
================================================
FILE: unison-new-user/docker-sync.yml
================================================
version: "2"
options:
verbose: true
syncs:
#IMPORTANT: ensure this name is unique and does not match your other application container name
appcode-unison-sync: # tip: add -sync and you keep consistent names as a convention
src: './app'
sync_excludes: ['ignored_folder', '.ignored_dot_folder']
# example on how to let the files be owned by uid 22, thats the ftp user
sync_userid: '10002'
sync_strategy: 'unison'
================================================
FILE: unison-root-user/app/ignored_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-root-user/app/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-root-user/app/some_folder/.ignored_dot_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-root-user/app/some_folder/ignored_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-root-user/app/some_folder/index.html
================================================
Some random HTML file hereasdasd
NEW
================================================
FILE: unison-root-user/docker-compose-dev.yml
================================================
# this is our development docker-compose building on top of the production docker-compose, just mounting
# the sync image - not redefining anything else
version: "2"
services:
app-unison:
volumes:
- appcode-unison-sync:/var/www:nocopy # will be mounted on /var/www
# that the important thing
volumes:
appcode-unison-sync:
external: true
================================================
FILE: unison-root-user/docker-compose.yml
================================================
# This is our production compose file - not changed for docker-sync or similar
version: "2"
services:
app-unison:
image: alpine
command: ['watch', '-n3', 'cat /var/www/index.html']
================================================
FILE: unison-root-user/docker-sync.yml
================================================
version: "2"
options:
verbose: true
syncs:
#IMPORTANT: ensure this name is unique and does not match your other application container name
appcode-unison-sync: # tip: add -sync and you keep consistent names as a convention
src: './app'
sync_excludes: ['ignored_folder', '.ignored_dot_folder']
# the files should be own by root in the target cointainer
sync_userid: 0
sync_strategy: 'unison'