Skip to content

Commit 9c39b17

Browse files
committed
[FAB-2803] Update e2e readme to reflect TLS change
https://jira.hyperledger.org/browse/FAB-2803 Updating the documentation for the end-to-end example to reflect the TLS changes, which the automated script exercises. Also, updating other commands in the readme to follow the script. Change-Id: If73345554b6c23efa0af3f4854592a955bc95ebe Signed-off-by: Adnan Choudhury <[email protected]>
1 parent 14055d7 commit 9c39b17

File tree

1 file changed

+47
-47
lines changed

1 file changed

+47
-47
lines changed

examples/e2e_cli/end-to-end.rst

+47-47
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,8 @@ directory.
141141
configtxgen -profile TwoOrgs -outputCreateChannelTx <cfg txn name> -channelID <channel-id>
142142
# example: configtxgen -profile TwoOrgs -outputCreateChannelTx channel.tx -channelID mychannel
143143
144-
Run the end-to-end test
145-
-----------------------
144+
Run the end-to-end test with Docker
145+
-----------------------------------
146146

147147
Make sure you are in the ``/e2e_cli`` directory. Then use docker-compose
148148
to spawn the network entities and drive the tests.
@@ -305,8 +305,8 @@ output from each container:
305305
ex02 Invoke
306306
Query Response:{"Name":"a","Amount":"90"}
307307
308-
Manually create the channel and join peers through CLI
309-
------------------------------------------------------
308+
Run the end-to-end test manually with Docker
309+
--------------------------------------------
310310

311311
From your vagrant environment exit the currently running containers:
312312

@@ -369,15 +369,18 @@ Command syntax
369369

370370
Refer to the create and join commands in the ``script.sh``.
371371

372-
For any of the following commands to work, you need to preface the
373-
commands with the following environment variables.
372+
For the following CLI commands against `peer0` to work, you need to set the
373+
values for four environment variables, given below. Please make sure to override
374+
the values accordingly when calling commands against other peers and the
375+
orderer.
374376

375377
.. code:: bash
376378
377379
# Environment variables for PEER0
378380
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig
379381
CORE_PEER_ADDRESS=peer0:7051
380382
CORE_PEER_LOCALMSPID="Org0MSP"
383+
CORE_PEER_TLS_ROOTCERT_FILE=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig/cacerts/peerOrg0.pem
381384
382385
These environment variables for each peer are defined in the supplied
383386
docker-compose file.
@@ -406,18 +409,20 @@ with a different name.
406409
407410
# the channel.tx and orderer.block are mounted in the crypto/orderer folder within your cli container
408411
# as a result, we pass the full path for the file
409-
peer channel create -o orderer:7050 -c mychannel -f crypto/orderer/channel.tx
412+
peer channel create -o orderer0:7050 -c mychannel -f crypto/orderer/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem
410413
411-
Recall that the environment variables are required for this manual
412-
operation. So the command in its entirety would be:
414+
Since the `channel create` runs against the orderer, we need to override the
415+
four environment variables set before. So the above command in its entirety would be:
413416

414417
.. code:: bash
415418
416-
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig CORE_PEER_ADDRESS=peer0:7051 CORE_PEER_LOCALMSPID="Org0MSP" peer channel create -o orderer:7050 -c mychannel -f crypto/orderer/channel.tx
419+
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig CORE_PEER_LOCALMSPID="OrdererMSP" peer channel create -o orderer0:7050 -c mychannel -f crypto/orderer/channel.tx --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem
420+
417421
418422
**Note**: You will remain in the CLI container for the remainder of
419423
these manual commands. You must also remember to preface all commands
420-
with the corresponding env variables for the targeted peer.
424+
with the corresponding environment variables for targetting a peer other than
425+
`peer0`.
421426

422427
Join channel
423428
^^^^^^^^^^^^
@@ -426,14 +431,12 @@ Join specific peers to the channel
426431

427432
.. code:: bash
428433
434+
# By default, this joins PEER0 only
429435
# the mychannel.block is also mounted in the crypto/orderer directory
430436
peer channel join -b mychannel.block
431437
432-
This command in its entirety would be:
433-
434-
.. code:: bash
435-
436-
CORE_PEER_MSPCONFIGPATH=/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/peer/peer0/localMspConfig CORE_PEER_ADDRESS=peer0:7051 CORE_PEER_LOCALMSPID="Org0MSP" peer channel join -b crypto/orderer/mychannel.block
438+
You can make other peers join the channel as necessary by making appropriate
439+
changes in the four environment variables.
437440

438441
Install chaincode onto a remote peer
439442
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -450,13 +453,12 @@ Instantiate chaincode and define the endorsement policy
450453
Instantiate the chaincode on a peer. This will launch a chaincode
451454
container for the targeted peer and set the endorsement policy for the
452455
chaincode. In this snippet, we define the policy as requiring an
453-
endorsement from one peer node that is a part of Org1. In our scenario,
454-
this is ``PEER2`` or ``PEER3``
456+
endorsement from one peer node that is a part of either `Org0` or `Org1`.
457+
The command is:
455458

456459
.. code:: bash
457460
458-
#
459-
peer chaincode instantiate -o orderer:7050 -C mychannel -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}' -P "AND('Org1MSP.member')"
461+
peer chaincode instantiate -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}' -P "OR ('Org0MSP.member','Org1MSP.member')"
460462
461463
See the `endorsement
462464
policies <http://hyperledger-fabric.readthedocs.io/en/latest/endorsement-policies/>`__
@@ -467,7 +469,7 @@ Invoke chaincode
467469

468470
.. code:: bash
469471
470-
peer chaincode invoke -o orderer:7050 -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'
472+
peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'
471473
472474
**NOTE**: Make sure to wait a few seconds for the operation to complete.
473475

@@ -484,8 +486,8 @@ The result of the above command should be as below:
484486
485487
Query Result: 90
486488
487-
Using the native binaries
488-
-------------------------
489+
Run the end-to-end test using the native binaries
490+
-------------------------------------------------
489491

490492
Open your vagrant environment:
491493

@@ -568,7 +570,7 @@ Ask peer to create a channel with the configuration parameters in
568570

569571
.. code:: bash
570572
571-
peer channel create -o orderer:7050 -c mychannel -f channel.tx
573+
peer channel create -o 127.0.0.1:7050 -c mychannel -f channel.tx
572574
573575
This will return a channel genesis block - ``mychannel.block`` - in your
574576
current directory.
@@ -589,7 +591,7 @@ Install chaincode on the peer:
589591

590592
.. code:: bash
591593
592-
peer chaincode install -o orderer:7050 -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
594+
peer chaincode install -o 127.0.0.1:7050 -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
593595
594596
Make sure the chaincode is in the filesystem:
595597

@@ -606,7 +608,7 @@ Instantiate the chaincode:
606608

607609
.. code:: bash
608610
609-
peer chaincode instantiate -o orderer:7050 -C mychannel -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}'
611+
peer chaincode instantiate -o 127.0.0.1:7050 -C mychannel -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02 -c '{"Args":["init","a", "100", "b","200"]}'
610612
611613
Check your active containers:
612614

@@ -628,7 +630,7 @@ Issue an invoke to move "10" from "a" to "b":
628630

629631
.. code:: bash
630632
631-
peer chaincode invoke -o orderer:7050 -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'
633+
peer chaincode invoke -o 127.0.0.1:7050 -C mychannel -n mycc -c '{"Args":["invoke","a","b","10"]}'
632634
633635
Wait a few seconds for the operation to complete
634636

@@ -640,7 +642,7 @@ Query for the value of "a":
640642
.. code:: bash
641643
642644
# this should return 90
643-
peer chaincode query -o orderer:7050 -C mychannel -n mycc -c '{"Args":["query","a"]}'
645+
peer chaincode query -o 127.0.0.1:7050 -C mychannel -n mycc -c '{"Args":["query","a"]}'
644646
645647
Don't forget to clear ledger folder ``/var/hyperledger/`` after each
646648
run!
@@ -691,29 +693,27 @@ capabilities you will need to use a chaincode that has data modeled as JSON,
691693

692694
Install, instantiate, invoke, and query *marbles02* chaincode by following the
693695
same general steps outlined above for *chaincode_example02* in the **Manually
694-
create the channel and join peers through CLI** section . After the **Join
696+
create the channel and join peers through CLI** section. After the **Join
695697
channel** step, use the following steps to interact with the *marbles02*
696-
chaincode:
698+
chaincode:
697699

698-
- Install and instantiate the chaincode in ``peer0`` (replace ``$ORDERER_IP``
699-
with the IP address of the orderer. One way to find the address is with the
700-
command ``docker inspect orderer | grep \"IPAddress\"``):
700+
- Install and instantiate the chaincode in ``peer0``:
701701

702702
.. code:: bash
703703
704-
peer chaincode install -o $ORDERER_IP:7050 -n marbles -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02
705-
peer chaincode instantiate -o $ORDERER_IP:7050 -C $mychannel -n marbles -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02 -c '{"Args":["init"]}' -P "OR ('Org0MSP.member','Org1MSP.member')"
704+
peer chaincode install -o orderer0:7050 -n marbles -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02
705+
peer chaincode instantiate -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/marbles02 -c '{"Args":["init"]}' -P "OR ('Org0MSP.member','Org1MSP.member')"
706706
707707
- Create some marbles and move them around:
708708

709709
.. code:: bash
710710
711-
peer chaincode invoke -o $ORDERER_IP:7050 -C mychannel -n marbles -c '{"Args":["initMarble","marble1","blue","35","tom"]}'
712-
peer chaincode invoke -o $ORDERER_IP:7050 -C mychannel -n marbles -c '{"Args":["initMarble","marble2","red","50","tom"]}'
713-
peer chaincode invoke -o $ORDERER_IP:7050 -C mychannel -n marbles -c '{"Args":["initMarble","marble3","blue","70","tom"]}'
714-
peer chaincode invoke -o $ORDERER_IP:7050 -C mychannel -n marbles -c '{"Args":["transferMarble","marble2","jerry"]}'
715-
peer chaincode invoke -o $ORDERER_IP:7050 -C mychannel -n marbles -c '{"Args":["transferMarblesBasedOnColor","blue","jerry"]}'
716-
peer chaincode invoke -o $ORDERER_IP:7050 -C mychannel -n marbles -c '{"Args":["delete","marble1"]}'
711+
peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["initMarble","marble1","blue","35","tom"]}'
712+
peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["initMarble","marble2","red","50","tom"]}'
713+
peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["initMarble","marble3","blue","70","tom"]}'
714+
peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["transferMarble","marble2","jerry"]}'
715+
peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["transferMarblesBasedOnColor","blue","jerry"]}'
716+
peer chaincode invoke -o orderer0:7050 --tls $CORE_PEER_TLS_ENABLED --cafile /opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/orderer/localMspConfig/cacerts/ordererOrg0.pem -C mychannel -n marbles -c '{"Args":["delete","marble1"]}'
717717
718718
719719
@@ -723,12 +723,12 @@ chaincode:
723723

724724
For containers running in a vagrant environment:
725725

726-
```http://localhost:15984/_utils```
726+
``http://localhost:15984/_utils``
727727

728728
For non-vagrant environment, use the port address that was mapped in CouchDB
729729
container specification:
730730

731-
```http://localhost:5984/_utils```
731+
``http://localhost:5984/_utils``
732732

733733
You should see a database named ``mychannel`` and the documents
734734
inside it.
@@ -737,7 +737,7 @@ chaincode:
737737

738738
.. code:: bash
739739
740-
peer chaincode query -o $ORDERER_IP:7050 -C mychannel -n marbles -c '{"Args":["readMarble","marble2"]}'
740+
peer chaincode query -C mychannel -n marbles -c '{"Args":["readMarble","marble2"]}'
741741
742742
743743
You should see the details of ``marble2``:
@@ -751,7 +751,7 @@ chaincode:
751751

752752
.. code:: bash
753753
754-
peer chaincode query -o $ORDERER_IP:7050 -C mychannel -n marbles -c '{"Args":["getHistoryForMarble","marble1"]}'
754+
peer chaincode query -C mychannel -n marbles -c '{"Args":["getHistoryForMarble","marble1"]}'
755755
756756
You should see the transactions on ``marble1``:
757757

@@ -765,7 +765,7 @@ chaincode:
765765

766766
.. code:: bash
767767
768-
peer chaincode query -o $ORDERER_IP:7050 -C myc1 -n marbles -c '{"Args":["queryMarblesByOwner","jerry"]}'
768+
peer chaincode query -C mychannel -n marbles -c '{"Args":["queryMarblesByOwner","jerry"]}'
769769
770770
The output should display the two marbles owned by ``jerry``:
771771

@@ -777,7 +777,7 @@ chaincode:
777777

778778
.. code:: bash
779779
780-
peer chaincode query -o $ORDERER_IP:7050 -C myc1 -n marbles -c '{"Args":["queryMarbles","{\"selector\":{\"owner\":\"jerry\"}}"]}'
780+
peer chaincode query -C mychannel -n marbles -c '{"Args":["queryMarbles","{\"selector\":{\"owner\":\"jerry\"}}"]}'
781781
782782
The output should display:
783783

0 commit comments

Comments
 (0)