Hi,
I've been having issues getting my chaincode instantiated in swarm mode.
I'm running the swarm on one machine for now, and I had to add one parameter in the docker-compose.js file to be able to create the channel to begin with (I'm not sure how it worked for you and others with the configuration as it is now in the repository):
'CORE_PEER_ADDRESSAUTODETECT=true'
Without this flag I kept getting errors looking like this inside peers, when attempting to create the channel:
createChaincodeServer -> ERRO 027 Error creating GRPC server: listen tcp: lookup peer1.BU.Delphi.com on 127.0.0.11:53: no such host
Other than that I haven't made any other changes to the code. All fabric images are 1.1.0-alpha.
I'm trying to run with TLS disabled and with a solo orderer. When trying to execute the testInstall script I get through the installation part but then I'm getting the following when trying to instantiate:
[2018-02-08T16:21:49.544] [DEBUG] install-chaincode - { peers_length: 2,
chaincodeId: 'adminChaincode',
chaincodePath: 'github.com/davidkhala/chaincode/golang/admin',
chaincodeVersion: 'v0' }
info: [packager/Golang.js]: packaging GOLANG from github.com/davidkhala/chaincode/golang/admin
[2018-02-08T16:21:49.598] [INFO] Helper - install was good for [0] { version: 0,
timestamp: null,
response: { status: 200, message: '', payload: <Buffer 4f 4b> },
payload: <Buffer >,
endorsement: null }
[2018-02-08T16:21:49.599] [INFO] Helper - install was good for [1] { version: 0,
timestamp: null,
response: { status: 200, message: '', payload: <Buffer 4f 4b> },
payload: <Buffer >,
endorsement: null }
[2018-02-08T16:21:49.608] [DEBUG] install-chaincode - { peers_length: 1,
chaincodeId: 'adminChaincode',
chaincodePath: 'github.com/davidkhala/chaincode/golang/admin',
chaincodeVersion: 'v0' }
info: [packager/Golang.js]: packaging GOLANG from github.com/davidkhala/chaincode/golang/admin
[2018-02-08T16:21:49.626] [INFO] Helper - install was good for [0] { version: 0,
timestamp: null,
response: { status: 200, message: '', payload: <Buffer 4f 4b> },
payload: <Buffer >,
endorsement: null }
[2018-02-08T16:21:49.634] [DEBUG] install-chaincode - { peers_length: 1,
chaincodeId: 'adminChaincode',
chaincodePath: 'github.com/davidkhala/chaincode/golang/admin',
chaincodeVersion: 'v0' }
info: [packager/Golang.js]: packaging GOLANG from github.com/davidkhala/chaincode/golang/admin
[2018-02-08T16:21:49.653] [INFO] Helper - install was good for [0] { version: 0,
timestamp: null,
response: { status: 200, message: '', payload: <Buffer 4f 4b> },
payload: <Buffer >,
endorsement: null }
[2018-02-08T16:21:49.668] [DEBUG] instantiate-chaincode - { channelName: 'delphichannel',
peersSize: 1,
chaincodeId: 'adminChaincode',
chaincodeVersion: 'v0',
args: [] }
[2018-02-08T16:21:49.699] [INFO] instantiate-chaincode - channel.initialize() success [ { id: 'ENGMSP' }, { id: 'BUMSP' }, { id: 'PMMSP' } ]
error: [Peer.js]: sendProposal - timed out after:45000
error: [client-utils.js]: sendPeersProposal - Promise is rejected: Error: REQUEST_TIMEOUT
at Timeout._onTimeout (/home/exciPlain/delphi-fabric/node_modules/fabric-client/lib/Peer.js:124:19)
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
[2018-02-08T16:22:34.721] [ERROR] Helper - instantiate was bad for [0] Error: REQUEST_TIMEOUT
at Timeout._onTimeout (/home/exciPlain/delphi-fabric/node_modules/fabric-client/lib/Peer.js:124:19)
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5)
[2018-02-08T16:22:34.736] [ERROR] testInstall - { proposalResponses:
[ Error: REQUEST_TIMEOUT
at Timeout._onTimeout (/home/exciPlain/delphi-fabric/node_modules/fabric-client/lib/Peer.js:124:19)
at ontimeout (timers.js:386:11)
at tryOnTimeout (timers.js:250:5)
at Timer.listOnTimeout (timers.js:214:5) ] }
The logs from the failed dev-peer0.BU container:
docker logs dev-peer0.BU.Delphi.com-adminChaincode-v0
2018-02-08 15:22:07.223 UTC [shim] userChaincodeStreamGetter -> ERRO 001 context deadline exceeded
error trying to connect to local peer
github.com/hyperledger/fabric/core/chaincode/shim.userChaincodeStreamGetter
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:111
github.com/hyperledger/fabric/core/chaincode/shim.Start
/opt/gopath/src/github.com/hyperledger/fabric/core/chaincode/shim/chaincode.go:150
main.main
/chaincode/input/src/github.com/davidkhala/chaincode/golang/admin/main.go:74
runtime.main
/opt/go/src/runtime/proc.go:195
runtime.goexit
/opt/go/src/runtime/asm_amd64.s:2337
2018-02-08 15:22:07.223 UTC [admincc] Errorf -> ERRO 002 Error starting Simple chaincode: error trying to connect to local peer: context deadline exceeded
On the peer that the instantiation was attempted in:
2018-02-08 15:21:49.708 UTC [chaincode] launchAndWaitForRegister -> DEBU 3dd chaincode adminChaincode:v0 is being launched
2018-02-08 15:21:49.708 UTC [chaincode] getLaunchConfigs -> DEBU 3de Executable is chaincode
2018-02-08 15:21:49.708 UTC [chaincode] getLaunchConfigs -> DEBU 3df Args [chaincode -peer.address=10.0.0.3:7052]
2018-02-08 15:21:49.708 UTC [chaincode] getLaunchConfigs -> DEBU 3e0 Envs [CORE_CHAINCODE_ID_NAME=adminChaincode:v0 CORE_PEER_TLS_ENABLED=false CORE_CHAINCODE_LOGGING_LEVEL=info CORE_CHAINCODE_LOGGING_SHIM=warning CORE_CHAINCODE_LOGGING_FORMAT=%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}]
2018-02-08 15:21:49.708 UTC [chaincode] getLaunchConfigs -> DEBU 3e1 FilesToUpload []
2018-02-08 15:21:49.708 UTC [chaincode] launch -> DEBU 3e2 start container: adminChaincode:v0(networkid:dev,peerid:peer0.BU.Delphi.com)
2018-02-08 15:21:49.708 UTC [chaincode] launch -> DEBU 3e3 start container with args: chaincode -peer.address=10.0.0.3:7052
2018-02-08 15:21:49.708 UTC [chaincode] launch -> DEBU 3e4 start container with env:
CORE_CHAINCODE_ID_NAME=adminChaincode:v0
CORE_PEER_TLS_ENABLED=false
CORE_CHAINCODE_LOGGING_LEVEL=info
CORE_CHAINCODE_LOGGING_SHIM=warning
CORE_CHAINCODE_LOGGING_FORMAT=%{color}%{time:2006-01-02 15:04:05.000 MST} [%{module}] %{shortfunc} -> %{level:.4s} %{id:03x}%{color:reset} %{message}
2018-02-08 15:21:49.708 UTC [container] lockContainer -> DEBU 3e5 waiting for container(dev-peer0.BU.Delphi.com-adminChaincode-v0) lock
2018-02-08 15:21:49.708 UTC [container] lockContainer -> DEBU 3e6 got container (dev-peer0.BU.Delphi.com-adminChaincode-v0) lock
2018-02-08 15:21:49.708 UTC [dockercontroller] Start -> DEBU 3e7 Cleanup container dev-peer0.BU.Delphi.com-adminChaincode-v0
2018-02-08 15:21:49.708 UTC [dockercontroller] stopInternal -> DEBU 3e8 Stop container dev-peer0.BU.Delphi.com-adminChaincode-v0(No such container: dev-peer0.BU.Delphi.com-adminChaincode-v0)
2018-02-08 15:21:49.709 UTC [dockercontroller] stopInternal -> DEBU 3e9 Kill container dev-peer0.BU.Delphi.com-adminChaincode-v0 (No such container: dev-peer0.BU.Delphi.com-adminChaincode-v0)
2018-02-08 15:21:49.709 UTC [dockercontroller] stopInternal -> DEBU 3ea Remove container dev-peer0.BU.Delphi.com-adminChaincode-v0 (No such container: dev-peer0.BU.Delphi.com-adminChaincode-v0)
2018-02-08 15:21:49.709 UTC [dockercontroller] Start -> DEBU 3eb Start container dev-peer0.BU.Delphi.com-adminChaincode-v0
2018-02-08 15:21:49.710 UTC [dockercontroller] getDockerHostConfig -> DEBU 3ec docker container hostconfig NetworkMode: delphiNetwork
2018-02-08 15:21:49.710 UTC [dockercontroller] createContainer -> DEBU 3ed Create container: dev-peer0.BU.Delphi.com-adminChaincode-v0
2018-02-08 15:21:49.713 UTC [dockercontroller] Start -> DEBU 3ee start-could not find image <dev-peer0.bu.delphi.com-adminchaincode-v0-3ceceeddfa246b144ce61bf31a16bccdf3458c6dfbdc1afe4026bddb1918a125> (container id <dev-peer0.BU.Delphi.com-adminChaincode-v0>), because of <no such image>...attempt to recreate image
2018-02-08 15:21:49.714 UTC [chaincode-platform] generateDockerfile -> DEBU 3ef
FROM hyperledger/fabric-baseos:x86_64-0.4.5
ADD binpackage.tar /usr/local/bin
LABEL org.hyperledger.fabric.chaincode.id.name="adminChaincode" \
org.hyperledger.fabric.chaincode.id.version="v0" \
org.hyperledger.fabric.chaincode.type="GOLANG" \
org.hyperledger.fabric.version="1.1.0-alpha" \
org.hyperledger.fabric.base.version="0.4.5"
ENV CORE_CHAINCODE_BUILDLEVEL=1.1.0-alpha
2018-02-08 15:21:49.715 UTC [golang-platform] GenerateDockerBuild -> INFO 3f0 building chaincode with ldflagsOpt: '-ldflags "-linkmode external -extldflags '-static'"'
2018-02-08 15:21:49.715 UTC [golang-platform] GenerateDockerBuild -> INFO 3f1 building chaincode with tags:
2018-02-08 15:21:49.716 UTC [util] DockerBuild -> DEBU 3f2 Attempting build with image hyperledger/fabric-ccenv:x86_64-1.1.0-alpha
2018-02-08 15:22:02.434 UTC [dockercontroller] deployImage -> DEBU 3f3 Created image: dev-peer0.bu.delphi.com-adminchaincode-v0-3ceceeddfa246b144ce61bf31a16bccdf3458c6dfbdc1afe4026bddb1918a125
2018-02-08 15:22:02.434 UTC [dockercontroller] Start -> DEBU 3f4 start-recreated image successfully
2018-02-08 15:22:02.434 UTC [dockercontroller] createContainer -> DEBU 3f5 Create container: dev-peer0.BU.Delphi.com-adminChaincode-v0
2018-02-08 15:22:02.676 UTC [dockercontroller] createContainer -> DEBU 3f6 Created container: dev-peer0.bu.delphi.com-adminchaincode-v0-3ceceeddfa246b144ce61bf31a16bccdf3458c6dfbdc1afe4026bddb1918a125
2018-02-08 15:22:04.285 UTC [dockercontroller] Start -> DEBU 3f7 Started container dev-peer0.BU.Delphi.com-adminChaincode-v0
2018-02-08 15:22:04.286 UTC [container] unlockContainer -> DEBU 3f8 container lock deleted(dev-peer0.BU.Delphi.com-adminChaincode-v0)
2018-02-08 15:26:49.708 UTC [chaincode] launchAndWaitForRegister -> DEBU 3f9 stopping due to error while launching: timeout expired while starting chaincode adminChaincode:v0(networkid:dev,peerid:peer0.BU.Delphi.com,tx:902d0e6195b50d9ebd276cdb9c10bcd75797d081b01d3f3eac1db1d425d6b74e)
....
2018-02-08 15:26:49.804 UTC [chaincode] Launch -> ERRO 401 launchAndWaitForRegister failed: timeout expired while starting chaincode adminChaincode:v0(networkid:dev,peerid:peer0.BU.Delphi.com,tx:902d0e6195b50d9ebd276cdb9c10bcd75797d081b01d3f3eac1db1d425d6b74e)
Inspecting the dev-peer0 container shows that something is not being set-up properly on the network side:
"Networks": {
"delphiNetwork": {
"IPAMConfig": null,
"Links": null,
"Aliases": [
"111663a89114"
],
"NetworkID": "1d654yawbx3c9hqz199le717e",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
No IP, no MacAddress etc.
Could I have some help on this issue?