Hitoshi Kondo
Hitoshi Kondo

Reputation: 63

How to get peer admin's cert and key for deploy

I've tried to deploy my bna on Bluemix kubernetes cluster as of the description of following site https://ibm-blockchain.github.io/interacting/

but I doubt peer admin's cert and key is required for deploy on hlfv1 env. https://hyperledger.github.io/composer/business-network/bnd-deploy.html https://hyperledger.github.io/composer/reference/composer.identity.import.html

Does anyone know how to get peer admin's cert and key from following simple-install script env? https://ibm-blockchain.github.io/simple/

thank you.

Upvotes: 1

Views: 267

Answers (1)

JT-user2216025
JT-user2216025

Reputation: 194

Create connection profile

~/.composer-connection-profiles/bmx-stage1-kubes/connection.json


{
 "name": "bmx-stage1-kubes-org1",
 "description": "Connection profile for IBM Blockchain Platform",
 "type": "hlfv1",
 "orderers": [
  {
   "url": "grpc://169.47.123.123:31010"
  }
 ],
 "ca": {
 "url": "http://169.47.123.123:30000",
 "name": "CA1"
 },
"peers": [
{
 "requestURL": "grpc://169.47.123.123:30110",
 "eventURL": "grpc://169.47.123.123:30111"
 }
 ],
 "keyValStore": "/Users/jeff/.composer-credentials/bmx-stage1-kubes-
  org1",
 "channel": "channel1",
 "mspID": "Org1MSP",
 "timeout": 300
}

Make sure the public address matches the public address of your kubernetes cluster.

After setting up my kubernetes env, I needed to get the appropriate admin creds that I could use to create an admin id (PeerAdmin) In order to grab the creds, I first needed to access one of the pods in my kubernetes cluster

kubectl exec -ti $(kubectl get pods | grep ca| awk '{print $1}') bash

Then I needed to get the cert file and the key file for the ca. Found the cert file here:

/shared/crypto-config/peerOrganizations/org1.example.com/peers/peer0.org1.example.com/msp/admincerts

Found the key file here:

/shared/crypto-config/peerOrganizations/org1.example.com/users/[email protected]/msp/keystore

I then copied the contents of those files into a cert file (admincert.pem) and a private key file (key.pem) on my local system and then ran:

composer identity import -p bmx-stage1-kubes-org1 -u PeerAdmin -c admincert.pem -k key.pem

This created my PeerAdmin (admin identity)

I could then run

composer network deploy -a myBNA.bna -p bmx-stage1-kubes-org1 -i PeerAdmin -s abc

Upvotes: 1

Related Questions