Skip to content

Instantly share code, notes, and snippets.

@ClashTheBunny
Last active December 14, 2015 10:10
Show Gist options
  • Save ClashTheBunny/5070115 to your computer and use it in GitHub Desktop.
Save ClashTheBunny/5070115 to your computer and use it in GitHub Desktop.
Running this script will create any number of tahoe nodes with an introducer on a single computer where tahoe is set up. Run it quickly like this: wget -q -O - https://raw.github.com/gist/5070115/deployTahoeTestGrid.sh | bash
#!/bin/bash
# Run by doing:
# wget -q -O - https://raw.github.com/gist/5070115/deployTahoeTestGrid.sh | bash
####### Change stuff here:
# somewhere with a little bit of space, with tahoe's defaults you need at least 1GB to upload anything:
directoryWithSpace="$HOME/tahoeTest/"
# your path to tahoe, or if tahoe is in your path, just tahoe=tahoe should work, but I'm working on stuff, so I have the git checkout in my home directory:
tahoe=tahoe
#tahoe="$HOME/tahoe-lafs/bin/tahoe"
N=11 # number of nodes, mine goes up to 11
####### You don't need to change anything below, but check for rm -rf statements. Never trust me, because I don't trust me.
[[ -d $directoryWithSpace ]] || mkdir $directoryWithSpace || exit
cd $directoryWithSpace
[[ -d test-introducer ]] || $tahoe create-introducer test-introducer
$tahoe restart test-introducer || exit
sleep 3
#vim $directoryWithSpace/test-introducer/introducer.furl
export introducerFURL=$(cat $directoryWithSpace/test-introducer/introducer.furl)
echo $introducerFURL
[[ -z $introducerFURL ]] && exit
for testNode in $(seq 0 $((N-1)));
do
$tahoe create-node testNode${testNode}
sed -i -e 's#^introducer.furl.*#introducer.furl = '$introducerFURL'\nnode-url = http://127.0.0.1:345'${testNode}'#g' \
-e 's#web.port = tcp:3456:interface=127.0.0.1#web.port = tcp:'$((3450 + testNode))':interface=127.0.0.1#g' \
testNode${testNode}/tahoe.cfg
$tahoe start testNode${testNode}
if [[ $testNode -eq "0" ]]; then
sleep 3
$tahoe webopen --node-url=$(cat $directoryWithSpace/testNode0/node.url)
fi
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment