Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Failed to save card: PeerAdmin@hlfv1 #98

Closed
DazWilkin opened this issue Jun 6, 2018 · 6 comments
Closed

Error: Failed to save card: PeerAdmin@hlfv1 #98

DazWilkin opened this issue Jun 6, 2018 · 6 comments

Comments

@DazWilkin
Copy link

DazWilkin commented Jun 6, 2018

In full disclosure, I've not used Composer previously and was hoping that, by following through these scripts, it would work without issue. It doesn't.

I'm having issues getting the Peers to join the Channel (#97) so it's entirely possible that this subsequent step won't work until that issue is addressed. However, it doesn't appear immediately dependent.

The composer-card-import Pod|container fails with Error: Failed to save card: PeerAdmin@hlfv1

So getting on to the container and running the script step-by-step:

$ ls -la
drwxr-xr-x 1 composer composer 4096 Jun  6 21:09 .
drwxr-xr-x 1 root     root     4096 Dec 14 18:35 ..
-rw-r--r-- 1 composer composer  220 Aug 31  2015 .bash_logout
-rw-r--r-- 1 composer composer 3771 Aug 31  2015 .bashrc
drwxr-xr-x 5 root     root     4096 Jun  6 18:49 .composer
drwxr-xr-x 5 composer composer 4096 Dec 14 18:35 .npm-global
-rw------- 1 composer composer   34 Dec 14 18:35 .npmrc
-rw-r--r-- 1 composer composer  655 May 16  2017 .profile
drwxr-xr-x 2 root     root     4096 Dec 14 18:32 LICENSE

$ ls -la ./.composer
total 60
drwxr-xr-x 5 root     root      4096 Jun  6 18:49 .
drwxr-xr-x 1 composer composer  4096 Jun  6 21:09 ..
-rw-r--r-- 1 root     root         0 Jun  6 18:46 bootstrapped
drwxr-xr-x 4 root     root      4096 Jun  6 18:46 cas
-rw-r--r-- 1 root     root       392 Jun  6 18:49 channel1.tx
-rw-r--r-- 1 root     root      6891 Jun  6 18:46 configtx.yaml
drwxr-xr-x 4 root     root      4096 Jun  6 18:46 crypto-config
-rw-r--r-- 1 root     root        16 Jun  6 18:46 index.html
drwxr-xr-x 2 root     root     16384 Jun  6 18:46 lost+found
-rw-r--r-- 1 root     root      9070 Jun  6 18:46 orderer.block
-rw-r--r-- 1 root     root         0 Jun  6 18:49 status_channelcreate_complete
-rw-r--r-- 1 root     root         0 Jun  6 18:46 status_fabricca_complete
-rw-r--r-- 1 root     root         0 Jun  6 18:46 status_orderer_complete
-rw-r--r-- 1 root     root         0 Jun  6 18:47 status_org1peer1_complete
-rw-r--r-- 1 root     root         0 Jun  6 18:47 status_org2peer1_complete

$ echo $PWD
/home/composer

$ echo $K8S_PROFILE
{ "type": "hlfv1", "name": "hlfv1", "orderers": [ { "url": "grpc://ibm-blockchain-network-orderer:31010" } ], "ca": { "url": "http://ibm-blockchain-network-ca:30054", "name": "CA1" }, "peers": [ { "requestURL": "grpc://ibm-blockchain-network-org1peer1:30110", "eventURL": "grpc://ibm-blockchain-network-org1peer1:30111" } ], "channel": "channel1", "mspID": "Org1MSP", "timeout": 300 }

$ echo $K8S_PROFILE > connection.json

$ ls -l
drwxr-xr-x 2 root     root     4096 Dec 14 18:32 LICENSE
-rw-r--r-- 1 composer composer  385 Jun  6 20:23 connection.json

$ ls -l /shared/crypto-config/peerOrganizations
total 8
drwxr-xr-x 7 root root 4096 Jun  6 18:46 org1.example.com
drwxr-xr-x 7 root root 4096 Jun  6 18:46 org2.example.com

$ ls -l /shared/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]
-rw-r--r-- 1 root root 790 Jun  6 18:46 /shared/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected]

$ ls -l /shared/crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/signcerts/[email protected]
-rw-r--r-- 1 root root 790 Jun  6 18:46 /shared/crypto-config/peerOrganizations/org2.example.com/users/[email protected]/msp/signcerts/[email protected]

$ composer card create \
-f PeerAdmin.card \
-p connection.json \
-u PeerAdmin \
-r PeerAdmin \
-r ChannelAdmin \
-c /shared/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/signcerts/[email protected] \
-k /shared/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore/key.pem

Successfully created business network card file to 
	Output file: PeerAdmin.card

Command succeeded

$ ls -l
total 16
drwxr-xr-x 2 root     root     4096 Dec 14 18:32 LICENSE
-rw-r--r-- 1 composer composer 2026 Jun  6 20:25 PeerAdmin.card
drwxr-xr-x 2 composer composer 4096 Jun  6 20:25 composer-logs
-rw-r--r-- 1 composer composer  385 Jun  6 20:23 connection.json


$ composer card import -f PeerAdmin.card
Error: Failed to save card: PeerAdmin@hlfv1
Command failed
@vmorris
Copy link

vmorris commented Jun 6, 2018

Not having the peer joined to the channel wouldn't cause the card to fail to import.
I don't think it would cause that error, but can you try with -u admin in the card create?
Also, what version of composer are you using?

@vmorris
Copy link

vmorris commented Jun 6, 2018

I'm also not seeing what version of Fabric you're using. If it's v1.1.0, you're connection profile's got to be a bit more substantial: https://hyperledger.github.io/composer/latest/reference/connectionprofile

@DazWilkin
Copy link
Author

Thanks!

I'm using the Helm Chart from this repo and it uses:

toolsImage: ibmblockchain/fabric-tools:1.0.0
ordererImage: ibmblockchain/fabric-orderer:1.0.0
caImage: ibmblockchain/fabric-ca:1.0.0
peerImage: ibmblockchain/fabric-peer:1.0.0

and it includes:

composer --version
v0.16.2

The Deployment is created from this file which is simpler than the one you reference. I'll try create something more complete:
https://github.com/IBM-Blockchain/ibm-container-service/blob/master/cs-offerings/kube-configs/composer-card-import.yaml

@DazWilkin
Copy link
Author

IIUC, I tried using -u admin:

$ composer card create -u admin -p connection.json

Successfully created business network card file to 
	Output file: [email protected]

Command succeeded

$ composer card import -f [email protected]
Error: Failed to save card: admin@hlfv1
Command failed

$ ls -l
total 20
drwxr-xr-x 2 root     root     4096 Dec 14 18:32 LICENSE
-rw-r--r-- 1 composer composer 2022 Jun  6 22:54 PeerAdmin.card
-rw-r--r-- 1 composer composer  612 Jun  6 23:08 [email protected]
drwxr-xr-x 2 composer composer 4096 Jun  6 22:42 composer-logs
-rw-r--r-- 1 composer composer  385 Jun  6 22:42 connection.json

@vmorris
Copy link

vmorris commented Jun 7, 2018

Hmm, you wouldn't want to try the more complicated profile for a fabric 1.0.0 network, but you could get a newer version of composer (stay on the 0.16.x level). Last I checked, it was 0.16.6.

@DazWilkin
Copy link
Author

Solved!

I mixed up volume mounts between:

Helm Chart's blockchain-utils yaml's mountPath: /home/composer/

and

composer-card-import script's mountPath: /home/composer/.composer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants