Skip to content

Commit

Permalink
[CE-427] Support fabric v1.2 sdk in user dashboard
Browse files Browse the repository at this point in the history
Can apply fabric v1.2 chain in user dashboard and use it.
Change crypto-config files for fabric 1.2 network.

Change-Id: I6355fbb828940127fcabd5b2bf5c6eeb671f97ea
Signed-off-by: Haitao Yue <hightall@me.com>
  • Loading branch information
hightall committed Aug 29, 2018
1 parent 55a0190 commit 2407d62
Show file tree
Hide file tree
Showing 575 changed files with 13,121 additions and 1,808 deletions.
2 changes: 1 addition & 1 deletion docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ services:
- RESTFUL_SERVER=operator-dashboard:8080
- DEBUG=node:*
- DEV=$DEV
- LOG_LEVEL=$LOG_LEVEL
- LOG_LEVEL=DEBUG
- ENABLE_EMAIL_ACTIVE=$ENABLE_EMAIL_ACTIVE
- SMTP_SERVER=$SMTP_SERVER
- SMTP_PORT=$SMTP_PORT
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ services:
- RESTFUL_SERVER=operator-dashboard:8080
- DEBUG=node:*
- DEV=$DEV
- LOG_LEVEL=$LOG_LEVEL
- LOG_LEVEL=INFO
- ENABLE_EMAIL_ACTIVE=$ENABLE_EMAIL_ACTIVE
- SMTP_SERVER=$SMTP_SERVER
- SMTP_PORT=$SMTP_PORT
Expand Down
25 changes: 21 additions & 4 deletions docker/user-dashboard/Dockerfile.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,38 @@
#
# SPDX-License-Identifier: Apache-2.0
#
FROM busybox as builder
ENV FABRIC_VERSION_1_0 1.0.5
RUN cd /tmp && ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') && \
echo $ARCH &&wget -c https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${FABRIC_VERSION_1_0}/hyperledger-fabric-${ARCH}-${FABRIC_VERSION_1_0}.tar.gz && \
mkdir fabric-1.0 && tar -zxvf hyperledger-fabric-${ARCH}-${FABRIC_VERSION_1_0}.tar.gz -C fabric-1.0
ENV FABRIC_VERSION_1_2 1.2.0
RUN cd /tmp && ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') && \
echo $ARCH &&wget -c https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${FABRIC_VERSION_1_2}/hyperledger-fabric-${ARCH}-${FABRIC_VERSION_1_2}.tar.gz && \
mkdir fabric-1.2 && tar -zxvf hyperledger-fabric-${ARCH}-${FABRIC_VERSION_1_2}.tar.gz -C fabric-1.2

FROM node:8.9
MAINTAINER haitao yue "hightall@me.com"
COPY user-dashboard/src/package.json /
COPY user-dashboard/src/yarn.lock /
RUN cd / && yarn install -g --verbose
ENV PATH ${PATH}:/node_modules/.bin
COPY user-dashboard/src/packages /packages
RUN cd /packages/fabric-1.0 && yarn install
RUN cd /packages/fabric-1.2 && yarn install
COPY user-dashboard/src /var/www
RUN cd /var/www && ln -sf /node_modules . && npm run build
WORKDIR /var/www
EXPOSE 8081

ENV FABRIC_VERSION 1.0.5
RUN cd /tmp && ARCH=$(echo "$(uname -s|tr '[:upper:]' '[:lower:]'|sed 's/mingw64_nt.*/windows/')-$(uname -m | sed 's/x86_64/amd64/g')" | awk '{print tolower($0)}') && echo $ARCH &&wget -c https://nexus.hyperledger.org/content/repositories/releases/org/hyperledger/fabric/hyperledger-fabric/${ARCH}-${FABRIC_VERSION}/hyperledger-fabric-${ARCH}-${FABRIC_VERSION}.tar.gz && tar -zxvf hyperledger-fabric-${ARCH}-${FABRIC_VERSION}.tar.gz && mv bin/configtxgen /usr/local/bin/configtxgen
COPY user-dashboard/fabric/fabric /etc/hyperledger/fabric
ENV FABRIC_CFG_PATH /etc/hyperledger/fabric
COPY --from=builder /tmp/fabric-1.0/bin/configtxgen /usr/local/bin/fabric-1.0/configtxgen
COPY --from=builder /tmp/fabric-1.2/bin/configtxgen /usr/local/bin/fabric-1.2/configtxgen
COPY user-dashboard/fabric/fabric-1.0 /etc/hyperledger/fabric-1.0
ENV FABRIC_CFG_PATH /etc/hyperledger/fabric-1.0
COPY user-dashboard/fabric/fabric-1.2 /etc/hyperledger/fabric-1.2
COPY user-dashboard/src/app/lib/fabric/fixtures/channel/v1.2/crypto-config /etc/hyperledger/fabric-1.2/crypto-config
ENV MONGO_PORT 27017

RUN sed -i 's/.\/ecdsa\/key.js/fabric-client\/lib\/impl\/ecdsa\/key.js/g' /packages/fabric-1.2/node_modules/fabric-ca-client/lib/impl/CryptoSuite_ECDSA_AES.js

CMD ln -sf /node_modules . && npm run start
54 changes: 27 additions & 27 deletions src/agent/docker/_compose_files/fabric-1.0/fabric-solo-4.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -214,33 +214,33 @@ services:
- ${COMPOSE_PROJECT_PATH}/crypto-config/peerOrganizations/org2.example.com/peers/peer1.org2.example.com/tls:/etc/hyperledger/fabric/tls
command: peer node start

cli: # client node
image: "hyperledger/fabric-tools:${HLF_VERSION-1.0.0}"
container_name: ${COMPOSE_PROJECT_NAME}_cli
hostname: cli
restart: always
tty: true
environment:
#- GOPATH=/opt/gopath
- CORE_LOGGING_LEVEL=DEBUG
- CORE_LOGGING_FORMAT=%{color}[%{id:03x} %{time:01-02 15:04:05.00 MST}] [%{longpkg}] %{callpath} -> %{level:.4s}%{color:reset} %{message}
- CORE_PEER_TLS_ENABLED=true # to enable TLS, change to true
- ORDERER_CA=/etc/hyperledger/fabric/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
depends_on:
- orderer.example.com
- peer0.org1.example.com
- peer1.org1.example.com
- peer0.org2.example.com
- peer1.org2.example.com
working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
volumes:
- ${COMPOSE_PROJECT_PATH}/scripts:/tmp/scripts
- ${COMPOSE_PROJECT_PATH}/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
- ${COMPOSE_PROJECT_PATH}/crypto-config:/etc/hyperledger/fabric/crypto-config
- ${COMPOSE_PROJECT_PATH}/solo/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
- ${COMPOSE_PROJECT_PATH}/solo/channel-artifacts:/tmp/channel-artifacts
- ${COMPOSE_PROJECT_PATH}/examples:/opt/gopath/src/examples
command: bash -c 'sleep 15; cd /tmp; source scripts/func.sh; bash scripts/test_channel_create.sh; bash scripts/test_channel_join.sh; bash scripts/test_cc_install.sh; while true; do sleep 20180101; done'
# cli: # client node
# image: "hyperledger/fabric-tools:${HLF_VERSION-1.0.0}"
# container_name: ${COMPOSE_PROJECT_NAME}_cli
# hostname: cli
# restart: always
# tty: true
# environment:
# #- GOPATH=/opt/gopath
# - CORE_LOGGING_LEVEL=DEBUG
# - CORE_LOGGING_FORMAT=%{color}[%{id:03x} %{time:01-02 15:04:05.00 MST}] [%{longpkg}] %{callpath} -> %{level:.4s}%{color:reset} %{message}
# - CORE_PEER_TLS_ENABLED=true # to enable TLS, change to true
# - ORDERER_CA=/etc/hyperledger/fabric/crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/msp/tlscacerts/tlsca.example.com-cert.pem
# depends_on:
# - orderer.example.com
# - peer0.org1.example.com
# - peer1.org1.example.com
# - peer0.org2.example.com
# - peer1.org2.example.com
# working_dir: /opt/gopath/src/github.com/hyperledger/fabric/peer
# volumes:
# - ${COMPOSE_PROJECT_PATH}/scripts:/tmp/scripts
# - ${COMPOSE_PROJECT_PATH}/crypto-config.yaml:/etc/hyperledger/fabric/crypto-config.yaml
# - ${COMPOSE_PROJECT_PATH}/crypto-config:/etc/hyperledger/fabric/crypto-config
# - ${COMPOSE_PROJECT_PATH}/solo/configtx.yaml:/etc/hyperledger/fabric/configtx.yaml
# - ${COMPOSE_PROJECT_PATH}/solo/channel-artifacts:/tmp/channel-artifacts
# - ${COMPOSE_PROJECT_PATH}/examples:/opt/gopath/src/examples
# command: bash -c 'sleep 15; cd /tmp; source scripts/func.sh; bash scripts/test_channel_create.sh; bash scripts/test_channel_join.sh; bash scripts/test_cc_install.sh; while true; do sleep 20180101; done'

explorer:
image: yeasy/blockchain-explorer:0.1.0-preview
Expand Down
149 changes: 149 additions & 0 deletions src/agent/docker/_compose_files/fabric-1.2/configtx.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

---
################################################################################
#
# Section: Organizations
#
# - This section defines the different organizational identities which will
# be referenced later in the configuration.
#
################################################################################
Organizations:

# SampleOrg defines an MSP using the sampleconfig. It should never be used
# in production but may be used as a template for other definitions
- &OrdererOrg
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: OrdererMSP

# ID to load the MSP definition as
ID: OrdererMSP

# MSPDir is the filesystem path which contains the MSP configuration
MSPDir: crypto-config/ordererOrganizations/example.com/msp

- &Org1
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: Org1MSP

# ID to load the MSP definition as
ID: Org1MSP

MSPDir: crypto-config/peerOrganizations/org1.example.com/msp

AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# encoded in the genesis block in the Application section context
- Host: peer0.org1.example.com
Port: 7051

- &Org2
# DefaultOrg defines the organization which is used in the sampleconfig
# of the fabric.git development environment
Name: Org2MSP

# ID to load the MSP definition as
ID: Org2MSP

MSPDir: crypto-config/peerOrganizations/org2.example.com/msp

AnchorPeers:
# AnchorPeers defines the location of peers which can be used
# for cross org gossip communication. Note, this value is only
# encoded in the genesis block in the Application section context
- Host: peer0.org2.example.com
Port: 7051

################################################################################
#
# 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:

################################################################################
#
# SECTION: Orderer
#
# - This section defines the values to encode into a config transaction or
# genesis block for orderer related parameters
#
################################################################################
Orderer: &OrdererDefaults

# Orderer Type: The orderer implementation to start
# Available types are "solo" and "kafka"
OrdererType: solo

Addresses:
- orderer.example.com:7050

# Batch Timeout: The amount of time to wait before creating a batch
BatchTimeout: 2s

# Batch Size: Controls the number of messages batched into a block
BatchSize:

# Max Message Count: The maximum number of messages to permit in a batch
MaxMessageCount: 10

# Absolute Max Bytes: The absolute maximum number of bytes allowed for
# the serialized messages in a batch.
AbsoluteMaxBytes: 98 MB

# Preferred Max Bytes: The preferred maximum number of bytes allowed for
# the serialized messages in a batch. A message larger than the preferred
# max bytes will result in a batch larger than preferred max bytes.
PreferredMaxBytes: 512 KB

Kafka:
# Brokers: A list of Kafka brokers to which the orderer connects
# NOTE: Use IP:port notation
Brokers:
- 127.0.0.1:9092

# Organizations is the list of orgs which are defined as participants on
# the orderer side of the network
Organizations:

################################################################################
#
# Profile
#
# - Different configuration profiles may be encoded here to be specified
# as parameters to the configtxgen tool
#
################################################################################
Profiles:

TwoOrgsOrdererGenesis:
Orderer:
<<: *OrdererDefaults
Organizations:
- *OrdererOrg
Consortiums:
SampleConsortium:
Organizations:
- *Org1
- *Org2
TwoOrgsChannel:
Consortium: SampleConsortium
Application:
<<: *ApplicationDefaults
Organizations:
- *Org1
- *Org2
83 changes: 83 additions & 0 deletions src/agent/docker/_compose_files/fabric-1.2/crypto-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Copyright IBM Corp. All Rights Reserved.
#
# SPDX-License-Identifier: Apache-2.0
#

# ---------------------------------------------------------------------------
# "OrdererOrgs" - Definition of organizations managing orderer nodes
# ---------------------------------------------------------------------------
OrdererOrgs:
# ---------------------------------------------------------------------------
# Orderer
# ---------------------------------------------------------------------------
- Name: Orderer
Domain: example.com
# ---------------------------------------------------------------------------
# "Specs" - See PeerOrgs below for complete description
# ---------------------------------------------------------------------------
Specs:
- Hostname: orderer
# ---------------------------------------------------------------------------
# "PeerOrgs" - Definition of organizations managing peer nodes
# ---------------------------------------------------------------------------
PeerOrgs:
# ---------------------------------------------------------------------------
# Org1
# ---------------------------------------------------------------------------
- Name: Org1
Domain: org1.example.com
EnableNodeOUs: true
# ---------------------------------------------------------------------------
# "Specs"
# ---------------------------------------------------------------------------
# Uncomment this section to enable the explicit definition of hosts in your
# configuration. Most users will want to use Template, below
#
# Specs is an array of Spec entries. Each Spec entry consists of two fields:
# - Hostname: (Required) The desired hostname, sans the domain.
# - CommonName: (Optional) Specifies the template or explicit override for
# the CN. By default, this is the template:
#
# "{{.Hostname}}.{{.Domain}}"
#
# which obtains its values from the Spec.Hostname and
# Org.Domain, respectively.
# ---------------------------------------------------------------------------
# Specs:
# - Hostname: foo # implicitly "foo.org1.example.com"
# CommonName: foo27.org5.example.com # overrides Hostname-based FQDN set above
# - Hostname: bar
# - Hostname: baz
# ---------------------------------------------------------------------------
# "Template"
# ---------------------------------------------------------------------------
# Allows for the definition of 1 or more hosts that are created sequentially
# from a template. By default, this looks like "peer%d" from 0 to Count-1.
# You may override the number of nodes (Count), the starting index (Start)
# or the template used to construct the name (Hostname).
#
# Note: Template and Specs are not mutually exclusive. You may define both
# sections and the aggregate nodes will be created for you. Take care with
# name collisions
# ---------------------------------------------------------------------------
Template:
Count: 2
# Start: 5
# Hostname: {{.Prefix}}{{.Index}} # default
# ---------------------------------------------------------------------------
# "Users"
# ---------------------------------------------------------------------------
# Count: The number of user accounts _in addition_ to Admin
# ---------------------------------------------------------------------------
Users:
Count: 1
# ---------------------------------------------------------------------------
# Org2: See "Org1" for full specification
# ---------------------------------------------------------------------------
- Name: Org2
Domain: org2.example.com
EnableNodeOUs: true
Template:
Count: 2
Users:
Count: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgh3rFLHwXzBOetrRO
BMN65dUE+JK0zDRrc/oKz8QDheqhRANCAAS13UJ8SZpfa+DFO78fchLXLHcK4gOj
ZZp7R5AS7HEfAs0RKeigu6g4elj2s8zq+zBl29yZelcXdhmcGCI7jhFc
-----END PRIVATE KEY-----
24 changes: 12 additions & 12 deletions ...iles/fabric-1.2/crypto-config/ordererOrganizations/example.com/ca/ca.example.com-cert.pem
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
-----BEGIN CERTIFICATE-----
MIICLjCCAdWgAwIBAgIQRktt2YoH+TqO5w2ktKcjojAKBggqhkjOPQQDAjBpMQsw
CQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNU2FuIEZy
YW5jaXNjbzEUMBIGA1UEChMLZXhhbXBsZS5jb20xFzAVBgNVBAMTDmNhLmV4YW1w
bGUuY29tMB4XDTE4MDYyMjAzMjIyOFoXDTI4MDYxOTAzMjIyOFowaTELMAkGA1UE
BhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBGcmFuY2lz
Y28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFtcGxlLmNv
bTBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABMqnkDebSYSUDWfwlpXlUagavEWF
9BKBiZ/GTnl05BOgWsn51km9aOV/btv6iBl41qzO572Ui6AYzfL8oBkt0mijXzBd
MA4GA1UdDwEB/wQEAwIBpjAPBgNVHSUECDAGBgRVHSUAMA8GA1UdEwEB/wQFMAMB
Af8wKQYDVR0OBCIEIFEB74XE5HOTDsDOzDFIhEkNTc2VTMvvu4uhzii1qhyUMAoG
CCqGSM49BAMCA0cAMEQCIA228ziTffBy2E4km9tcf6dt/T/p3LI3ZQ3CcVSWpMrT
AiAzTppMGobkAHOafL62NFf6WKvUBMWrS9XQQ8J1dPUdkQ==
MIICMDCCAdagAwIBAgIRAKQqb5QZdxIhzWmuoj2Mk+QwCgYIKoZIzj0EAwIwaTEL
MAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFjAUBgNVBAcTDVNhbiBG
cmFuY2lzY28xFDASBgNVBAoTC2V4YW1wbGUuY29tMRcwFQYDVQQDEw5jYS5leGFt
cGxlLmNvbTAeFw0xODA4MjUxNDM3MjJaFw0yODA4MjIxNDM3MjJaMGkxCzAJBgNV
BAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1TYW4gRnJhbmNp
c2NvMRQwEgYDVQQKEwtleGFtcGxlLmNvbTEXMBUGA1UEAxMOY2EuZXhhbXBsZS5j
b20wWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAAS13UJ8SZpfa+DFO78fchLXLHcK
4gOjZZp7R5AS7HEfAs0RKeigu6g4elj2s8zq+zBl29yZelcXdhmcGCI7jhFco18w
XTAOBgNVHQ8BAf8EBAMCAaYwDwYDVR0lBAgwBgYEVR0lADAPBgNVHRMBAf8EBTAD
AQH/MCkGA1UdDgQiBCByDfLWGansojVmmMW7mTWu+cdHN+AXCAPplpxvk13VtDAK
BggqhkjOPQQDAgNIADBFAiEA65JkCn/sVlvo0jj7NHN+uWJWdTwzKp4lLLo8VpvR
45sCIEKW9iIBa1yMaMLjJVsl4BrbHzsZ/JP4MsJpkuj4HWvS
-----END CERTIFICATE-----
Loading

0 comments on commit 2407d62

Please sign in to comment.