mirror of
https://github.com/corda/corda.git
synced 2025-04-07 19:34:41 +00:00
Allows the webserver JAR used by each node in deployNodes to be configured.
This commit is contained in:
parent
ad7b84b5a8
commit
3f3e0e9973
@ -183,6 +183,9 @@ UNRELEASED
|
||||
* Marked ``stateMachine`` on ``FlowLogic`` as ``CordaInternal`` to make clear that is it not part of the public api and is
|
||||
only for internal use
|
||||
|
||||
* Provided experimental support for specifying your own webserver to be used instead of the default development
|
||||
webserver in ``Cordform`` using the ``webserverJar`` argument
|
||||
|
||||
* Created new ``StartedMockNode`` and ``UnstartedMockNode`` classes which are wrappers around our MockNode implementation
|
||||
that expose relevant methods for testing without exposing internals, create these using a ``MockNetwork``.
|
||||
|
||||
|
@ -137,6 +137,25 @@ 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!
|
||||
|
||||
Specifying a custom webserver
|
||||
-----------------------------
|
||||
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
|
||||
block:
|
||||
|
||||
.. sourcecode:: groovy
|
||||
|
||||
node {
|
||||
name "O=PartyA,L=New York,C=US"
|
||||
webPort 10005
|
||||
webserverJar "lib/my_webserver.jar"
|
||||
}
|
||||
|
||||
The webserver JAR will be copied into the node's ``build`` folder with the name ``corda-webserver.jar``.
|
||||
|
||||
.. warning:: This is an experimental feature. There is currently no support for reading the webserver's port from the
|
||||
node's ``node.conf`` file.
|
||||
|
||||
Running deployNodes
|
||||
-------------------
|
||||
To create the nodes defined in our ``deployNodes`` task, run the following command in a terminal window from the root
|
||||
|
@ -38,9 +38,10 @@ class Node(private val project: Project) : CordformNode() {
|
||||
private set
|
||||
internal lateinit var containerName: String
|
||||
private set
|
||||
|
||||
internal var rpcSettings: RpcSettings = RpcSettings()
|
||||
private set
|
||||
internal var webserverJar: String? = null
|
||||
private set
|
||||
|
||||
/**
|
||||
* Sets whether this node will use HTTPS communication.
|
||||
@ -79,6 +80,17 @@ class Node(private val project: Project) : CordformNode() {
|
||||
config = config.withValue("sshd.port", ConfigValueFactory.fromAnyRef(sshdPort))
|
||||
}
|
||||
|
||||
/**
|
||||
* The webserver JAR to be used by this node.
|
||||
*
|
||||
* If not provided, the default development webserver is used.
|
||||
*
|
||||
* @param webserverJar The file path of the webserver JAR to use.
|
||||
*/
|
||||
fun webserverJar(webserverJar: String) {
|
||||
this.webserverJar = webserverJar
|
||||
}
|
||||
|
||||
internal fun build() {
|
||||
if (config.hasPath("webAddress")) {
|
||||
installWebserverJar()
|
||||
@ -130,7 +142,15 @@ class Node(private val project: Project) : CordformNode() {
|
||||
* Installs the corda webserver JAR to the node directory
|
||||
*/
|
||||
private fun installWebserverJar() {
|
||||
val webJar = Cordformation.verifyAndGetRuntimeJar(project, "corda-webserver")
|
||||
// If no webserver JAR is provided, the default development webserver is used.
|
||||
val webJar = if (webserverJar == null) {
|
||||
project.logger.info("Using default development webserver.")
|
||||
Cordformation.verifyAndGetRuntimeJar(project, "corda-webserver")
|
||||
} else {
|
||||
project.logger.info("Using custom webserver: $webserverJar.")
|
||||
File(webserverJar)
|
||||
}
|
||||
|
||||
project.copy {
|
||||
it.apply {
|
||||
from(webJar)
|
||||
|
Loading…
x
Reference in New Issue
Block a user