mirror of
https://github.com/corda/corda.git
synced 2025-02-20 17:33:15 +00:00
Webserver is now deployed as a capsule.
This commit is contained in:
parent
8414c97a61
commit
75ff04d5a7
@ -10,7 +10,7 @@ import java.nio.file.Files
|
||||
*/
|
||||
class Node {
|
||||
static final String JAR_NAME = 'corda.jar'
|
||||
static final String WAR_NAME = 'corda-webserver.war'
|
||||
static final String WEBJAR_NAME = 'corda-webserver.jar'
|
||||
static final String DEFAULT_HOST = 'localhost'
|
||||
|
||||
/**
|
||||
@ -110,7 +110,7 @@ class Node {
|
||||
/**
|
||||
* Set the network map address for this node.
|
||||
*
|
||||
* @warning This should not be directly set unless you know what you are doing. Use the networkMapName in the
|
||||
* @jarning This should not be directly set unless you know what you are doing. Use the networkMapName in the
|
||||
* Cordform task instead.
|
||||
* @param networkMapAddress Network map node address.
|
||||
* @param networkMapLegalName Network map node legal name.
|
||||
@ -130,7 +130,7 @@ class Node {
|
||||
nodeDir = new File(rootDir, name.replaceAll("\\s",""))
|
||||
configureRpcUsers()
|
||||
installCordaJar()
|
||||
installWebserverWar()
|
||||
installWebserverJar()
|
||||
installBuiltPlugin()
|
||||
installCordapps()
|
||||
installDependencies()
|
||||
@ -166,14 +166,14 @@ class Node {
|
||||
}
|
||||
|
||||
/**
|
||||
* Installs the corda webserver WAR to the node directory
|
||||
* Installs the corda webserver JAR to the node directory
|
||||
*/
|
||||
private void installWebserverWar() {
|
||||
def webWar = verifyAndGetWebserverWar()
|
||||
private void installWebserverJar() {
|
||||
def webJar = verifyAndGetWebserverJar()
|
||||
project.copy {
|
||||
from webWar
|
||||
from webJar
|
||||
into nodeDir
|
||||
rename webWar.name, WAR_NAME
|
||||
rename webJar.name, WEBJAR_NAME
|
||||
}
|
||||
}
|
||||
|
||||
@ -205,10 +205,11 @@ class Node {
|
||||
*/
|
||||
private void installDependencies() {
|
||||
def cordaJar = verifyAndGetCordaJar()
|
||||
def webJar = verifyAndGetWebserverJar()
|
||||
def depsDir = new File(nodeDir, "dependencies")
|
||||
def coreDeps = project.zipTree(cordaJar).getFiles().collect { it.getName() }
|
||||
def appDeps = project.configurations.runtime.filter {
|
||||
it != cordaJar && !project.configurations.cordapp.contains(it) && !coreDeps.contains(it.getName())
|
||||
(it != cordaJar) && (it != webJar) && !project.configurations.cordapp.contains(it) && !coreDeps.contains(it.getName())
|
||||
}
|
||||
project.copy {
|
||||
from appDeps
|
||||
@ -257,20 +258,20 @@ class Node {
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the corda WAR amongst the dependencies
|
||||
* Find the corda JAR amongst the dependencies
|
||||
*
|
||||
* @return A file representing the Corda webserver WAR
|
||||
* @return A file representing the Corda webserver JAR
|
||||
*/
|
||||
private File verifyAndGetWebserverWar() {
|
||||
def maybeWar = project.configurations.runtime.filter {
|
||||
it.toString().contains("corda-webserver-${project.corda_version}.war")
|
||||
private File verifyAndGetWebserverJar() {
|
||||
def maybeJar = project.configurations.runtime.filter {
|
||||
it.toString().contains("corda-webserver-${project.corda_version}.jar")
|
||||
}
|
||||
if (maybeWar.size() == 0) {
|
||||
throw new RuntimeException("No Corda Webserver WAR found. Have you deployed the Corda project to Maven? Looked for \"corda-webserver-${project.corda_version}.war\"")
|
||||
if (maybeJar.size() == 0) {
|
||||
throw new RuntimeException("No Corda Webserver JAR found. Have you deployed the Corda project to Maven? Looked for \"corda-webserver-${project.corda_version}.jar\"")
|
||||
} else {
|
||||
def war = maybeWar.getSingleFile()
|
||||
assert(war.isFile())
|
||||
return war
|
||||
def jar = maybeJar.getSingleFile()
|
||||
assert(jar.isFile())
|
||||
return jar
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import net.corda.core.div
|
||||
import org.assertj.core.api.Assertions.assertThat
|
||||
import org.assertj.core.api.Assertions.assertThatExceptionOfType
|
||||
import org.junit.Test
|
||||
import org.slf4j.event.Level
|
||||
import java.nio.file.Paths
|
||||
|
||||
class ArgsParserTest {
|
||||
|
@ -1,7 +1,7 @@
|
||||
apply plugin: 'kotlin'
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'war'
|
||||
apply plugin: 'net.corda.plugins.publish-utils'
|
||||
apply plugin: 'us.kirchmeier.capsule'
|
||||
|
||||
description 'Corda webserver module'
|
||||
|
||||
@ -77,16 +77,38 @@ task integrationTest(type: Test) {
|
||||
|
||||
publish {
|
||||
name = 'corda-webserver'
|
||||
publishWar = true
|
||||
publishWar = false // TODO: Use WAR instead of JAR
|
||||
}
|
||||
|
||||
war {
|
||||
baseName = 'corda-webserver'
|
||||
task buildWebserverJar(type: FatCapsule) {
|
||||
applicationClass 'net.corda.webserver.WebServer'
|
||||
archiveName "corda-webserver-${corda_version}.jar"
|
||||
applicationSource = files(project.tasks.findByName('jar'), '../build/classes/main/CordaCaplet.class', 'config/dev/log4j2.xml')
|
||||
from 'NOTICE' // Copy CDDL notice
|
||||
|
||||
capsuleManifest {
|
||||
applicationVersion = corda_version
|
||||
javaAgents = ["quasar-core-${quasar_version}-jdk8.jar"]
|
||||
systemProperties['visualvm.display.name'] = 'Corda Webserver'
|
||||
systemProperties['corda.version'] = corda_version
|
||||
minJavaVersion = '1.8.0'
|
||||
// This version is known to work and avoids earlier 8u versions that have bugs.
|
||||
minUpdateVersion['1.8'] = '102'
|
||||
caplets = ['CordaCaplet']
|
||||
|
||||
// JVM configuration:
|
||||
// - Constrain to small heap sizes to ease development on low end devices.
|
||||
// - Switch to the G1 GC which is going to be the default in Java 9 and gives low pause times/string dedup.
|
||||
//
|
||||
// If you change these flags, please also update Driver.kt
|
||||
jvmArgs = ['-Xmx200m', '-XX:+UseG1GC']
|
||||
}
|
||||
|
||||
manifest {
|
||||
attributes('Corda-Version': corda_version)
|
||||
}
|
||||
}
|
||||
|
||||
artifacts {
|
||||
runtimeArtifacts war
|
||||
runtimeArtifacts buildWebserverJar
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user