CORDA-1047 - Dockerform documentation (#2544)

* Comments update

* Links fix

* Grammar
This commit is contained in:
Maksymilian Pawlak 2018-02-22 17:52:21 +00:00 committed by Katelyn Baker
parent 659d6c03ef
commit 835c357a0b

View File

@ -71,7 +71,7 @@ The Cordform task
----------------- -----------------
Corda provides a gradle plugin called ``Cordform`` that allows you to automatically generate and configure a set of Corda provides a gradle plugin called ``Cordform`` that allows you to automatically generate and configure a set of
nodes. Here is an example ``Cordform`` task called ``deployNodes`` that creates three nodes, defined in the nodes. Here is an example ``Cordform`` task called ``deployNodes`` that creates three nodes, defined in the
`Kotlin CorDapp Template <https://github.com/corda/cordapp-template-kotlin/blob/release-V2/build.gradle#L97>`_: `Kotlin CorDapp Template <https://github.com/corda/cordapp-template-kotlin/blob/release-V3/build.gradle#L100>`_:
.. sourcecode:: groovy .. sourcecode:: groovy
@ -83,7 +83,10 @@ nodes. Here is an example ``Cordform`` task called ``deployNodes`` that creates
// 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.
@ -92,7 +95,10 @@ nodes. Here is an example ``Cordform`` task called ``deployNodes`` that creates
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"]
@ -102,7 +108,10 @@ nodes. Here is an example ``Cordform`` task called ``deployNodes`` that creates
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"]
@ -137,6 +146,71 @@ a single node to run the network map service, by putting its name in the ``netwo
.. warning:: When adding nodes, make sure that there are no port clashes! .. warning:: When adding nodes, make sure that there are no port clashes!
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 deployNodes Running deployNodes
------------------- -------------------
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