Development & testing¶
You do not really need a lot to start developing.
- A local Ruby >= 2.0
git clone https://github.com/eugenmayer/docker-sync cd docker-sync bundle install gem uninstall -a docker-sync
Important: To properly develop, uninstall docker-sync as a gem so it is not used during the runs:
gem uninstall -a docker-sync.
Now you can:
cd example thor sync:start
So you see, what is separated in to binaries in production
docker-sync-stack is bundled under one namespace here, but prefixed.
Check libs folder.
- SyncManager: Main orchestrator to initialise the config, bootstrap ALL sync-endpoint-processes and start/stop those in threads
- SyncProcess: Does orchestrate/a manage ONE sync-endpoint. Selects the strategy on base of the config
- Strategies: See below, specific implementations how to either sync or watch for changes.
- To add a new strategy for sync, copy one of those https://github.com/EugenMayer/docker-sync/tree/master/lib/docker_sync/sync_strategy here as your
- Implement the general commands as they are implemented for rsync/unison - yes we do not have an strategy interface and no abstract class, since its ruby .. and well :)
- Add your strategy here: https://github.com/EugenMayer/docker-sync/blob/master/lib/docker_sync/sync_process.rb#L31
- To add a new strategy for watch, copy one of those https://github.com/EugenMayer/docker-sync/tree/master/lib/docker_sync/watch_strategy here as your
- Implement the general commands as they are implemented for fswatch
- Add your strategy here: https://github.com/EugenMayer/docker-sync/blob/master/lib/docker_sync/sync_process.rb#L46
Automated integration tests¶
bundle install bundle exec rspec --format=documentation
Manual Tests (sync and performance)¶
You can also use the docker-sync-boilerplate.
Pull this repo and then
cd docker-sync/example thor stack:start
Open a new shell and run
cd docker-sync/example echo "NEWVALUE" >> data1/somefile.txt echo "NOTTHEOTHER" >> data2/somefile.txt
Check the docker-compose logs and you see that the files are updated.
Performance write test:
docker exec -i -t fullexample_app time dd if=/dev/zero of=/var/www/test.dat bs=1024 count=100000