温馨提示:本文翻译自stackoverflow.com,查看原文请点击:docker - Corda Dockerform gradle task does not work as expected

docker - Corda Dockerform Gradle任务无法按预期工作

发布于 2020-03-27 11:38:59

我有我所创建基础上的信息找到了下面的简单任务的gradle 这里

我有以下gradle任务:

    task prepareDockerNodes(type: net.corda.plugins.Dockerform, dependsOn: ['jar']) {
    nodeDefaults{
        cordapp project(':tcw-contracts-states')
        cordapp project(':tcw-cordapp')
    }
    node {
        name "O=Notary Service,L=Zurich,C=CH"
        notary = [validating : false]
        rpcUsers = rpcUsersList
        useTestClock true
    }
    node {
        name "O=Bank A,L=London,C=GB"
        rpcUsers = rpcUsersList
        useTestClock true
    }
    node {
        name "O=Bank B,L=New York,C=US"
        rpcUsers = rpcUsersList
        useTestClock true
    }
}

但是当我运行它时,出现以下错误:

No configuration setting found for key 'p2pAddress'

比我添加p2pAddress "localhost"到所有节点的要多,但是之后我开始出现此错误:

File 'build/nodes/docker-compose.yml' specified for property 'dockerComposePath' does not exist.

您能帮我完成任务吗,还是给我一个工作实例来完善自己?

查看更多

查看更多

提问者
Andranik
被浏览
111
Chris Chabot 2019-07-04 17:44

你很亲密

首先,请确保您已运行,./gradlew deployNodes以便已生成节点文件夹结构和文件。

接下来,build.gradle中的dockerform任务应类似于:

task prepareDockerNodes(type: net.corda.plugins.Dockerform, dependsOn: ['jar']) {
    nodeDefaults {
        cordapp project(":contracts-java")
    }
    node {
        name "O=Notary,L=London,C=GB"
        notary = [validating : false]
        p2pPort 10002
        rpcSettings {
            address("localhost:10003")
            adminAddress("localhost:10023")
        }
        projectCordapp {
            deploy = false
        }
        cordapps.clear()
    }
    node {
        name "O=PartyA,L=London,C=GB"
        p2pPort 10002
        rpcSettings {
            address("localhost:10003")
            adminAddress("localhost:10023")
        }
        rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
    }
    node {
        name "O=PartyB,L=New York,C=US"
        p2pPort 10002
        rpcSettings {
            address("localhost:10003")
            adminAddress("localhost:10023")
        }
        rpcUsers = [[user: "user1", "password": "test", "permissions": ["ALL"]]]
    }
}

一旦完成deployNodes,创建一个空的docker-compose.yml文件来解决您遇到的错误: touch workflows-java/build/nodes/docker-compose.yml

然后就可以运行了./gradlew prepareDockerNodes完成后,编辑生成的docker-compose.yml文件以更改端口:

version: '3'
services:
  notary:
    build: /Users/chrischabot/Projects/json-cordapp/workflows-java/build/nodes/Notary
    ports:
      - "10002"
      - "10003"
  partya:
    build: /Users/chrischabot/Projects/json-cordapp/workflows-java/build/nodes/PartyA
    ports:
      - "10002"
      - "10003"
  partyb:
    build: /Users/chrischabot/Projects/json-cordapp/workflows-java/build/nodes/PartyB
    ports:
    - "10002"
    - "10003"

而且你应该再有一个工作环境

发布
问题

分享
好友

手机
浏览

扫码手机浏览