[FAB-10811] fabric-ca sample is broken on v1.2

The Profile section of configtx.yaml must now be at the end of the file,
so the building of this file dynamically must be updated.
I also updated the version of the fabric CA in bootstrap.sh to 1.2.0.

Change-Id: Ifabccebc901f74569cfa1fe1d824fbcd26c4ffd1
Signed-off-by: Keith Smith <bksmith@us.ibm.com>
Signed-off-by: Christopher Ferris <chrisfer@us.ibm.com>
This commit is contained in:
Keith Smith 2018-06-22 09:25:05 -04:00 committed by Christopher Ferris
parent e95210e9bc
commit 75e293183b
4 changed files with 66 additions and 72 deletions

View file

@ -5,50 +5,50 @@ The Hyperledger Fabric CA sample demonstrates the following:
* How to use the Hyperledger Fabric CA client and server to generate all crypto * How to use the Hyperledger Fabric CA client and server to generate all crypto
material rather than using cryptogen. The cryptogen tool is not intended for material rather than using cryptogen. The cryptogen tool is not intended for
a production environment because it generates all private keys in one location a production environment because it generates all private keys in one location
which must then be copied to the appropriate host or container. This sample demonstrates which must then be copied to the appropriate host or container. This sample
how to generate crypto material for orderers, peers, administrators, and end demonstrates how to generate crypto material for orderers, peers,
users so that private keys never leave the host or container in which they are generated. administrators, and end users so that private keys never leave the host or
container in which they are generated.
* How to use Attribute-Based Access Control (ABAC). See fabric-samples/chaincode/abac/abac.go and * How to use Attribute-Based Access Control (ABAC). See
note the use of the *github.com/hyperledger/fabric/core/chaincode/lib/cid* package to extract fabric-samples/chaincode/abac/abac.go and note the use of the *github.com/hyperledger/fabric/core/chaincode/lib/cid* package to extract
attributes from the invoker's identity. Only identities with the *abac.init* attribute value of attributes from the invoker's identity. Only identities with the *abac.init*
*true* can successfully call the *Init* function to instantiate the chaincode. attribute value of *true* can successfully call the *Init* function to
instantiate the chaincode.
## Running this sample ## Running this sample
1. The following images are required to run this sample: 1. The following images are required to run this sample:
*hyperledger/fabric-ca-orderer*, *hyperledger/fabric-ca-peer*, and *hyperledger/fabric-ca-tools* *hyperledger/fabric-ca-orderer*, *hyperledger/fabric-ca-peer*, and *hyperledger/fabric-ca-tools*
#### 1.1.0 #### install the images
Run the *bootstrap.sh* script provided with this sample to download the required images for Run the *bootstrap.sh* script provided with this sample to download the
fabric-ca sample. required images for fabric-ca sample. For the v1.2.0-rc1 release, you
will need to specify the version as follows:
#### 1.0.X ```
These images are new in the v1.1.0 release of the *github.com/hyperledger/fabric-ca*. bootstrap.sh 1.2.0-rc1
In order to run this sample prior to the v1.1.0 release, you must build these ```
images manually as follows:
a) pull the master branch of the *github.com/hyperledger/fabric* and
*github.com/hyperledger/fabric-ca* repositories;
b) make sure these repositories are on your GOPATH;
c) run the *build-images.sh* script provided with this sample.
2. To run this sample, simply run the *start.sh* script. You may do this multiple times in a row as needed 2. To run this sample, simply run the *start.sh* script. You may do this
since the *start.sh* script cleans up before starting each time. multiple times in a row as needed since the *start.sh* script cleans up before
starting each time.
3. To stop the containers which are started by the *start.sh* script, you may run the *stop.sh* script. 3. To stop the containers which are started by the *start.sh* script, you may run the *stop.sh* script.
## Understanding this sample ## Understanding this sample
There are some variables at the top of *fabric-samples/fabric-ca/scripts/env.sh* script which There are some variables at the top of *fabric-samples/fabric-ca/scripts/env.sh*
define the names and topology of this sample. You may modify these as described in the comments script which define the names and topology of this sample. You may modify these
of the script in order to customize this sample. By default, there are three organizations. as described in the comments of the script in order to customize this sample.
The orderer organization is *org0*, and two peer organizations are *org1* and *org2*. By default, there are three organizations. The orderer organization is *org0*,
and two peer organizations are *org1* and *org2*.
The *start.sh* script first builds the *docker-compose.yml* file (by invoking the The *start.sh* script first builds the *docker-compose.yml* file (by invoking the
*makeDocker.sh* script) and then starts the docker containers. *makeDocker.sh* script) and then starts the docker containers.
The *data* directory is a volume mount for all containers. The *data* directory is a volume mount for all containers.
This volume mount is not be needed in a real scenario, but it is used by this sample This volume mount is not be needed in a real scenario, but it is used by this
for the following reasons: sample for the following reasons:
a) so that all containers can write their logs to a common directory a) so that all containers can write their logs to a common directory
(i.e. *the *data/logs* directory) to make debugging easier; (i.e. *the *data/logs* directory) to make debugging easier;
b) to synchronize the sequence in which containers start as described below b) to synchronize the sequence in which containers start as described below

View file

@ -6,13 +6,9 @@
# #
# current version of fabric-ca released # current version of fabric-ca released
export CA_VERSION=${1:-1.1.0} export CA_TAG=${1:-1.2.0}
export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}')
#Set MARCH variable i.e ppc64le,s390x,x86_64,i386
MARCH=`uname -m`
dockerCaPull() { dockerCaPull() {
local CA_TAG=$1
echo "==> FABRIC CA IMAGE" echo "==> FABRIC CA IMAGE"
echo echo
for image in "" "-tools" "-orderer" "-peer"; do for image in "" "-tools" "-orderer" "-peer"; do
@ -21,10 +17,8 @@ dockerCaPull() {
done done
} }
: ${CA_TAG:="$MARCH-$CA_VERSION"}
echo "===> Pulling fabric ca Image" echo "===> Pulling fabric ca Image"
dockerCaPull ${CA_TAG} dockerCaPull ${CA_TAG}
echo "===> List out hyperledger docker images" echo "===> List out hyperledger docker images"
docker images | grep hyperledger* docker images | grep hyperledger/fabric-ca

View file

@ -124,7 +124,42 @@ function printPeerOrg {
function makeConfigTxYaml { function makeConfigTxYaml {
{ {
echo "################################################################################ echo "
################################################################################
#
# Section: Organizations
#
# - This section defines the different organizational identities which will
# be referenced later in the configuration.
#
################################################################################
Organizations:"
for ORG in $ORDERER_ORGS; do
printOrdererOrg $ORG
done
for ORG in $PEER_ORGS; do
printPeerOrg $ORG 1
done
echo "
################################################################################
#
# SECTION: Application
#
# This section defines the values to encode into a config transaction or
# genesis block for application related parameters
#
################################################################################
Application: &ApplicationDefaults
# Organizations is the list of orgs which are defined as participants on
# the application side of the network
Organizations:
"
echo "
################################################################################
# #
# Profile # Profile
# #
@ -208,41 +243,6 @@ Profiles:
echo " - *${ORG_CONTAINER_NAME}" echo " - *${ORG_CONTAINER_NAME}"
done done
echo "
################################################################################
#
# Section: Organizations
#
# - This section defines the different organizational identities which will
# be referenced later in the configuration.
#
################################################################################
Organizations:"
for ORG in $ORDERER_ORGS; do
printOrdererOrg $ORG
done
for ORG in $PEER_ORGS; do
printPeerOrg $ORG 1
done
echo "
################################################################################
#
# SECTION: Application
#
# This section defines the values to encode into a config transaction or
# genesis block for application related parameters
#
################################################################################
Application: &ApplicationDefaults
# Organizations is the list of orgs which are defined as participants on
# the application side of the network
Organizations:
"
} > /etc/hyperledger/fabric/configtx.yaml } > /etc/hyperledger/fabric/configtx.yaml
# Copy it to the data directory to make debugging easier # Copy it to the data directory to make debugging easier
cp /etc/hyperledger/fabric/configtx.yaml /$DATA cp /etc/hyperledger/fabric/configtx.yaml /$DATA

View file

@ -6,11 +6,11 @@
# #
# if version not passed in, default to latest released version # if version not passed in, default to latest released version
export VERSION=1.1.0 export VERSION=1.2.0
# if ca version not passed in, default to latest released version # if ca version not passed in, default to latest released version
export CA_VERSION=$VERSION export CA_VERSION=$VERSION
# current version of thirdparty images (couchdb, kafka and zookeeper) released # current version of thirdparty images (couchdb, kafka and zookeeper) released
export THIRDPARTY_IMAGE_VERSION=0.4.7 export THIRDPARTY_IMAGE_VERSION=0.4.8
export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')") export ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')")
export MARCH=$(uname -m) export MARCH=$(uname -m)