Created
January 5, 2016 21:51
-
-
Save jcooklin/0158e2c8e4d0a7077a62 to your computer and use it in GitHub Desktop.
starts a snap tribe, loads plugins and starts a task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
typeset -i num | |
num=6 | |
echo "starting seed" | |
$SNAP_PATH/bin/snapd --tribe --tribe-port 6000 --tribe-addr 127.0.0.1 --tribe-node-name seed --api-port 8181 -l 1 -t 0 --enable-instrumentation 2>&1 > /tmp/p-seed.out & | |
echo "starting $num snap agents" | |
for ((i=1;i<num;i++)) | |
do | |
sleep .1 | |
$SNAP_PATH/bin/snapd --tribe --tribe-port $((6000+${i})) --tribe-addr 127.0.0.1 --api-port $((8181+${i})) -l 1 --tribe-seed "127.0.0.1:6000" --tribe-node-name member-$i -t 0 --enable-instrumentation 2>&1 > /tmp/p-${i}.out & | |
done | |
#echo "waiting 2 seconds for everything to spin up" | |
#sleep 2 | |
echo "add agreement" | |
curl -d '{"name": "asdf"}' http://127.0.0.1:8181/v1/tribe/agreements | |
echo "agents join agreement" | |
curl -X PUT -d '{"member_name": "seed"}' http://127.0.0.1:8181/v1/tribe/agreements/asdf/join | |
for ((i=1;i<num;i++)) | |
do | |
curl -X PUT -d "{\"member_name\": \"member-$i\"}" http://127.0.0.1:8181/v1/tribe/agreements/asdf/join | |
done | |
#sleep 3 | |
echo "Loading mock1" | |
$SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-collector-mock1 | |
echo "Loading passthru" | |
$SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-processor-passthru | |
echo "Loading file publisher" | |
$SNAP_PATH/bin/snapctl plugin load $SNAP_PATH/plugin/snap-publisher-file | |
echo "Load task" | |
$SNAP_PATH/bin/snapctl task create -t $SNAP_PATH/../examples/tasks/mock-file.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment