mirror of
https://github.com/corda/corda.git
synced 2025-06-06 01:11:45 +00:00
Adds a table of contents. Readds Dockerform instructions.
This commit is contained in:
parent
f3f7cfddd6
commit
480b48a050
@ -1,9 +1,11 @@
|
|||||||
Creating nodes locally
|
Creating nodes locally
|
||||||
======================
|
======================
|
||||||
|
|
||||||
|
.. contents::
|
||||||
|
|
||||||
Node structure
|
Node structure
|
||||||
--------------
|
--------------
|
||||||
Each Corda node has the following structure:
|
A Corda node has the following structure:
|
||||||
|
|
||||||
.. sourcecode:: none
|
.. sourcecode:: none
|
||||||
|
|
||||||
@ -101,7 +103,10 @@ in the `Kotlin CorDapp Template <https://github.com/corda/cordapp-template-kotli
|
|||||||
// The notary will offer a validating notary service.
|
// The notary will offer a validating notary service.
|
||||||
notary = [validating : true]
|
notary = [validating : true]
|
||||||
p2pPort 10002
|
p2pPort 10002
|
||||||
rpcPort 10003
|
rpcSettings {
|
||||||
|
port 10003
|
||||||
|
adminPort 10023
|
||||||
|
}
|
||||||
// No webport property, so no webserver will be created.
|
// No webport property, so no webserver will be created.
|
||||||
h2Port 10004
|
h2Port 10004
|
||||||
// Includes the corda-finance CorDapp on our node.
|
// Includes the corda-finance CorDapp on our node.
|
||||||
@ -110,7 +115,10 @@ in the `Kotlin CorDapp Template <https://github.com/corda/cordapp-template-kotli
|
|||||||
node {
|
node {
|
||||||
name "O=PartyA,L=London,C=GB"
|
name "O=PartyA,L=London,C=GB"
|
||||||
p2pPort 10005
|
p2pPort 10005
|
||||||
rpcPort 10006
|
rpcSettings {
|
||||||
|
port 10006
|
||||||
|
adminPort 10026
|
||||||
|
}
|
||||||
webPort 10007
|
webPort 10007
|
||||||
h2Port 10008
|
h2Port 10008
|
||||||
cordapps = ["net.corda:corda-finance:$corda_release_version"]
|
cordapps = ["net.corda:corda-finance:$corda_release_version"]
|
||||||
@ -120,7 +128,10 @@ in the `Kotlin CorDapp Template <https://github.com/corda/cordapp-template-kotli
|
|||||||
node {
|
node {
|
||||||
name "O=PartyB,L=New York,C=US"
|
name "O=PartyB,L=New York,C=US"
|
||||||
p2pPort 10009
|
p2pPort 10009
|
||||||
rpcPort 10010
|
rpcSettings {
|
||||||
|
port 10010
|
||||||
|
adminPort 10030
|
||||||
|
}
|
||||||
webPort 10011
|
webPort 10011
|
||||||
h2Port 10012
|
h2Port 10012
|
||||||
cordapps = ["net.corda:corda-finance:$corda_release_version"]
|
cordapps = ["net.corda:corda-finance:$corda_release_version"]
|
||||||
@ -171,7 +182,7 @@ Following the previous example ``PartyB`` node will have additional configuratio
|
|||||||
}
|
}
|
||||||
|
|
||||||
Specifying a custom webserver
|
Specifying a custom webserver
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
By default, any node listing a webport will use the default development webserver, which is not production-ready. You
|
By default, any node listing a webport will use the default development webserver, which is not production-ready. You
|
||||||
can use your own webserver JAR instead by using the ``webserverJar`` argument in a ``Cordform`` ``node`` configuration
|
can use your own webserver JAR instead by using the ``webserverJar`` argument in a ``Cordform`` ``node`` configuration
|
||||||
block:
|
block:
|
||||||
@ -189,8 +200,72 @@ The webserver JAR will be copied into the node's ``build`` folder with the name
|
|||||||
.. warning:: This is an experimental feature. There is currently no support for reading the webserver's port from the
|
.. warning:: This is an experimental feature. There is currently no support for reading the webserver's port from the
|
||||||
node's ``node.conf`` file.
|
node's ``node.conf`` file.
|
||||||
|
|
||||||
Running deployNodes
|
The Dockerform task
|
||||||
~~~~~~~~~~~~~~~~~~~
|
-------------------
|
||||||
|
|
||||||
|
The ```Dockerform``` is a sister task of ```Cordform```. It has nearly the same syntax and produces very
|
||||||
|
similar results - enhanced by an extra file to enable easy spin up of nodes using ```docker-compose```.
|
||||||
|
Below you can find the example task from the ```IRS Demo<https://github.com/corda/corda/blob/release-V3.0/samples/irs-demo/cordapp/build.gradle#L111>```
|
||||||
|
included in the samples directory of main Corda GitHub repository:
|
||||||
|
|
||||||
|
.. sourcecode:: groovy
|
||||||
|
|
||||||
|
def rpcUsersList = [
|
||||||
|
['username' : "user",
|
||||||
|
'password' : "password",
|
||||||
|
'permissions' : [
|
||||||
|
"StartFlow.net.corda.irs.flows.AutoOfferFlow\$Requester",
|
||||||
|
"StartFlow.net.corda.irs.flows.UpdateBusinessDayFlow\$Broadcast",
|
||||||
|
"StartFlow.net.corda.irs.api.NodeInterestRates\$UploadFixesFlow",
|
||||||
|
"InvokeRpc.vaultQueryBy",
|
||||||
|
"InvokeRpc.networkMapSnapshot",
|
||||||
|
"InvokeRpc.currentNodeTime",
|
||||||
|
"InvokeRpc.wellKnownPartyFromX500Name"
|
||||||
|
]]
|
||||||
|
]
|
||||||
|
|
||||||
|
// (...)
|
||||||
|
|
||||||
|
task prepareDockerNodes(type: net.corda.plugins.Dockerform, dependsOn: ['jar']) {
|
||||||
|
|
||||||
|
node {
|
||||||
|
name "O=Notary Service,L=Zurich,C=CH"
|
||||||
|
notary = [validating : true]
|
||||||
|
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
|
||||||
|
rpcUsers = rpcUsersList
|
||||||
|
useTestClock true
|
||||||
|
}
|
||||||
|
node {
|
||||||
|
name "O=Bank A,L=London,C=GB"
|
||||||
|
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
|
||||||
|
rpcUsers = rpcUsersList
|
||||||
|
useTestClock true
|
||||||
|
}
|
||||||
|
node {
|
||||||
|
name "O=Bank B,L=New York,C=US"
|
||||||
|
cordapps = ["${project(":finance").group}:finance:$corda_release_version"]
|
||||||
|
rpcUsers = rpcUsersList
|
||||||
|
useTestClock true
|
||||||
|
}
|
||||||
|
node {
|
||||||
|
name "O=Regulator,L=Moscow,C=RU"
|
||||||
|
cordapps = ["${project.group}:finance:$corda_release_version"]
|
||||||
|
rpcUsers = rpcUsersList
|
||||||
|
useTestClock true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
There is no need to specify the ports, as every node is a separated container, so no ports conflict will occur.
|
||||||
|
Running the task will create the same folders structure as described in :ref:`The Cordform task` with an additional
|
||||||
|
```Dockerfile`` in each node directory, and ```docker-compose.yml``` in ```build/nodes``` directory. Every node
|
||||||
|
by default exposes port 10003 which is the default one for RPC connections.
|
||||||
|
|
||||||
|
.. warning:: Webserver is not supported by this task!
|
||||||
|
|
||||||
|
.. warning:: Nodes are run without the local shell enabled!
|
||||||
|
|
||||||
|
Running the Cordform/Dockerform tasks
|
||||||
|
-------------------------------------
|
||||||
To create the nodes defined in our ``deployNodes`` task, run the following command in a terminal window from the root
|
To create the nodes defined in our ``deployNodes`` task, run the following command in a terminal window from the root
|
||||||
of the project where the ``deployNodes`` task is defined:
|
of the project where the ``deployNodes`` task is defined:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user