Skip to content

Commit

Permalink
fix(example): fix README and add script to cleanup app data after test
Browse files Browse the repository at this point in the history
Signed-off-by: Konstantin Rybalko <konstantin.rybalko@gmail.com>
  • Loading branch information
rybalko authored and takeutak committed Jun 6, 2021
1 parent a34d432 commit b07bde4
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
15 changes: 7 additions & 8 deletions examples/electricity-trade/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ Before you begin, you need to check that you have all the prerequisites installe
8f50d8fbe985 hyperledger/sawtooth-validator:nightly "bash -c 'sawadm key…" 4 hours ago Up 4 hours 0.0.0.0:4004->4004/tcp sawtooth-validator-default
b519eb5ed1cd ethereum/client-go:v1.8.27 "geth --rpc --networ…" 4 hours ago Up 4 hours 8546/tcp, 0.0.0.0:8545->8545/tcp, 30303/tcp, 30303/udp geth1
```
1. Build validators, packages, and the cartrade app:
1. Build validators, packages, and the electricity trade app:
```
./script-build-all.sh
```
1. Start validators and the cartrade app
1. Start validators and the electricity trade app
- Please open three consoles and execute the following:.
- Start the validator for Sawtooth on the first console using the port 5140:
```
Expand All @@ -57,7 +57,7 @@ Before you begin, you need to check that you have all the prerequisites installe
```
./script-start-validator-ethereum.sh
```
- Start the cartrade app on the third console using the port 5034:
- Start the electricity trade app on the third console using the port 5034:
```
./script-start-electricity-trade.sh
```
Expand Down Expand Up @@ -131,10 +131,9 @@ Before you begin, you need to check that you have all the prerequisites installe
- The result: `{"status":200,"amount":24}`
- (The result shows that the asset was transferred between Ethereum addresses depending on the value of the change in Sawtooth intkey.)

## How to stop the application and Docker containers
## How to stop the application and cleanup Docker containers

1. Stop the above validators (`./script-start-validator-ethereum.sh` and `./script-start-validator-sawtooth.sh`) and the cartrade app (`./script-start-electricity-trade.sh`).
1. Stop the above validators (`./script-start-validator-ethereum.sh` and `./script-start-validator-sawtooth.sh`) and the electricity trade app (`./script-start-electricity-trade.sh`).
- Press Ctrl+C on the above three consoles.
1. Stop the docker containers of Ethereum and Fabric
- Press the command `docker stop <CONTAINER ID>` to stop the container corresponding to the above containers which were launched by `./script-start-ledgers.sh` on the boot method. If you want to destroy the docker containers, press the command `docker rm <CONTAINER ID>` after the above.
- If any other docker containers are not running on your machine, you can destroy the Docker containers only with `docker ps -aq | xargs docker stop` and `docker ps -aq | xargs docker rm`.
1. Cleanup the docker containers of Ethereum and Fabric
- Run `./cleanup.sh`
23 changes: 23 additions & 0 deletions examples/electricity-trade/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
docker stop sawtooth-shell-default
docker stop sawtooth-settings-tp-default
docker stop sawtooth-xo-tp-python-default
docker stop sawtooth-devmode-engine-rust-default
docker stop sawtooth-rest-api-default
docker stop sawtooth-intkey-tp-python-default
docker stop sawtooth-validator-default
docker stop geth1

docker rm sawtooth-shell-default
docker rm sawtooth-settings-tp-default
docker rm sawtooth-xo-tp-python-default
docker rm sawtooth-devmode-engine-rust-default
docker rm sawtooth-rest-api-default
docker rm sawtooth-intkey-tp-python-default
docker rm sawtooth-validator-default
docker rm geth1

sudo rm -R ../../tools/docker/geth-testnet/data-geth1/geth
sudo rm ../../tools/docker/geth-testnet/data-geth1/geth.ipc*
sudo rm -R node_modules
sudo rm -R ../../packages/ledger-plugin/go-ethereum/validator/src/node_modules
sudo rm -R ../../packages/ledger-plugin/sawtooth/validator/src/node_modules

0 comments on commit b07bde4

Please sign in to comment.