diff --git a/build.gradle b/build.gradle index f8a21b7789..31740da52f 100644 --- a/build.gradle +++ b/build.gradle @@ -231,7 +231,6 @@ tasks.withType(Test) { task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" - networkMap "O=Controller,OU=corda,L=London,C=GB" node { name "O=Controller,OU=corda,L=London,C=GB" notary = [validating : true] diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 7f1e76f915..9f989db79a 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -12,8 +12,8 @@ UNRELEASED deploys nodes for development and testing, the latter turns a project into a cordapp project that generates JARs in the standard CorDapp format. -* ``Cordform`` and node identity generation - * Cordform may not specify a value for ``NetworkMap``, when that happens, during the task execution the following happens: +* ``Cordform`` and node identity generation: + * Removed the parameter ``NetworkMap`` from Cordform. Now at the end of the deployment the following happens: 1. Each node is started and its signed serialized NodeInfo is written to disk in the node base directory. 2. Every serialized ``NodeInfo`` above is copied in every other node "additional-node-info" folder under the NodeInfo folder. diff --git a/docs/source/deploying-a-node.rst b/docs/source/deploying-a-node.rst index 4457b7d38c..4125947fd8 100644 --- a/docs/source/deploying-a-node.rst +++ b/docs/source/deploying-a-node.rst @@ -11,13 +11,12 @@ Cordform is the local node deployment system for CorDapps. The nodes generated a debugging, and testing node configurations, but not for production or testnet deployment. Here is an example Gradle task called ``deployNodes`` that uses the Cordform plugin to deploy three nodes, plus a -notary/network map node: +notary node: .. sourcecode:: groovy task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" - networkMap "O=Controller,OU=corda,L=London,C=UK" node { name "O=Controller,OU=corda,L=London,C=UK" notary = [validating : true] @@ -52,9 +51,7 @@ notary/network map node: } } -You can extend ``deployNodes`` to generate any number of nodes you like. The only requirement is that you must specify -one node as running the network map service, by putting their name in the ``networkMap`` field. In our example, the -``Controller`` is set as the network map service. +You can extend ``deployNodes`` to generate any number of nodes you like. .. warning:: When adding nodes, make sure that there are no port clashes! @@ -85,9 +82,14 @@ run all the nodes at once. Each node in the ``nodes`` folder has the following s .. sourcecode:: none . nodeName - ├── corda.jar // The Corda runtime - ├── node.conf // The node's configuration - └── plugins // Any installed CorDapps + ├── corda.jar // The Corda runtime + ├── node.conf // The node's configuration + ├── plugins // Any installed CorDapps + └── additional-node-infos // Directory containing all the addresses and certificates of the other nodes. + +.. note:: During the build process each node generates a NodeInfo file which is written in its own root directory, +the plug-in proceeds and copies each node NodeInfo to every other node ``additional-node-infos`` directory. +The NodeInfo file contains a node hostname and port, legal name and security certificate. .. note:: Outside of development environments, do not store your node directories in the build folder. diff --git a/docs/source/example-code/build.gradle b/docs/source/example-code/build.gradle index a3ea77f4d8..0568552add 100644 --- a/docs/source/example-code/build.gradle +++ b/docs/source/example-code/build.gradle @@ -73,7 +73,6 @@ task integrationTest(type: Test) { task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" - networkMap "O=Notary Service,OU=corda,L=London,C=GB" node { name "O=Notary Service,OU=corda,L=London,C=GB" notary = [validating : true] diff --git a/docs/source/hello-world-running.rst b/docs/source/hello-world-running.rst index ae1592fa82..b5bf916e18 100644 --- a/docs/source/hello-world-running.rst +++ b/docs/source/hello-world-running.rst @@ -25,7 +25,6 @@ Let's take a look at the nodes we're going to deploy. Open the project's ``build task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" - networkMap "O=Controller,L=London,C=GB" node { name "O=Controller,L=London,C=GB" notary = [validating : true] @@ -82,6 +81,7 @@ the three node folders. Each node folder has the following structure: |____corda-webserver.jar // The node's webserver |____dependencies |____node.conf // The node's configuration file + |____additional-node-infos/ // Directory containing all the other nodes' addresses and identities |____plugins |____java/kotlin-source-0.1.jar // Our IOU CorDapp diff --git a/docs/source/tutorial-cordapp.rst b/docs/source/tutorial-cordapp.rst index ed203a66e5..c61e20f4be 100644 --- a/docs/source/tutorial-cordapp.rst +++ b/docs/source/tutorial-cordapp.rst @@ -17,7 +17,7 @@ if: We will deploy the CorDapp on 4 test nodes: -* **Controller**, which hosts the network map service and a validating notary service +* **Controller**, which hosts a validating notary service * **PartyA** * **PartyB** * **PartyC** @@ -276,7 +276,7 @@ IntelliJ The node driver defined in ``/src/test/kotlin/com/example/Main.kt`` allows you to specify how many nodes you would like to run and the configuration settings for each node. For the example CorDapp, the driver starts up four nodes - and adds an RPC user for all but the "Controller" node (which serves as the notary and network map service): + and adds an RPC user for all but the "Controller" node (which serves as the notary): .. sourcecode:: kotlin @@ -489,9 +489,6 @@ You must now edit the configuration file for each node, including the controller and make the following changes: * Change the Artemis messaging address to the machine's IP address (e.g. ``p2pAddress="10.18.0.166:10006"``) -* Change the network map service's address to the IP address of the machine where the controller node is running - (e.g. ``networkMapService { address="10.18.0.166:10002" legalName="O=Controller,L=London,C=GB" ``). The controller - will not have the ``networkMapService`` configuration entry After starting each node, the nodes will be able to see one another and agree IOUs among themselves. diff --git a/gradle-plugins/cordform-common/src/main/java/net/corda/cordform/CordformDefinition.java b/gradle-plugins/cordform-common/src/main/java/net/corda/cordform/CordformDefinition.java index 51d44def93..047d7e6289 100644 --- a/gradle-plugins/cordform-common/src/main/java/net/corda/cordform/CordformDefinition.java +++ b/gradle-plugins/cordform-common/src/main/java/net/corda/cordform/CordformDefinition.java @@ -7,11 +7,9 @@ import java.util.function.Consumer; public abstract class CordformDefinition { public final Path driverDirectory; public final ArrayList> nodeConfigurers = new ArrayList<>(); - public final String networkMapNodeName; - public CordformDefinition(Path driverDirectory, String networkMapNodeName) { + public CordformDefinition(Path driverDirectory) { this.driverDirectory = driverDirectory; - this.networkMapNodeName = networkMapNodeName; } public void addNode(Consumer configurer) { diff --git a/gradle-plugins/cordformation/src/main/groovy/net/corda/plugins/Cordform.groovy b/gradle-plugins/cordformation/src/main/groovy/net/corda/plugins/Cordform.groovy index 7bfd9e0f0d..7baf20a45a 100644 --- a/gradle-plugins/cordformation/src/main/groovy/net/corda/plugins/Cordform.groovy +++ b/gradle-plugins/cordformation/src/main/groovy/net/corda/plugins/Cordform.groovy @@ -3,9 +3,7 @@ package net.corda.plugins import static org.gradle.api.tasks.SourceSet.MAIN_SOURCE_SET_NAME import net.corda.cordform.CordformContext import net.corda.cordform.CordformDefinition -import net.corda.cordform.CordformNode import org.apache.tools.ant.filters.FixCrLfFilter -import org.bouncycastle.asn1.x500.X500Name import org.gradle.api.DefaultTask import org.gradle.api.plugins.JavaPluginConvention import org.gradle.api.tasks.TaskAction @@ -24,7 +22,6 @@ class Cordform extends DefaultTask { String definitionClass protected def directory = Paths.get("build", "nodes") private def nodes = new ArrayList() - protected String networkMapNodeName /** * Set the directory to install nodes into. @@ -36,16 +33,6 @@ class Cordform extends DefaultTask { this.directory = Paths.get(directory) } - /** - * Set the network map node. - * - * @warning Ensure the node name is one of the configured nodes. - * @param nodeName The name of the node that will host the network map. - */ - void networkMap(String nodeName) { - networkMapNodeName = nodeName - } - /** * Add a node configuration. * @@ -110,12 +97,15 @@ class Cordform extends DefaultTask { */ @TaskAction void build() { - String networkMapNodeName = initializeConfigurationAndGetNetworkMapNodeName() + initializeConfiguration() installRunScript() - finalizeConfiguration(networkMapNodeName) + nodes.each { + it.build() + } + generateNodeInfos() } - private initializeConfigurationAndGetNetworkMapNodeName() { + private initializeConfiguration() { if (null != definitionClass) { def cd = loadCordformDefinition() cd.nodeConfigurers.each { nc -> @@ -129,30 +119,10 @@ class Cordform extends DefaultTask { project.projectDir.toPath().resolve(getNodeByName(nodeName).nodeDir.toPath()) } } - return cd.networkMapNodeName.toString() } else { nodes.each { it.rootDir directory } - return this.networkMapNodeName - } - } - - private finalizeConfiguration(String networkMapNodeName) { - Node networkMapNode = getNodeByName(networkMapNodeName) - if (networkMapNode == null) { - nodes.each { - it.build() - } - generateNodeInfos() - logger.info("Starting without networkMapNode, this an experimental feature") - } else { - nodes.each { - if (it != networkMapNode) { - it.networkMapAddress(networkMapNode.getP2PAddress(), networkMapNodeName) - } - it.build() - } } } diff --git a/samples/attachment-demo/build.gradle b/samples/attachment-demo/build.gradle index c331834529..b977d45ffb 100644 --- a/samples/attachment-demo/build.gradle +++ b/samples/attachment-demo/build.gradle @@ -38,7 +38,6 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { ext.rpcUsers = [['username': "demo", 'password': "demo", 'permissions': ["StartFlow.net.corda.attachmentdemo.AttachmentDemoFlow"]]] directory "./build/nodes" - networkMap "O=Notary Service,L=Zurich,C=CH" node { name "O=Notary Service,L=Zurich,C=CH" notary = [validating : true] diff --git a/samples/bank-of-corda-demo/build.gradle b/samples/bank-of-corda-demo/build.gradle index da04426168..be0c49807d 100644 --- a/samples/bank-of-corda-demo/build.gradle +++ b/samples/bank-of-corda-demo/build.gradle @@ -50,8 +50,6 @@ dependencies { task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" // This name "Notary" is hard-coded into BankOfCordaClientApi so if you change it here, change it there too. - // In this demo the node that runs a standalone notary also acts as the network map server. - networkMap "O=Notary Service,L=Zurich,C=CH" node { name "O=Notary Service,L=Zurich,C=CH" notary = [validating : true] diff --git a/samples/irs-demo/build.gradle b/samples/irs-demo/build.gradle index 2341793e1f..abbfaf3772 100644 --- a/samples/irs-demo/build.gradle +++ b/samples/irs-demo/build.gradle @@ -51,7 +51,6 @@ dependencies { task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) { directory "./build/nodes" - networkMap "O=Notary Service,L=Zurich,C=CH" node { name "O=Notary Service,L=Zurich,C=CH" notary = [validating : true] diff --git a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/BFTNotaryCordform.kt b/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/BFTNotaryCordform.kt index 477adecd20..92669b5714 100644 --- a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/BFTNotaryCordform.kt +++ b/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/BFTNotaryCordform.kt @@ -13,7 +13,11 @@ import net.corda.node.services.transactions.minCorrectReplicas import net.corda.node.utilities.ServiceIdentityGenerator import net.corda.testing.ALICE import net.corda.testing.BOB -import net.corda.testing.internal.demorun.* +import net.corda.testing.internal.demorun.name +import net.corda.testing.internal.demorun.node +import net.corda.testing.internal.demorun.notary +import net.corda.testing.internal.demorun.rpcUsers +import net.corda.testing.internal.demorun.runNodes fun main(args: Array) = BFTNotaryCordform.runNodes() @@ -22,7 +26,7 @@ private val notaryNames = createNotaryNames(clusterSize) // This is not the intended final design for how to use CordformDefinition, please treat this as experimental and DO // NOT use this as a design to copy. -object BFTNotaryCordform : CordformDefinition("build" / "notary-demo-nodes", notaryNames[0].toString()) { +object BFTNotaryCordform : CordformDefinition("build" / "notary-demo-nodes") { private val clusterName = CordaX500Name(BFTNonValidatingNotaryService.id, "BFT", "Zurich", "CH") init { diff --git a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/RaftNotaryCordform.kt b/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/RaftNotaryCordform.kt index 1d78c51266..198867dcf1 100644 --- a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/RaftNotaryCordform.kt +++ b/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/RaftNotaryCordform.kt @@ -22,7 +22,7 @@ private val notaryNames = createNotaryNames(3) // This is not the intended final design for how to use CordformDefinition, please treat this as experimental and DO // NOT use this as a design to copy. -object RaftNotaryCordform : CordformDefinition("build" / "notary-demo-nodes", notaryNames[0].toString()) { +object RaftNotaryCordform : CordformDefinition("build" / "notary-demo-nodes") { private val clusterName = CordaX500Name(RaftValidatingNotaryService.id, "Raft", "Zurich", "CH") init { diff --git a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/SingleNotaryCordform.kt b/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/SingleNotaryCordform.kt index beec66a8fc..22cc63540d 100644 --- a/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/SingleNotaryCordform.kt +++ b/samples/notary-demo/src/main/kotlin/net/corda/notarydemo/SingleNotaryCordform.kt @@ -11,7 +11,11 @@ import net.corda.notarydemo.flows.RPCStartableNotaryFlowClient import net.corda.testing.ALICE import net.corda.testing.BOB import net.corda.testing.DUMMY_NOTARY -import net.corda.testing.internal.demorun.* +import net.corda.testing.internal.demorun.name +import net.corda.testing.internal.demorun.node +import net.corda.testing.internal.demorun.notary +import net.corda.testing.internal.demorun.rpcUsers +import net.corda.testing.internal.demorun.runNodes fun main(args: Array) = SingleNotaryCordform.runNodes() @@ -19,7 +23,7 @@ val notaryDemoUser = User("demou", "demop", setOf(startFlowPermission