File Sync example
This example uses a middleware mix to push changes from a master directory tree to one or more slave directories.
Middleware mix (click to view, right-click to save):
Video of this example (4 minutes):
git clone https://opensparkl/examplesto clone this repo
- The master and slave agents use the sse_cli
master.pyagent uses the watchdog utility which must be installed first.
- Change to the
Examples/FileSyncdirectory and save it as $PKG_DIR
cd Examples/FileSync export PKG_DIR=`pwd`
- Connect and login to an OpenSPARKL node
sparkl connect http://localhost:8000 sparkl login admin@localhost
- Upload the middleware mix to, say, the Scratch folder
sparkl put FileSync.xml Scratch
- Create an empty master directory and slave directory
- Go into the master directory, then start the master agent in it
sparkl service -p $PKG_DIR Scratch/FileSync/Master master
- Go into the slave directory, then start the slave agent in it
sparkl service -p $PKG_DIR Scratch/FileSync/Slave slave
Now go ahead and make changes to the master directory, see them propagated to the slave.