Comments (12)
I mean each time you want to re-start fabric network , clean both container and new-generated-images first, like
docker ps
2f20f7a46ef9 dev-peer1.org2.example.com-mycc-1.0 "chaincode -peer.addr" Less than a second ago Up 8 seconds dev-peer1.org2.example.com-mycc-1.0
dbbfb49276a2 dev-peer1.org1.example.com-mycc-1.0 "chaincode -peer.addr" Less than a second ago Up 27 seconds dev-peer1.org1.example.com-mycc-1.0
f34b05b3b38b dev-peer0.org2.example.com-mycc-1.0 "chaincode -peer.addr" Less than a second ago Up About a minute
and new-generated-images
docker images
dev-peer1.org2.example.com-mycc-1.0 latest ffa42829b2ef Less than a second ago 172.9 MB
dev-peer1.org1.example.com-mycc-1.0 latest 4bd694f8f60a Less than a second ago 172.9 MB
dev-peer0.org2.example.com-mycc-1.0 latest 1710aae8e3d8 Less than a second ago 172.9 MB
and delete them all
echo "clean containers...."
docker rm -f `docker ps -aq`
echo "clean images ..."
docker rmi -f `docker images|grep mycc-1.0|awk '{print $3}'`
from docker-compose-files.
According to your problem description and my understanding, I can provide a way.
You can add a volumes at service cli
in docker-compose-2orgs-4peers.yaml
.
like this:
"""
volumes:
#- ./e2e_cli/examples:/opt/gopath/src/github.com/hyperledger/fabric/examples
"""
Putting your changed chaincode in ./e2e_cli/examples
.
Hope can help you.
from docker-compose-files.
Thanks for the response, I have already tried it without success.
More specifically, I have placed my chaincode inside e2e_cli/examples/chaincode/go/chaincode_example02/chaincode_example02.go
file. I have uncommented the line you suggested, and then I ran the initialize.sh
script. However it seems that the default chaincode is still installed.
What should be the path (-p
) value in the peer chaincode install
command? I have it set to the default github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
.
from docker-compose-files.
@thanosgn it would be helpful if you could post the detailed steps to repeat.
cannot guess out what happens...
from docker-compose-files.
- Edit the
e2e_cli/examples/chaincode/go/chaincode_example02/chaincode_example02.go
and place custom chaincode. (e.g. change the invoke function) - Copy
e2e_cli/examples/chaincode/go/chaincode_example02/chaincode_example02.go
file in all 6 containers (fabric-cli, peer1.org2.example.com, peer0.org1.example.com, peer1.org1.example.com, peer0.org2.example.com, orderer.example.com) usingdocker cp
command. The file is placed in/go/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02
directory. - Edit
docker-compose-2orgs-4peers.yaml
and uncomment line 61, as suggested above. - Run
docker-compose -f docker-compose-2orgs-4peers.yaml up -d
(I have previously removed all docker containers). - Enter the
fabric-cli
container - Run
scripts/initialize.sh
script - Call the
invoke
function or anything else that tests your chaincode. E.g. you could runscripts/test_4peers.sh
After doing theese steps, I cannot execute my own chaincode, but I keep getting the results from the "default" chaincode that was initially in /go/src/github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02/chaincode_example02.go
from docker-compose-files.
@thanosgn I just test with following steps, just like yours
- Add some test label in chaincode_example02.go, such as change Println.
- Uncomment line 61
then I get the output look like:
"""
ex02 Init======test whether is replaced or still default chaincode =====================================================
Aval = 100, Bval = 200
ex02 Invoke======test whether is replaced or still default chaincode =====================================================
Query Response:{"Name":"a","Amount":"100"}
"""
Obviously using the changed one.
from docker-compose-files.
Have you followed the seven steps that I suggested? If not, can you please provide a step by step execution? I frankly could not manage to execute my chaincode whatever I tried.
from docker-compose-files.
OK, this is my steps and whether it meets your test requirements?
- Change something in "https://github.com/yeasy/docker-compose-files/blob/master/hyperledger/1.0/e2e_cli/examples/chaincode/go/chaincode_example02/chaincode_example02.go"
- change
invoke
toinvoke_test
- change
fmt.Println("ex02 Init")
tofmt.Println("ex02 Init===has been changed===")
changefmt.Println("ex02 Invoke")
tofmt.Println("ex02 Invoke===has been changed to Invoke_test====")
-
Uncomment line 61 in "https://github.com/yeasy/docker-compose-files/blob/master/hyperledger/1.0/docker-compose-2orgs-4peers.yaml"
-
Change
invoke
toinvoke_test
at line 93,95 in test_4.sh, such as{"Args":["invoke_test","a","b","10"]}'
-
docker-compose -f docker-compose-2orgs-4peers.yaml up
-
in container execute
bash ./scripts/initailize.sh
andbash ./scripts/test_4.sh
-
then check the log at new generated container:
$ docker logs 819a5679e94b
ex02 Init===has been changed===
Aval = 100, Bval = 200
ex02 Invoke===has been changed to Invoke_test====
Query Response:{"Name":"a","Amount":"100"}
$ docker logs af1c137ccb26
ex02 Invoke===has been changed to Invoke_test====
Query Response:{"Name":"a","Amount":"90"}
ex02 Invoke===has been changed to Invoke_test====
Aval = 80, Bval = 220
ex02 Invoke===has been changed to Invoke_test====
Query Response:{"Name":"a","Amount":"80"}
$ docker logs af1c137ccb26
ex02 Invoke===has been changed to Invoke_test====
Query Response:{"Name":"a","Amount":"90"}
ex02 Invoke===has been changed to Invoke_test====
Aval = 80, Bval = 220
ex02 Invoke===has been changed to Invoke_test====
Query Response:{"Name":"a","Amount":"80"}
from docker-compose-files.
I followed your steps exactly but made no difference. The only step that differed was 4, where I ran sudo docker-compose -f docker-compose-2orgs-4peers-event.yaml up -d
instead of sudo docker-compose -f docker-compose-2orgs-4peers-event.yaml up
. For some reason I get a lot of errors without the -d
parameter.
My output was the following:
sudo docker logs 510753bb903c
ex02 Invoke
Query Response:{"Name":"a","Amount":"90"}
ex02 Invoke
Aval = 80, Bval = 220
ex02 Invoke
Query Response:{"Name":"a","Amount":"80"}
sudo docker logs 431b719bf66d
ex02 Invoke
Aval = 90, Bval = 210
sudo docker logs c34605c0dc80
ex02 Init
Aval = 100, Bval = 200
ex02 Invoke
Query Response:{"Name":"a","Amount":"100"}
from docker-compose-files.
The version of docker doesn't matter, Check whether rmi
new-generate images like dev-peer0.org2.example.com-mycc-1.0
from docker-compose-files.
@qiang0723 Thanks for your help! Can you please explain the last comment a bit more? I could not understand what you suggested.
from docker-compose-files.
Thank you! The solution was to remove the newly generated images as well as the containers, as you suggested.
from docker-compose-files.
Related Issues (20)
- error in scripts/download_images.sh
- Does the block explorer not work with mysql 8.0.4? HOT 5
- Error: got unexpected status: BAD_REQUEST -- HOT 2
- v1.1.0 rc1 chaincode instantiate失败 API error (404): {"message":"network v110rc1_default not found"} HOT 4
- <channel-ID.block> file disappears after restarting the network HOT 2
- Error: Got unexpected status: BAD_REQUEST HOT 1
- error: [Orderer.js]: sendBroadcast - timed out after:250000 [2018-06-04 12:43:17.982] [ERROR] Create-Channel - Error: REQUEST_TIMEOUT
- How to use fabric v1.2 ca-test with mutual tls HOT 1
- make test_cc_install sometimes fails with v1.2 - need to rerun it few times to succeed HOT 2
- hyperledger rpc端口问题 HOT 1
- 请教chaincode接口调用产生transaction的问题 HOT 1
- [channel: mychannel1] Rejecting broadcast of config message from 172.26.0.11:35706 because of error: error validating channel creation transaction for new channel 'mychannel1', could not succesfully apply update to template configuration: error authorizing update: error validating ReadSet: existing config does not contain element for [Group] /Channel/Application/Org2MSP but was in the read set HOT 4
- orderer.genesis.block: is a directory
- Can't make orderer-docker
- 1.4版本好多报错:Error response from daemon: manifest for hyperledger/fabric-nodeenv:1.4.6 not found: manifest unknown: manifest unknown HOT 1
- Error response from daemon: manifest for hyperledger/fabric-ca:2.0.0 not found: manifest unknown: manifest unknown HOT 1
- ERRO 029 Error creating connection to peer address vp0:7051: grpc: timed out when dialing
- haproxy_web这个默认的用户名和密码是什么? HOT 1
- chatWithPeer -> ERRO 029 Error creating connection to peer address vp0:7051: grpc: timed out when dialing HOT 5
- where is the docker-compose-1orgs-1peers-dev.yaml
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-compose-files.