From a8fb37848fddaf5f2f1c525ec8879600fd34ff89 Mon Sep 17 00:00:00 2001 From: Haitao Yue Date: Thu, 30 Aug 2018 13:59:12 +0800 Subject: [PATCH] [CE-445] Fix fabric-1.0 directory not found Fix local docker build for user dashboard failed. Change dockerhub build for user dashboard. Set DEBUG value directly True/False in compose files for operator dashboard. Change-Id: I63cf3aad19d05f51d7df577c3fdd531138753787 Signed-off-by: Haitao Yue --- docker-compose-dev.yml | 2 +- docker-compose.yml | 2 +- dockerhub/latest/user-dashboard/Dockerfile | 34 ++++++++++++++----- .../{fabric => fabric-1.0}/configtx.yaml | 0 .../fabric/{fabric => fabric-1.0}/core.yaml | 0 .../msp/admincerts/admincert.pem | 0 .../msp/cacerts/cacert.pem | 0 .../{fabric => fabric-1.0}/msp/config.yaml | 0 .../msp/keystore/key.pem | 0 .../msp/signcerts/peer.pem | 0 .../msp/tlscacerts/cert.pem | 0 .../{fabric => fabric-1.0}/orderer.yaml | 0 12 files changed, 28 insertions(+), 10 deletions(-) rename user-dashboard/fabric/{fabric => fabric-1.0}/configtx.yaml (100%) rename user-dashboard/fabric/{fabric => fabric-1.0}/core.yaml (100%) rename user-dashboard/fabric/{fabric => fabric-1.0}/msp/admincerts/admincert.pem (100%) rename user-dashboard/fabric/{fabric => fabric-1.0}/msp/cacerts/cacert.pem (100%) rename user-dashboard/fabric/{fabric => fabric-1.0}/msp/config.yaml (100%) rename user-dashboard/fabric/{fabric => fabric-1.0}/msp/keystore/key.pem (100%) rename user-dashboard/fabric/{fabric => fabric-1.0}/msp/signcerts/peer.pem (100%) rename user-dashboard/fabric/{fabric => fabric-1.0}/msp/tlscacerts/cert.pem (100%) rename user-dashboard/fabric/{fabric => fabric-1.0}/orderer.yaml (100%) diff --git a/docker-compose-dev.yml b/docker-compose-dev.yml index 01251950..43b45a4e 100644 --- a/docker-compose-dev.yml +++ b/docker-compose-dev.yml @@ -48,7 +48,7 @@ services: - MONGO_HOST=mongo - MONGO_DB=dev - MONGODB_PORT=27017 - - DEBUG=$DEV # in debug mode, service will auto-restart + - DEBUG=True # in debug mode, service will auto-restart - LOG_LEVEL=$LOG_LEVEL # what level log will be output - STATIC_FOLDER=$STATIC_FOLDER - TEMPLATE_FOLDER=$TEMPLATE_FOLDER diff --git a/docker-compose.yml b/docker-compose.yml index 63184b26..c81254e2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -48,7 +48,7 @@ services: - MONGO_HOST=mongo - MONGO_DB=dev - MONGODB_PORT=27017 - - DEBUG=$DEV # in debug mode, service will auto-restart + - DEBUG=False # in debug mode, service will auto-restart - LOG_LEVEL=$LOG_LEVEL # what level log will be output - STATIC_FOLDER=$STATIC_FOLDER - TEMPLATE_FOLDER=$TEMPLATE_FOLDER diff --git a/dockerhub/latest/user-dashboard/Dockerfile b/dockerhub/latest/user-dashboard/Dockerfile index be54e49e..fb8ba97b 100644 --- a/dockerhub/latest/user-dashboard/Dockerfile +++ b/dockerhub/latest/user-dashboard/Dockerfile @@ -2,21 +2,39 @@ # # 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 +RUN cd /tmp && wget -c https://github.com/hyperledger/cello/archive/master.zip && unzip master.zip + FROM node:8.9 MAINTAINER haitao yue "hightall@me.com" -RUN cd /tmp && git clone https://github.com/hyperledger/cello.git -RUN cd /tmp/cello/user-dashboard/src && cp package.json yarn.lock / && cd / && yarn install -g --verbose +COPY --from=builder /tmp/cello-master/user-dashboard/src/package.json / +COPY --from=builder /tmp/cello-master/user-dashboard/src/yarn.lock / +COPY --from=builder /tmp/cello-master/user-dashboard/src/packages /packages +COPY --from=builder /tmp/cello-master/user-dashboard/src /var/www +COPY --from=builder /tmp/cello-master/user-dashboard/fabric/fabric-1.0 /etc/hyperledger/fabric-1.0 +COPY --from=builder /tmp/cello-master/user-dashboard/fabric/fabric-1.2 /etc/hyperledger/fabric-1.2 +COPY --from=builder /tmp/cello-master/user-dashboard/src/app/lib/fabric/fixtures/channel/v1.2/crypto-config /etc/hyperledger/fabric-1.2/crypto-config +RUN cd / && yarn install -g --verbose +RUN cd /packages/fabric-1.0 && yarn install +RUN cd /packages/fabric-1.2 && yarn install ENV PATH ${PATH}:/node_modules/.bin -RUN mv /tmp/cello/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 -RUN mkdir -p /etc/hyperledger -RUN mv /tmp/cello/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 +ENV FABRIC_CFG_PATH /etc/hyperledger/fabric-1.0 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 diff --git a/user-dashboard/fabric/fabric/configtx.yaml b/user-dashboard/fabric/fabric-1.0/configtx.yaml similarity index 100% rename from user-dashboard/fabric/fabric/configtx.yaml rename to user-dashboard/fabric/fabric-1.0/configtx.yaml diff --git a/user-dashboard/fabric/fabric/core.yaml b/user-dashboard/fabric/fabric-1.0/core.yaml similarity index 100% rename from user-dashboard/fabric/fabric/core.yaml rename to user-dashboard/fabric/fabric-1.0/core.yaml diff --git a/user-dashboard/fabric/fabric/msp/admincerts/admincert.pem b/user-dashboard/fabric/fabric-1.0/msp/admincerts/admincert.pem similarity index 100% rename from user-dashboard/fabric/fabric/msp/admincerts/admincert.pem rename to user-dashboard/fabric/fabric-1.0/msp/admincerts/admincert.pem diff --git a/user-dashboard/fabric/fabric/msp/cacerts/cacert.pem b/user-dashboard/fabric/fabric-1.0/msp/cacerts/cacert.pem similarity index 100% rename from user-dashboard/fabric/fabric/msp/cacerts/cacert.pem rename to user-dashboard/fabric/fabric-1.0/msp/cacerts/cacert.pem diff --git a/user-dashboard/fabric/fabric/msp/config.yaml b/user-dashboard/fabric/fabric-1.0/msp/config.yaml similarity index 100% rename from user-dashboard/fabric/fabric/msp/config.yaml rename to user-dashboard/fabric/fabric-1.0/msp/config.yaml diff --git a/user-dashboard/fabric/fabric/msp/keystore/key.pem b/user-dashboard/fabric/fabric-1.0/msp/keystore/key.pem similarity index 100% rename from user-dashboard/fabric/fabric/msp/keystore/key.pem rename to user-dashboard/fabric/fabric-1.0/msp/keystore/key.pem diff --git a/user-dashboard/fabric/fabric/msp/signcerts/peer.pem b/user-dashboard/fabric/fabric-1.0/msp/signcerts/peer.pem similarity index 100% rename from user-dashboard/fabric/fabric/msp/signcerts/peer.pem rename to user-dashboard/fabric/fabric-1.0/msp/signcerts/peer.pem diff --git a/user-dashboard/fabric/fabric/msp/tlscacerts/cert.pem b/user-dashboard/fabric/fabric-1.0/msp/tlscacerts/cert.pem similarity index 100% rename from user-dashboard/fabric/fabric/msp/tlscacerts/cert.pem rename to user-dashboard/fabric/fabric-1.0/msp/tlscacerts/cert.pem diff --git a/user-dashboard/fabric/fabric/orderer.yaml b/user-dashboard/fabric/fabric-1.0/orderer.yaml similarity index 100% rename from user-dashboard/fabric/fabric/orderer.yaml rename to user-dashboard/fabric/fabric-1.0/orderer.yaml