我自己已经设法解决了这个问题,但如果 IBM 团队的某个人能够确认这是初始化配置的适当方式,那就太好了。
我的一个问题是,docker-compose.yaml
我需要设置,CORE_VM_DOCKER_HOSTCONFIG_NETWORKMODE=bridge
因为我没有使用主机网络模式。如果遇到类似问题,请确保此设置正确。
在配置方面,我必须使用openssl
从对等管理员用户的证书文件中获取公钥,并将私钥复制到我的~/.hfc-key-store
:
PROFILE_ID="testprofile"
HOMEDIR=$HOME
# These values depend on the output of `cryptogen` and will differ
# depending on your configuration and generated files.
PEER_ORG_ID="org1.example.com"
ADMIN_CREDENTIALS_CERT_ID="eb141574a8882664511fface8bd58410ff835a93cb6ca495f45a40213977a9a1"
ADMIN_USER_ID="Admin@org1.example.com"
CRYPTO_ASSETS_DIR="./crypto-config"
SIGNCERT_FILE="${CRYPTO_ASSETS_DIR}/peerOrganizations/${PEER_ORG_ID}/users/${ADMIN_USER_ID}/msp/signcerts/${ADMIN_USER_ID}-cert.pem"
PRIVKEY_FILE="${CRYPTO_ASSETS_DIR}/peerOrganizations/${PEER_ORG_ID}/users/${ADMIN_USER_ID}/msp/keystore/${ADMIN_CREDENTIALS_CERT_ID}_sk"
# extract pubkey from signing cert
openssl x509 -pubkey -noout -in "$SIGNCERT_FILE" > \
"${HOMEDIR}/.hfc-key-store/${ADMIN_CREDENTIALS_CERT_ID}-pub"
# copy private key across
cp "$PRIVKEY_FILE" \
"${HOMEDIR}/.hfc-key-store/${ADMIN_CREDENTIALS_CERT_ID}-priv"
# generate connection profile credential file
SIGNCERT_CONTENTS=$(cat "$SIGNCERT_FILE" | sed -z 's/\n/\\n/g')
cat << EOF > ${HOMEDIR}/.hfc-key-store/PeerAdmin
{
"name":"PeerAdmin",
"mspid":"Org1MSP",
"roles":null,
"affiliation":"",
"enrollmentSecret":"",
"enrollment":{
"signingIdentity":"${ADMIN_CREDENTIALS_CERT_ID}",
"identity":{
"id":"testIdentity",
"certificate":"${SIGNCERT_CONTENTS}"
}
}
}
EOF
有了这些文件,您应该能够成功连接到 v1 Fabric 以针对它部署 Composer 业务网络。