So, I have a chaincode application based on the fabcar sample from fabric-samples. Yesterday, I was able to bring it up and run the initLedger function, but found issues with my chaincode when running further invocations. However, when i brought the network back up after debugging (which turned out to be a nightmare in Go), I can no longer get the InitLedger to execute, it just gives me the following error:
Error: endorsement failure during invoke. response: status:500 message:"error in simulation: failed to execute transaction f2589dd7849c01064d5ed827867085d02615ac4fe4d5edcaed31b1a7d5635c94: could not launch chaincode
fakenews_1.0:230eafea48b912ae8f96bfc79bea3b02b4538992547e9de284f80c66a1f52550: error starting container: error starting container: API error (400): OCI runtime create failed: container_linux.go:349: starting container process caused \"exec: \\\"chaincode\\\": executable file not found in $PATH\": unknown"
As far as I can tell, this is due to an issue with docker, but I can't really figure out how to solve it in my case. Has anyone ran into this before?
For extra information, the main difference between the fabcar chaincode and mine is that I am reading from a JSON file and mapping that to a list of objects which are then put on my blockchain. At least that's what I'm trying to do, because the one time I managed to run the InitLedger, my QueryAll invocation came up empty.
Check the chaincode path. I think your chaincode path is wrong.
Lets say you are mapping chaincode directory like below in compose file.
volumes:
../chaincode:/opt/gopath/src/github.com/chaincode
then export CC_SRC_PATH=/opt/gopath/src/github.com/chaincode
use above path when executing invoke command. You can add -p ${CC_SRC_PATH}.
peer chaincode install -n mycc -v ${VERSION} -l ${LANGUAGE} -p ${CC_SRC_PATH} >&log.txt
NOTE: I'm assuming that you are running all these command inside cli container
Related
a. Run the below export command in terminal:
export DOCKER_CONTENT_TRUST=1
b. Run :
docker-compose up --build -d
FAILURE:
ERRO[0000] Can't close tar writer: io: read/write on closed pipe
error during connect: Post http://%2Fvar%2Frun%2Fdocker.sock/v1.41/build?buildargs=%7B%22EIS_VERSION%22%3A%222.4%22%2C%22GO_VERSION%22%3A%221.12%22%2C%22HOST_TIME_ZONE%22%3A%22Asia%2FKolkata%22%2C%22HTTPS_PROXY%22%3A%22http%3A%2F%2Fproxy-xyz.com%3A911%22%2C%22HTTP_PROXY%22%3A%22http%3A%2F%2Fproxy-xyz.com%3A911%22%2C%22NO_PROXY%22%3A%22127.0.0.1%2Clocalhost%22%2C%22UBUNTU_IMAGE_VERSION%22%3A%2218.04%22%2C%22http_proxy%22%3A%22http%3A%2F%2Fproxy-xyz.com%3A911%22%2C%22https_proxy%22%3A%22http%3A%2F%2Fproxy-xyz.com%3A911%22%2C%22no_proxy%22%3A%22127.0.0.1%2Clocalhost%22%7D&cachefrom=%5B%5D&cgroupparent=&cpuperiod=0&cpuquota=0&cpusetcpus=&cpusetmems=&cpushares=0&dockerfile=dockerfiles%2FDockerfile.eisbase&labels=%7B%7D&memory=0&memswap=0&networkmode=default&rm=1&shmsize=0&t=ia_eisbase%3A2.4&target=&ulimits=null&version=1: invalid reference format
Sending build context to Docker daemon 12.55kB
I think DOCKER_CONTENT_TRUST locks some file wrt docker which causes this error.
docker-compose does not have any support for image signing or image signature verification.
— https://github.com/sse-secure-systems/trusted-compose
You need to implement a wrapper for docker-compose or use an existing one in order to work with content trust and docker-compose.
I don't use personnaly trusted-compose but it looks like as a good solution: https://github.com/sse-secure-systems/trusted-compose.
Additional resources:
Bringing Content Trust into the World of docker-compose (medium.com)
Docker Compose not using trusted content during pull (https://github.com/docker/compose)
I'm trying to run pishrink on MacOS using a Docker host, as explained here. The pishrink script shrinks the size of an .img so it's quicker to burn onto an SD card.
I have Docker Desktop running, and I've add the repo to the top-level in my file system (/pishrink) and and running the following command:
docker-compose run pishrink /pishrink/pishrink.sh /pishrink/big-image.img /pishrink/small-image.img
When I do, I get the following error:
Error response from daemon: OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/pishrink/pishrink.sh\": permission denied": unknown
Can someone help me debug this issue? I'm relatively new to using Docker so I might be making some simple + fundamental mistakes.
I was able to fix this with the following command, using sudo as suggested:
sudo docker-compose run pishrink /pishrink/pishrink.sh /pishrink/big-image.img /pishrink/small-image.img
I am testing a a business network I created, I ran the Composer-rest-server and all worked fine, then shut the server as suggested in the developers guide , then I proceeded use the yo hyperledger composer to create the skeleton of the angular app, however, now the angular app is showing in the local browser, however, the composer-rest- server is not.
Expected Behavior:
I should start the composer-rest- server in localhost:3000 and the angular app as well
Actual Behavior:
I get this message;
scovering types from business network definition ...
Connection fails: Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
It will be retried for the next request.
Exception: Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
Error: Error trying to ping. Error: Error trying to query chaincode. Error: Connect Failed
at _checkRuntimeVersions.then.catch (/home/node/.nvm/versions/node/v6.11.2/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:696:34)
Your Environment
composer-cli#0.11.3
generator-hyperledger-composer#0.11.3
composer-rest-server#0.11.3
Docker version 17.06.0-ce, build 02c1d87
docker-compose version 1.13.0, build 1719ceb
The Problem
If you kill your fabric instance using ./stopFabric that you started using the ./startFabric command then all the containers that were apart of the business network were killed as well and therefore you need to reinstall the .bna and start the network again. (the development flow provided is purposely volatile for rapid development)
The Solution
1.) Type docker ps to see all of your running containers. You should see none if you are getting that error because your peer is not responding to pings
2.) Open a separate terminal and navigate to where you have fabric-dev-servers in the terminal and run ./fabricStart. This will start all the containers like your network Certificate Authority, the peer, the orderer, etc.
3.) Return to your project in another terminal. Do Step 1 & 2 found at the developer tutorial (you likely won't need to do step 3 since you likely already imported the network administrator identity going through the tutorial)
4.) Run composer network ping --card admin#tutorial-network. The ping should go through.
5.) Run docker ps. You should see 4 containers running
6.) Run composer-rest-server and follow the steps from the tutorial.
7.) Run cd tutorial-network-app to switch to where your angular application is (or wherever you generated it with the yo command)
8.) Navigate to http://localhost:3000 and everything should work.
Any other questions or problems just reply here and I can help.
The expected behaviour is that the REST server is already running (the the generator uses Loopback to spin up a REST server already (that's why you shut down the previous REST server)). Its described here https://hyperledger.github.io/composer/unstable/tutorials/developer-guide.html under 'Generate your Skeleton Web Application'.
After you created the application - following completion of the yo hyperledger-composer questions (and after providing the answers) you run your application using npm start from within the generated application directory. Your app is accessible at http://localhost:4200.
I am trying to install my custom chain code in my local Hyperledger Fabric v1.0 environment.
For this I have followed the documentation build your first network and I am using first network sample with in the github project. No it is up and running with ./byfn.sh -m up and executing all the scripts for channel creating, chain code installation and instantiation and all by running script.sh file.
Now I have changed the following to tryout my custom chaincode
peer chaincode install -n mycc -v 1.0 -p github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02>&log.txt
this I have changed to
peer chaincode install -n mycc -v 1.0 -p github.com/myuserId/fabrcicV1_chaincodes/mychaincode >&log.txt
Now by running ./byfn.sh -m up getting the exception
2017-08-22 11:01:17.048 UTC [msp] GetDefaultSigningIdentity -> DEBU 002 Obtaining default signing identity
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 003 Using default escc
2017-08-22 11:01:17.048 UTC [chaincodeCmd] checkChaincodeCmdParams -> INFO 004 Using default vscc
Error: Error getting chaincode code chaincode: path to chaincode does not exist: github.com/myuserId/fabrcicV1_chaincodes/mychaincode
Usage:
peer chaincode install [flags]
Flags:
-c, --ctor string Constructor message for the chaincode in JSON format (default "{}")
-l, --lang string Language the chaincode is written in (default "golang")
-n, --name string Name of the chaincode
-p, --path string Path to chaincode
-v, --version string Version of the chaincode specified in install/instantiate/upgrade commands
Global Flags:
--cafile string Path to file containing PEM-encoded trusted certificate(s) for the ordering endpoi
--logging-level string Default logging level and overrides, see core.yaml for full syntax
-o, --orderer string Ordering service endpoint
--test.coverprofile string Done (default "coverage.cov")
--tls Use TLS when communicating with the orderer endpoint
!!!!!!!!!!!!!!! Chaincode installation on remote peer PEER0 has Failed !!!!!!!!!!!!!!!!
========= ERROR !!! FAILED to execute End-2-End Scenario ===========
I have the repository there in github, then why it is not showing does not exit?
I have cloned the same to Windows 7 machine under the path $GOPATH/src/github.com/ and given local path, then also I am getting the same error. I am running all the commands through docker quick start terminal for windows 7.
Please suggest where I am doing wrong.
Also in some of the network log I have found a location /opt/gopath/src/github.com/.... and where it is pointing to. In my windows path gopath is /c/users/public/fabricv1.
Since I am not much familiar with the tool, please comment on this also.
After doing some analysis from my side, it seems like the chain code
is reading from some pre-mounted directories sacc/, fabcar/, /marble02
, chaincode_example_02, hyperledger/ under the path
root#7785f8b27559:/opt/gopath/src/chaincodedev/chaincode# and
chaincode also pre-loaded at the time of making the network up
using docker image. There it seems no effect by adding chaincode in
windows folder and it is from the above said virtual machine path.
So what can I do now to continue my work? is there any way to install
my custom chaincode to the local network. I tried with my githhub path
and local path but no use. please somebody help :(
It seems that you do not have your chaincode in the $GOPATH, you need to run:
go get github.com/myuserId/fabrcicV1_chaincodes/mychaincode
Before trying to install the chaincode on peer, in your case where you are using build your first network, you need to make sure your new chaincode inside fabric-samples/chaincode folder. And also note that you need to mount folder with your chaincode into docker cli container, see example of current docker-compose-cli.yaml file:
volumes:
- /var/run/:/host/var/run/
- ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
- ./crypto-config:/opt/gopath/src/github.com/hyperledger/fabric/peer/crypto/
- ./scripts:/opt/gopath/src/github.com/hyperledger/fabric/peer/scripts/
- ./channel-artifacts:/opt/gopath/src/github.com/hyperledger/fabric/peer/channel-artifacts
In particular, you probably need to replace here with your chaincode or make sure to mount an additional folder within $GOPATH of cli container:
- ./../chaincode/:/opt/gopath/src/github.com/hyperledger/fabric/examples/chaincode/go
I am trying to resolve very basic issue with Quick Start guide of Spring XD. But have already spent more than an hour.
I am following guide at http://projects.spring.io/spring-xd/#quick-start
But when I try create stream using following
**stream create --definition "time | log" --name ticktock --deploy**
It does not find standard module "log".
**Command failed org.springframework.xd.rest.client.impl.SpringXDException: Could not find module with name 'log' and type 'sink'**
I tried changing XD_HOME values to
/Users/sudhir/MyPrograms/spring-xd-1.2.0.RELEASE
/Users/sudhir/MyPrograms/spring-xd-1.2.0.RELEASE/spring-xd/xd
/Users/sudhir/MyPrograms/spring-xd-1.2.0.RELEASE/spring-xd
Tried to run xd-singlenode and xd-shell from XD_HOME using complete path.
Well, in any case you should just be able to cd into
$INSTALLDIRECTORY/spring-xd-1.2.0.RELEASE/xd/bin and then run ./xd-singlenode.
cd $INSTALLDIRECTORY/spring-xd-1.2.0.RELEASE/xd/bin
./xd-singlenode
Once you singlenode container is up and running start up xd-shell through $INSTALLDIRECTORY/spring-xd-1.2.0.RELEASE/shell/bin/xd-shell
./xd-shell
And you should at least be able to get tictoc up and running. The ENV stuff is probably just your own environment.