Hyperledger Fabric Chaincode Deploment - DockerFile missing - dockerfile

I would like to check if the following issue you have encountered while testing examples of asset_management_with_roles
Im running a 4 note Validator Node setup with 1 membersrvc in docker container setup. All setup steps have been followed but still this does not go.
Also I saw in code that a default docker image hyperledger/fabric-baseimage is needed for chaincode - that also I build from src but to no avail.
On deploying the chaincode the console at the "docker-compose up" shows the following message
CURL command to deploy:
curl -XPOST -d '{"jsonrpc": "2.0", "method": "deploy", "params": {"type": 1,"chaincodeID": { "name":"myam1","path": "github.com/hyperledger/fabric/examples/chaincode/go/asset_management_with_roles","language": "GOLANG"}, "ctorMsg": { "args": ["init"] }, "metadata":[97, 115, 115, 105, 103, 110, 101, 114] ,"secureContext": "assigner"} ,"id": 0}' http://192.168.99.100:7050/chaincode
----------- Error Message on Deploy --------------------
vp2_1 | 07:50:51.447 [dockercontroller] deployImage -> ERRO 049 Error
building images: API error (500): {"message":"Cannot locate specified
Dockerfile: Dockerfile"}

I think the rest interface was discontinued in HyperLedger 1.0 so the above command will not work.

The issue was related to different version of file at the container level. Instead of rebuilding from the SRC I downloaded the latest docker container images and all went fine after that

Related

Local stack DynamoDB is not working

I am tring to test my AWS resources locally. I found a very nice docker image which has almost all the serives avaible and same can be used for local testing. One of the services for DynamoDB is not working. This is also for my application.
I google it a lot, but I am not able to find the root cause. As per my docker container logs. Below are the logs.
docker run -it -p 4567-4578:4567-4578 -p 8080:8080 localstack/localstack
2018-07-30T12:49:17:ERROR:localstack.services.generic_proxy: Error forwarding request: expected string or buffer Traceback (most recent call last):
File "/opt/code/localstack/localstack/services/generic_proxy.py", line 181, in forward
path=path, data=data, headers=forward_headers)
File "/opt/code/localstack/localstack/services/dynamodb/dynamodb_listener.py", line 35, in forward_request
TypeError: expected string or buffer
I think you are using wrong port. The answer can be find in localstack's issue list: https://github.com/localstack/localstack/issues/675
The DynamoDB's GUI in localstack is running on port 4564. Run following command, then you are able to access the GUI on localhost:4564/shell
docker run -d -p 4569:4569 -p 4564:4564 localstack/localstack:latest
connection code
const dynamoose = require('dynamoose');
const AWS = require('aws-sdk');
dynamoose.local('http://localhost:4569');
dynamoose.AWS.config.update({
region: 'us-east-1',
});
const Purchase = dynamoose.model('test', {
test: {
type: String,
hashKey: true,
}
}, {
update: true,
});

x509: ECDSA verification failure

I have to install a bna file on fabric . I am following the link https://hyperledger.github.io/composer/tutorials/deploy-to-fabric-single-org.html . However when I run the command: composer runtime install -c PeerAdmin#fabric-network -n tutorial-network
I am getting the error :
Error: Error trying install composer runtime. Error: No valid
responses from any peers.
Response from attempted peer comms was an error:
Error: Failed to deserialize creator identity, err The supplied
identity is not valid, Verify() returned x509: certificate signed by
unknown authority (possibly because of "x509: ECDSA verification
failure" while trying to verify candidate authority certificate
"ca.org1.example.com").
Any help on this please
sounds like you have made an error in following the tutorial (which definitely works). Are you sure the MSP id (Org1MSP) for the peer has been setup correctly ? Have you checked that the peer has successfully joined the channel (when the Fabric was started)? Have you done a docker ps to see your Fabric docker containers are running?) Assuming you followed the steps correct and using an identity you have obtained from a fabric-ca server (per the tutorial), have you checked the fabric-ca server is running correctly (docker logs ? Also, is it possible you're restarted your Fabric docker environment at one point and now your old key information is invalid?
eg
{
"name": "fabric-network",
"type": "hlfv1",
"mspID": "Org1MSP",
"peers": [
{
"requestURL": "grpc://localhost:7051",
"eventURL": "grpc://localhost:7053"
}
],
"ca": {
"url": "http://localhost:7054",
"name": "ca.org1.example.com"
},
"orderers": [
{
"url" : "grpc://localhost:7050"
}
],
"channel": "composerchannel",
"timeout": 300
}
then re-create the card with the correct key/signcert info
composer card create -p connection.json -u PeerAdmin -c Admin#org1.example.com-cert.pem -k xxxxx_sk -r PeerAdmin -r ChannelAdmin
where the .pem file comes from signcerts directory and xxxxx is the generated value for the key filename in keystore.

Why am I getting a permission denied error on docker/aws eb?

I don't know why but I cannot seem to figure out why this is happening. I can build and run the docker image locally.
Recent Events:
2015-05-25 12:57:07 UTC+1000 ERROR Update environment operation is complete, but with errors. For more information, see troubleshooting documentation.
2015-05-25 12:57:07 UTC+1000 INFO New application version was deployed to running EC2 instances.
2015-05-25 12:57:04 UTC+1000 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1].
2015-05-25 12:57:04 UTC+1000 ERROR [Instance: i-4775ec9b] Command failed on instance. Return code: 1 Output: (TRUNCATED)... run Docker container: vel="fatal" msg="Error response from daemon: Cannot start container 02c057b331bf3a3d912bf064f1dca3e00c95746b5748c3c4a28a5c6b452ff335: [8] System error: exec: \"bin/app\": permission denied" . Check snapshot logs for details. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh failed. For more detail, check /var/log/eb-activity.log using console or EB CLI.
2015-05-25 12:57:03 UTC+1000 ERROR Failed to run Docker container: vel="fatal" msg="Error response from daemon: Cannot start container 02c057b331bf3a3d912bf064f1dca3e00c95746b5748c3c4a28a5c6b452ff335: [8] System error: exec: \"bin/app\": permission denied" . Check snapshot logs for details.
Dockerfile:
FROM java:8u45-jre
MAINTAINER Terence Munro <terry#zenkey.com.au>
ADD ["opt", "/opt"]
WORKDIR /opt/docker
RUN ["chown", "-R", "daemon:daemon", "."]
USER daemon
ENTRYPOINT ["bin/app"]
EXPOSE 9000
Dockerrun.aws.json:
{
"AWSEBDockerrunVersion": "1",
"Ports": [
{
"ContainerPort": "9000"
}
],
"Volumes": []
}
Additional logs as attachment at: https://forums.aws.amazon.com/thread.jspa?threadID=181270
Any help is extremely appreciated.
#nick-humrich suggestion of trying eb local run worked. So using eb deploy ended up working.
I had previously been uploading through the web interface.
Initially using eb deploy was giving me a ERROR: TypeError :: data must be a byte string but I found this issue which was resolved by uninstalling pyopenssl.
So I don't know why the web interface was giving me permission denied perhaps something to do with the zip file?
But anyway I'm able to deploy now thank you.
I had a similar problem running Docker on Elastic Beanstalk. When I pointed CMD in the Dockerfile to a shell script (/path/to/my_script.sh), the EB deployment would fail with
/path/to/my_script.sh: Permission denied.
Apparently, even though I had run RUN chmod +x /path/to/my_script.sh during the Docker build, by the time the image was run, the permissions had been changed. Eventually, to make it work I settled on:
CMD ["/bin/bash","-c","chmod +x /path/to/my_script.sh && /path/to/my_script.sh"]

Error deploying Play Framework on AWS Beanstalk Docker

Im running a Play Framework app on AWS Beanstalk with Docker (64bit Amazon Linux 2015.03 v1.4.1 running Docker 1.6.0).
Docker File:
FROM relateiq/oracle-java8
MAINTAINER XXXX
EXPOSE 9000
ADD files /
WORKDIR /opt/docker
RUN ["chown", "-R", "daemon", "."]
RUN ["chmod", "+x", "bin/app"]
USER daemon
ENTRYPOINT ["bin/app"]
CMD []
Dockerrun.aws.json
{
"AWSEBDockerrunVersion": "1",
"Ports": [{
"ContainerPort": "9000"
}]
}
When the instance first starts I get about 1 minute where its deployed as normal, then after I browse a few pages the error shows:
502 Bad Gateway
nginx/1.6.2
The error in the ElasticBeanstalk logs is:
Play server process ID is 1 This application is already running (Or delete /opt/docker/RUNNING_PID file).
I also get in the /var/log/docker-events.logthe following messages every 30 seconds:
2015-05-30T20:07:58.000000000Z d0425e47095e5e2637263a0fe9b49ed759f130f31c041368ea48ce3d99d1e947: (from aws_beanstalk/current-app:latest) start
2015-05-30T20:08:15.000000000Z d0425e47095e5e2637263a0fe9b49ed759f130f31c041368ea48ce3d99d1e947: (from aws_beanstalk/current-app:latest) die
2015-05-30T20:08:16.000000000Z d0425e47095e5e2637263a0fe9b49ed759f130f31c041368ea48ce3d99d1e947: (from aws_beanstalk/current-app:latest) start
2015-05-30T20:08:31.000000000Z d0425e47095e5e2637263a0fe9b49ed759f130f31c041368ea48ce3d99d1e947: (from aws_beanstalk/current-app:latest) die
Can anyone see my issue? Cheers.
Adding the following to build.sbt should resolve the issue:
javaOptions in Universal ++= Seq("-Dpidfile.path=/dev/null")

Docker Error - "jq: error: Cannot iterate over null"

So I'm trying to deploy a dockerfile on Elastic Beanstalk, but I can't get past this error - "jq: error: Cannot iterate over null".
Successfully built [myContainerId]
Successfully built aws_beanstalk/staging-app
[2015-01-29T10:35:59.494Z] INFO [16343] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/04run.sh] : Starting activity...
[2015-01-29T10:36:05.507Z] INFO [16343] - [CMD-AppDeploy/AppDeployStage0/AppDeployPreHook/04run.sh] : Activity execution failed, because: command failed with error code 1: /opt/elasticbeanstalk/hooks/appdeploy/pre/04run.sh
jq: error: Cannot iterate over null
Docker container quit unexpectedly after launch: Docker container quit unexpectedly on Thu Jan 29 10:36:05 UTC 2015:. Check snapshot logs for details. (Executor::NonZeroExitStatus)
at /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor/exec.rb:81:in `sh'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/executor-1.0/lib/executor.rb:15:in `sh'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/executable.rb:63:in `execute!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/hook-directory-executor.rb:29:in `block (2 levels) in run!'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `call'
from /opt/elasticbeanstalk/lib/ruby/lib/ruby/gems/2.1.0/gems/beanstalk-core-1.1/lib/elasticbeanstalk/activity.rb:169:in `exec'
There aren't any other errors in the logs. My Docker container is successfully built, so it seems unlikely the error is coming from there.
My Dockerrun.aws.json looks like :
{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "blah",
"Update": "false"
},
"Ports": [
{
"ContainerPort": "8080"
}
]
}
I'm banging my head against a wall with this one, nothing I change seems to affect it and googling hasn't been of any help.
Any ideas?
If others are looking for how to avoid the Cannot iterate over null error in their own jq commands, add a question mark after []. For example
echo '{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "blah",
"Update": "false"
},
"Ports": [
{
"ContainerPort": "8080"
}
]
}'|jq -c '.Volumes[]?|[.HostDirectory,.ContainerDirectory]'
where [] was replaced with []? does not display the error.
From the manual:
.[]?
Like .[], but no errors will be output if . is not an array or object.
The problem is that your Dockerrun.aws.json file is missing the Volumes property.
The 04pre.sh script uses the jq tool in order to query the JSON file.
Specifically, it runs the following command on your file, which yields to an error:
$ jq -c '.Volumes[] | [.HostDirectory, .ContainerDirectory]' < Dockerrun.aws.json
jq: error: Cannot iterate over null
Specifying an empty "Volumes" array should resolve the error.
Note that an Elastic Beanstalk deployment to the Docker platform can fail with the "jq: error ... Cannot iterate over null..." error message in various phases of an Elastic Beanstalk deployment, for various different reasons. This can include your application (Docker container) quitting or erroring on startup.
Although this particular reported occurrence of the problem may have been specific to a missing "Volumes" property in Dockerrun.aws.json, your problem may not be. If you get this error, then the best way to go about diagnosing the problem is to download your full EB logs and check the diagnostics in the following log file /var/log/eb-activity.log.
If the problem was caused by your application failing to startup then you'll find the error in /var/log/eb-docker/containers/eb-current-app/unexpected-quit.log.
In my case issue was caused by ADD in Dockerfile instead of COPY instruction. Changing it fixed the issue.