From 1cc05ed9f4ccc8959dc428c702ff649205c75909 Mon Sep 17 00:00:00 2001 From: zhaoguangwei Date: Fri, 30 Oct 2020 17:07:04 +0800 Subject: [PATCH] add the docker's module to optimize the constructure of docker-demo; --- deploy/{ => docker}/docker-demo/pom.xml | 46 ++++++++++++++---- .../docker-demo/src/main/docker/Dockerfile | 0 .../src/main/docker/script/shutdown.sh | 0 .../src/main/docker/script/start.sh | 0 .../docker-demo/src/main/docker/zip/conf.zip | Bin .../main/resources/docker-compose-all.yaml | 0 .../src/main/resources/start-net.sh | 0 .../docker-demo/src/main/resources/zip.sh | 0 deploy/{ => docker}/docker-sdk/pom.xml | 17 +++---- .../com/jd/blockchain/ContractParams.java | 0 .../main/java/com/jd/blockchain/SDKDemo.java | 0 .../com/jd/blockchain/SDKDemo_Constant.java | 0 .../java/com/jd/blockchain/SDK_Base_Demo.java | 0 .../jd/chain/contract/TransferContract.java | 0 .../contract-compile-1.3.0.RELEASE.car | Bin deploy/docker/pom.xml | 25 ++++++++++ deploy/{docker-demo => docker}/readme.md | 11 +++-- 17 files changed, 73 insertions(+), 26 deletions(-) rename deploy/{ => docker}/docker-demo/pom.xml (73%) rename deploy/{ => docker}/docker-demo/src/main/docker/Dockerfile (100%) rename deploy/{ => docker}/docker-demo/src/main/docker/script/shutdown.sh (100%) rename deploy/{ => docker}/docker-demo/src/main/docker/script/start.sh (100%) rename deploy/{ => docker}/docker-demo/src/main/docker/zip/conf.zip (100%) rename deploy/{ => docker}/docker-demo/src/main/resources/docker-compose-all.yaml (100%) rename deploy/{ => docker}/docker-demo/src/main/resources/start-net.sh (100%) rename deploy/{ => docker}/docker-demo/src/main/resources/zip.sh (100%) mode change 100755 => 100644 rename deploy/{ => docker}/docker-sdk/pom.xml (83%) rename deploy/{ => docker}/docker-sdk/src/main/java/com/jd/blockchain/ContractParams.java (100%) rename deploy/{ => docker}/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo.java (100%) rename deploy/{ => docker}/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo_Constant.java (100%) rename deploy/{ => docker}/docker-sdk/src/main/java/com/jd/blockchain/SDK_Base_Demo.java (100%) rename deploy/{ => docker}/docker-sdk/src/main/java/com/jd/chain/contract/TransferContract.java (100%) rename deploy/{ => docker}/docker-sdk/src/main/resources/contract-compile-1.3.0.RELEASE.car (100%) create mode 100644 deploy/docker/pom.xml rename deploy/{docker-demo => docker}/readme.md (63%) diff --git a/deploy/docker-demo/pom.xml b/deploy/docker/docker-demo/pom.xml similarity index 73% rename from deploy/docker-demo/pom.xml rename to deploy/docker/docker-demo/pom.xml index 59c4e340..a6b6ef36 100644 --- a/deploy/docker-demo/pom.xml +++ b/deploy/docker/docker-demo/pom.xml @@ -3,15 +3,21 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - jdchain-root + docker com.jd.blockchain - 1.2.1.RELEASE - ../../pom.xml + 1.3.0.RELEASE - 1.3.0 4.0.0 docker-demo + + + com.jd.blockchain + docker-sdk + ${project.version} + + + jdchain-demo @@ -30,6 +36,26 @@ + + + + + + + + + + + + + + + + + + + + maven-resources-plugin 3.0.2 @@ -47,18 +73,18 @@ false - ${project.basedir}/../deploy-peer/target/ + ${project.basedir}/../../deploy-peer/target/ false - jdchain-peer-${project.version}.RELEASE.zip + jdchain-peer-${project.version}.zip - ${project.basedir}/../deploy-gateway/target/ + ${project.basedir}/../../deploy-gateway/target/ false - jdchain-gateway-${project.version}.RELEASE.zip + jdchain-gateway-${project.version}.zip @@ -67,7 +93,7 @@ ${project.basedir}/../docker-sdk/target/ false - docker-sdk-${project.version}.RELEASE.jar + docker-sdk-${project.version}.jar @@ -97,7 +123,7 @@ jdchain-demo - ${project.version} + ${docker.tag} ${project.basedir}/src/main/docker diff --git a/deploy/docker-demo/src/main/docker/Dockerfile b/deploy/docker/docker-demo/src/main/docker/Dockerfile similarity index 100% rename from deploy/docker-demo/src/main/docker/Dockerfile rename to deploy/docker/docker-demo/src/main/docker/Dockerfile diff --git a/deploy/docker-demo/src/main/docker/script/shutdown.sh b/deploy/docker/docker-demo/src/main/docker/script/shutdown.sh similarity index 100% rename from deploy/docker-demo/src/main/docker/script/shutdown.sh rename to deploy/docker/docker-demo/src/main/docker/script/shutdown.sh diff --git a/deploy/docker-demo/src/main/docker/script/start.sh b/deploy/docker/docker-demo/src/main/docker/script/start.sh similarity index 100% rename from deploy/docker-demo/src/main/docker/script/start.sh rename to deploy/docker/docker-demo/src/main/docker/script/start.sh diff --git a/deploy/docker-demo/src/main/docker/zip/conf.zip b/deploy/docker/docker-demo/src/main/docker/zip/conf.zip similarity index 100% rename from deploy/docker-demo/src/main/docker/zip/conf.zip rename to deploy/docker/docker-demo/src/main/docker/zip/conf.zip diff --git a/deploy/docker-demo/src/main/resources/docker-compose-all.yaml b/deploy/docker/docker-demo/src/main/resources/docker-compose-all.yaml similarity index 100% rename from deploy/docker-demo/src/main/resources/docker-compose-all.yaml rename to deploy/docker/docker-demo/src/main/resources/docker-compose-all.yaml diff --git a/deploy/docker-demo/src/main/resources/start-net.sh b/deploy/docker/docker-demo/src/main/resources/start-net.sh similarity index 100% rename from deploy/docker-demo/src/main/resources/start-net.sh rename to deploy/docker/docker-demo/src/main/resources/start-net.sh diff --git a/deploy/docker-demo/src/main/resources/zip.sh b/deploy/docker/docker-demo/src/main/resources/zip.sh old mode 100755 new mode 100644 similarity index 100% rename from deploy/docker-demo/src/main/resources/zip.sh rename to deploy/docker/docker-demo/src/main/resources/zip.sh diff --git a/deploy/docker-sdk/pom.xml b/deploy/docker/docker-sdk/pom.xml similarity index 83% rename from deploy/docker-sdk/pom.xml rename to deploy/docker/docker-sdk/pom.xml index 85cacb21..acd99c8c 100644 --- a/deploy/docker-sdk/pom.xml +++ b/deploy/docker/docker-sdk/pom.xml @@ -3,39 +3,34 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - deploy-root + docker com.jd.blockchain - 1.4.0-SNAPSHOT + 1.3.0.RELEASE 4.0.0 - 1.3.0.RELEASE docker-sdk - - 1.3.0.RELEASE - - com.jd.blockchain crypto-classic - ${ledger.version} + ${project.version} com.jd.blockchain crypto-sm - ${ledger.version} + ${project.version} com.jd.blockchain ledger-model - ${ledger.version} + ${project.version} com.jd.blockchain sdk-client - ${ledger.version} + ${project.version} diff --git a/deploy/docker-sdk/src/main/java/com/jd/blockchain/ContractParams.java b/deploy/docker/docker-sdk/src/main/java/com/jd/blockchain/ContractParams.java similarity index 100% rename from deploy/docker-sdk/src/main/java/com/jd/blockchain/ContractParams.java rename to deploy/docker/docker-sdk/src/main/java/com/jd/blockchain/ContractParams.java diff --git a/deploy/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo.java b/deploy/docker/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo.java similarity index 100% rename from deploy/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo.java rename to deploy/docker/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo.java diff --git a/deploy/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo_Constant.java b/deploy/docker/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo_Constant.java similarity index 100% rename from deploy/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo_Constant.java rename to deploy/docker/docker-sdk/src/main/java/com/jd/blockchain/SDKDemo_Constant.java diff --git a/deploy/docker-sdk/src/main/java/com/jd/blockchain/SDK_Base_Demo.java b/deploy/docker/docker-sdk/src/main/java/com/jd/blockchain/SDK_Base_Demo.java similarity index 100% rename from deploy/docker-sdk/src/main/java/com/jd/blockchain/SDK_Base_Demo.java rename to deploy/docker/docker-sdk/src/main/java/com/jd/blockchain/SDK_Base_Demo.java diff --git a/deploy/docker-sdk/src/main/java/com/jd/chain/contract/TransferContract.java b/deploy/docker/docker-sdk/src/main/java/com/jd/chain/contract/TransferContract.java similarity index 100% rename from deploy/docker-sdk/src/main/java/com/jd/chain/contract/TransferContract.java rename to deploy/docker/docker-sdk/src/main/java/com/jd/chain/contract/TransferContract.java diff --git a/deploy/docker-sdk/src/main/resources/contract-compile-1.3.0.RELEASE.car b/deploy/docker/docker-sdk/src/main/resources/contract-compile-1.3.0.RELEASE.car similarity index 100% rename from deploy/docker-sdk/src/main/resources/contract-compile-1.3.0.RELEASE.car rename to deploy/docker/docker-sdk/src/main/resources/contract-compile-1.3.0.RELEASE.car diff --git a/deploy/docker/pom.xml b/deploy/docker/pom.xml new file mode 100644 index 00000000..81a492ab --- /dev/null +++ b/deploy/docker/pom.xml @@ -0,0 +1,25 @@ + + + + deploy-root + com.jd.blockchain + 1.4.0-SNAPSHOT + + 4.0.0 + 1.3.0.RELEASE + pom + + docker + + + 1.3.0 + + + + docker-sdk + docker-demo + + + \ No newline at end of file diff --git a/deploy/docker-demo/readme.md b/deploy/docker/readme.md similarity index 63% rename from deploy/docker-demo/readme.md rename to deploy/docker/readme.md index 44b5a646..a83be9d4 100644 --- a/deploy/docker-demo/readme.md +++ b/deploy/docker/readme.md @@ -4,11 +4,12 @@ JDChain在docker中的安装路径:/export/jdchain,网关对外端口为:8 demo环境构建完成后执行sdk加载部分测试数据,区块高度:7,交易总数:8,用户总数:5,数据账户总数:2,合约总数:1。 ## 如何生成镜像 -1. 需要预先在deploy-peer和deploy-gateway中生成zip安装包,copy的源路径是target; -2. 需要预先在docker-sdk中执行:mvn clean package,生成sdk可执行jar; -2. 本项目中执行:mvn clean package;会从dpploy-peer/dploy-gw/docker-sdk的target中提取zip包和可执行jar, -在docker环境中生成jdchain-peer镜像; -3. 生成镜像文件。执行resource中:zip.sh,可生成镜像的tar.gz压缩包; +1. 如果构建的docker镜像为当前开发版本,将docker模块中的跟主版本对齐,然后在deploy模块执行:mvn clean package即可。 +如果镜像版本与所在开发版本不一致(举例说明:构建1.3.0的镜像版本,但当前开发版本是1.4.0),需要预先在deploy-peer和deploy-gateway的 +target文件夹下放置相应版本zip安装包(jdchain-peer-xxx.zip,jdchain-gateway-xxx.zip),然后在docker模块执行:mvn clean package。 +2. 在maven构建过程中,两个zip安装包和docker-sdk-xxx.jar,会放至docker-demo模块src/main/docker/zip文件夹下。 +3. maven构建完成后,控制台执行:docker images,可看到构建的jdchain-peer镜像。 +4. 生成镜像文件。执行docker-demo模块中src/main/resources/zip.sh,可生成镜像的tar.gz压缩包; ## 镜像快速使用 1.在已经安装docker工具的环境中,装入jdchain-demo镜像: