fabric-samples/fabric-ca/scripts/start-peer.sh
Keith Smith fd795d2923 [FAB-6745] Fix timing issue in sample
When a CA starts, it creates its signing cert and then
starts listening on its listening port.  The fix is to
wait for the server to start listening on the port rather
than waiting for the signing cert file to be created.

See the waitPort function in env.sh, and places where this
is called.  I also had to increase the max time we wait before
failing.

WARNING: This change set is dependent upon the following
fabric-ca change set and should not be merged until it
has been merged:
   https://gerrit.hyperledger.org/r/#/c/15089/

Change-Id: I781e3653bf6846e22f401fe64855fa155ffeb7cb
Signed-off-by: Keith Smith <bksmith@us.ibm.com>
2017-11-07 11:35:57 -05:00

32 lines
870 B
Bash
Executable file

#!/bin/bash
#
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
set -e
source $(dirname "$0")/env.sh
awaitSetup
# Enroll the peer to get a TLS cert
fabric-ca-client enroll -d --enrollment.profile tls -u $ENROLLMENT_URL -M /tmp/tls --csr.hosts $PEER_HOST
# Copy the TLS key and cert to the appropriate place
TLSDIR=$PEER_HOME/tls
mkdir -p $TLSDIR
cp /tmp/tls/signcerts/* $CORE_PEER_TLS_CERT_FILE
cp /tmp/tls/keystore/* $CORE_PEER_TLS_KEY_FILE
rm -rf /tmp/tls
# Enroll the peer to get an enrollment certificate and set up the core's local MSP directory
fabric-ca-client enroll -d -u $ENROLLMENT_URL -M $CORE_PEER_MSPCONFIGPATH
finishMSPSetup $CORE_PEER_MSPCONFIGPATH
copyAdminCert $CORE_PEER_MSPCONFIGPATH
# Start the peer
log "Starting peer '$CORE_PEER_ID' with MSP at '$CORE_PEER_MSPCONFIGPATH'"
env | grep CORE
peer node start