Skip to content

Commit

Permalink
[FAB-10811] fabric-ca sample is broken on v1.2
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Keith Smith authored and christo4ferris committed Jun 22, 2018
1 parent e95210e commit 75e2931
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 72 deletions.
52 changes: 26 additions & 26 deletions fabric-ca/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
material rather than using cryptogen. The cryptogen tool is not intended for
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
how to generate crypto material for orderers, peers, administrators, and end
users so that private keys never leave the host or container in which they are generated.
which must then be copied to the appropriate host or container. This sample
demonstrates how to generate crypto material for orderers, peers,
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
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
*true* can successfully call the *Init* function to instantiate the chaincode.
* How to use Attribute-Based Access Control (ABAC). See
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 *true* can successfully call the *Init* function to
instantiate the chaincode.

## Running 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*

#### 1.1.0
Run the *bootstrap.sh* script provided with this sample to download the required images for
fabric-ca sample.
#### install the images
Run the *bootstrap.sh* script provided with this sample to download the
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*.
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.
```
bootstrap.sh 1.2.0-rc1
```

2. To run this sample, simply run the *start.sh* script. You may do this multiple times in a row as needed
since the *start.sh* script cleans up before starting each time.
2. To run this sample, simply run the *start.sh* script. You may do this
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.

## Understanding this sample

There are some variables at the top of *fabric-samples/fabric-ca/scripts/env.sh* script which
define the names and topology of this sample. You may modify these as described in the comments
of the script in order to customize this sample. By default, there are three organizations.
The orderer organization is *org0*, and two peer organizations are *org1* and *org2*.
There are some variables at the top of *fabric-samples/fabric-ca/scripts/env.sh*
script which define the names and topology of this sample. You may modify these
as described in the comments of the script in order to customize this sample.
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
*makeDocker.sh* script) and then starts the docker 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
for the following reasons:
This volume mount is not be needed in a real scenario, but it is used by this
sample for the following reasons:
a) so that all containers can write their logs to a common directory
(i.e. *the *data/logs* directory) to make debugging easier;
b) to synchronize the sequence in which containers start as described below
Expand Down
10 changes: 2 additions & 8 deletions fabric-ca/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,9 @@
#

# current version of fabric-ca released
export CA_VERSION=${1:-1.1.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`
export CA_TAG=${1:-1.2.0}

dockerCaPull() {
local CA_TAG=$1
echo "==> FABRIC CA IMAGE"
echo
for image in "" "-tools" "-orderer" "-peer"; do
Expand All @@ -21,10 +17,8 @@ dockerCaPull() {
done
}

: ${CA_TAG:="$MARCH-$CA_VERSION"}

echo "===> Pulling fabric ca Image"
dockerCaPull ${CA_TAG}

echo "===> List out hyperledger docker images"
docker images | grep hyperledger*
docker images | grep hyperledger/fabric-ca
72 changes: 36 additions & 36 deletions fabric-ca/scripts/setup-fabric.sh
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,42 @@ function printPeerOrg {

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
#
Expand Down Expand Up @@ -208,41 +243,6 @@ Profiles:
echo " - *${ORG_CONTAINER_NAME}"
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
# Copy it to the data directory to make debugging easier
cp /etc/hyperledger/fabric/configtx.yaml /$DATA
Expand Down
4 changes: 2 additions & 2 deletions scripts/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
#

# 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
export CA_VERSION=$VERSION
# 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 MARCH=$(uname -m)

Expand Down

0 comments on commit 75e2931

Please sign in to comment.