-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Commercial Paper to v2.0 Lifecycle #109
Conversation
89a6d18
to
4820b3f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was able to use the new lifecycle commands, but was not able to use the scripts that set the env variables. I have started writing the tutorial using env variables instead. Can switch over if the scripts work. Not that the script also needs to set a path the the config and binary folders in the fabric samples. Otherwise I was getting an order version of the peer binaries.
1ff34a7
to
d39400b
Compare
In the process of updating the tutorial, I am finding that we ask users to go back and forth between a lot of terminals. As part of making it easier on the user, I think we need to move the scripts setting the environment variables to to the I made those changes on my own branch (updated after latest run through): https://github.com/nikhil550/fabric-samples/tree/update-cp-lifecycle/commercial-paper |
commercial-paper/README.md
Outdated
cd fabric-samples/commercial-paper | ||
``` | ||
|
||
This `README.md` file is in the `commercial-paper` directory, the source code for client applications and the contracts ins in the `organization` directory, and some helper scripts are in the `roles` directory. | ||
|
||
## Running the Infrastructure | ||
|
||
In one console window, run the `./roles/network-starter.sh` script; this will start the basic infrastructure and also start monitoring all the docker containers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove "and also start monitoring all the docker containers." since the script no longer does this.
commercial-paper/README.md
Outdated
docker exec cliMagnetoCorp peer chaincode invoke -o orderer.example.com:7050 --channelID mychannel --name papercontract -c '{"Args":["org.papernet.commercialpaper:instantiate"]}' --waitForEvent | ||
Then when you package the contract, use this variation of the command to specify language | ||
``` | ||
peer lifecycle chaincode package cp.tar.gz --lang golang --path /opt/gopath/src/github.com/contract-go --label cp_0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path should be ./contract-go
commercial-paper/README.md
Outdated
|
||
``` | ||
cd fabric-samples/commercial-paper | ||
source <(./roles/magnetocorp.sh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got this to work, but I need to use the command source roles/magnetcorp.sh
instead, and make some changes to the script. I am on mac.
commercial-paper/README.md
Outdated
### Install and Instantiate the contract | ||
``` | ||
cd fabric-samples/commercial-paper | ||
source <(./roles/digibank.sh) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
|
||
echo "Suggest that you change to this dir> cd ${DIR}/organization/magnetocorp/" | ||
env | sort | comm -1 -3 /tmp/env.orig - | sed -E 's/(.*)=(.*)/export \1="\2"/' | ||
rm /tmp/env.orig |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to add this line at the bottom to get this to work.
cd "${DIR}/../commercial-paper"
parsePeerConnectionParameters 1 2 | ||
export PEER_PARMS="${PEER_CONN_PARMS##*( )}" | ||
# set the fabric config path | ||
export FABRIC_CFG_PATH="${DIR}/../config" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed to add the path directory to this script to get it to work
export PATH="${DIR}/../bin:${PWD}:$PATH"
`fabric-samples/commercial-paper/` directory | ||
|
||
`./roles/digibank.sh` | ||
This is running as *Digibank*; | ||
|
||
You can now run the applications to buy and redeem the paper. Change to either the | ||
`commercial-paper/organization/digibank/application` directory or `commercial-paper/organization/digibank/application-java` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would say something about cleaning the network at the bottom
Clean up
When you are finished using the Fabric test network and the commercial paper smart contract and applications, you can use the following command to clean up the network:
./roles/network-clean.sh
# Exit on first error, print all commands. | ||
set -ev | ||
set -o pipefail | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would remove the identity artifacts as well
rm -rf organization/digibank/identity/user/balaji/wallet/*
rm -rf organization/magnetocorp/identity/user/isabella/wallet/*
Yes agree with moving those |
d39400b
to
9b5eea7
Compare
fd33c6e
to
6056e67
Compare
6056e67
to
b5fa697
Compare
@@ -14,16 +14,13 @@ set -o pipefail | |||
# Where am I? | |||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
docker kill cliDigiBank cliMagnetoCorp logspout || true | ||
./teardown.sh || true | ||
./start.sh || _exit "Failed to start Fabric" | ||
cd "${DIR}/../test-network/" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clean the wallets too
rm -rf organization/digibank/identity/user/balaji/wallet/*
rm -rf organization/magnetocorp/identity/user/isabella/wallet/*
set -o pipefail | ||
|
||
# Where am I? | ||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
b5fa697
to
ff32b29
Compare
Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
ff32b29
to
a3a433d
Compare
- move to using the test-network - updating README.md to include commands to use v2.0 lifecylce - update Contracts and Applications to use 2.0 libraries Signed-off-by: Matthew B White <whitemat@uk.ibm.com>
a3a433d
to
237a715
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Corresponding tutorial update: hyperledger/fabric#610 |
@mbwhite When I checkout this PR and run ./network-starter.sh, it fails with: set -o pipefail
# Where am I?
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd
dirname "${BASH_SOURCE[0]}"
export FABRIC_CFG_PATH="${DIR}/../config"
cd "${DIR}/../test-network/"
./network-starter.sh: line 19: cd: /Users/pamaibm.com/fabric-samples/fabric-samples/../test-network/: No such file or directory Nik says this line: needs to be |
JIRA = https://jira.hyperledger.org/browse/FAB-17457