Skip to content

Instantly share code, notes, and snippets.

@zdw
Last active May 5, 2016 19:12
Show Gist options
  • Save zdw/59992f5a2dccd50f5f0bb54482e81267 to your computer and use it in GitHub Desktop.
Save zdw/59992f5a2dccd50f5f0bb54482e81267 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
MS_CERT_PATH="/opt/ms"
MS_URL="http://ms:8080"
ADMIN_EMAIL="syndicate-ms@example.com"
USER_EMAIL="user@example.com"
VOLUME_NAME="test_vol"
VOLUME_DESCRIPTION="This is a test volume"
BLOCKSIZE=4096
echo "## Setup ##"
syndicate --trust_public_key setup $ADMIN_EMAIL $MS_CERT_PATH/admin.pem $MS_URL
echo "## Create User ##"
syndicate create_user email=$USER_EMAIL private_key=auto
echo "## Create Volume ##"
syndicate -u $USER_EMAIL create_volume name=$VOLUME_NAME description="$VOLUME_DESCRIPTION" blocksize=$BLOCKSIZE email=$USER_EMAIL
echo "## Create RG ##"
syndicate -u $USER_EMAIL create_gateway name=${VOLUME_NAME}_rg1 email=$USER_EMAIL volume=$VOLUME_NAME private_key=auto type=RG
echo "## Start RG ##"
syndicate-rg -d2 -f -u $USER_EMAIL -v $VOLUME_NAME -g ${VOLUME_NAME}_rg1 &
echo "## Update RG ##"
syndicate -u $USER_EMAIL update_gateway ${VOLUME_NAME}_rg1 caps=NONE
syndicate -u $USER_EMAIL update_gateway ${VOLUME_NAME}_rg1 port=31112 driver="/usr/lib/python2.7/dist-packages/syndicate/rg/drivers/disk"
echo "## Create UG ##"
syndicate -u $USER_EMAIL create_gateway name=${VOLUME_NAME}_ug1 email=$USER_EMAIL volume=$VOLUME_NAME private_key=auto type=UG
syndicate -u $USER_EMAIL update_gateway ${VOLUME_NAME}_ug1 caps=ALL port=31111
echo "## Put a file ##"
echo "this is a test file" > ~/testfile
syndicate-put -u $USER_EMAIL -v $VOLUME_NAME -g ${VOLUME_NAME}_ug1 ~/testfile /put_testfile
echo "## Cat a file ##"
syndicate-cat -u $USER_EMAIL -v $VOLUME_NAME -g ${VOLUME_NAME}_ug1 /put_testfile
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment