From 119166ee64ae20e39cf262135a39507f2762a3da Mon Sep 17 00:00:00 2001 From: Paul Sitoh Date: Thu, 2 Jan 2020 13:12:28 +0000 Subject: [PATCH] Script to start and stop local daml-on-sawtooth 1. Add bash script to ensure that daml-on-sawtooth starts cleanly. This is to avoid any stale keys stopping validator from starting. 2. Update README to reflect use of script. Signed-off-by: Paul Sitoh --- README.md | 4 ++-- docker/run.sh | 26 ++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 2 deletions(-) create mode 100755 docker/run.sh diff --git a/README.md b/README.md index 32a3f433..e6f24129 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,9 @@ Please refer to [BUILD.md](./BUILD.md) for further instructions. * Open a terminal and `cd` into the project folder (i.e. location where you git clone the daml-on-sawtooth project) described in step 2. -* To run up a development copy of daml-on-sawtooth, run this command `docker-compose -f ./docker/compose/daml-local.yaml up`. This will start-up single node sawtooth environment, running the devmode consensus and a DAML environment. +* To run up a development copy of daml-on-sawtooth, and at the top level ot the project, run this command `./docker/run.sh stop`. This will start-up single node sawtooth environment, running the devmode consensus and a DAML environment. -* To shutdown the application by running the following command `docker-compose -f ./docker/compose/daml-local.yaml down`. +* To shutdown the application by running the following command `./docker/run.sh stop`. ### 4. Interacting with daml-on-sawtooth using daml navigator diff --git a/docker/run.sh b/docker/run.sh new file mode 100755 index 00000000..8569f604 --- /dev/null +++ b/docker/run.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +COMMAND=$1 + +function start(){ + if [ -d ${PWD}/docker/keys ]; then + rm -rf ${PWD}/docker/keys + fi + docker-compose -f ${PWD}/docker/compose/daml-local.yaml up +} + +function stop(){ + if [ -d ${PWD}/docker/keys ]; then + rm -rf ${PWD}/docker/keys + fi + docker-compose -f ${PWD}/docker/compose/daml-local.yaml down +} + +case "$COMMAND" in + start) + start + ;; + stop) + stop + ;; +esac \ No newline at end of file