From a5ca027d545e0852ec1bc0c7dfaa5e2b5578cc31 Mon Sep 17 00:00:00 2001 From: Ross Nicoll Date: Wed, 13 Dec 2017 09:54:34 +0000 Subject: [PATCH] Clean up HSM launch (#177) * Add basedir to HSM configuration * Add run instructions to the Readme.md * Correct help messsage display for HSM Doorman --- network-management/Readme.md | 17 ++++++++++++----- network-management/hsm.conf | 3 ++- .../com/r3/corda/networkmanage/hsm/Main.kt | 8 +++++++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/network-management/Readme.md b/network-management/Readme.md index 8e730781c3..29ca9b2074 100644 --- a/network-management/Readme.md +++ b/network-management/Readme.md @@ -2,27 +2,34 @@ # Building the binaries ## Network management server -To build a fat jar containing all the doorman code you can simply invoke +To build a fat jar containing all the doorman code you can simply invoke: ``` ./gradlew network-management:capsule:buildDoormanJAR ``` -The built file will appear in +The built file will appear in: ``` network-management/capsule/build/libs/doorman-.jar ``` ## HSM signing server -To build a fat jar containing all the HSM signer code you can simply invoke +To build a fat jar containing all the HSM signer code you can simply invoke: ``` ./gradlew network-management:capsule-hsm:buildHsmJAR ``` -The built file will appear in +The built file will appear in: ``` network-management/capsule-hsm/build/libs/hsm-.jar ``` -The binaries can also be obtained from artifactory after deployment in teamcity +The binaries can also be obtained from artifactory after deployment in TeamCity. + +To run the HSM signing server: + +``` +cd network-management +java -jar capsule-hsm/build/libs/hsm-3.0-NETWORKMAP-20171204.134345-6-capsule.jar --configFile hsm.conf +``` #Configuring network management service ### Local signing diff --git a/network-management/hsm.conf b/network-management/hsm.conf index 80d9042e17..f20f794dfe 100644 --- a/network-management/hsm.conf +++ b/network-management/hsm.conf @@ -1,3 +1,4 @@ +basedir = "." device = "3001@127.0.0.1" keyGroup = "DEV.DOORMAN" keySpecifier = -1 @@ -22,4 +23,4 @@ dataSourceProperties { "dataSource.url" = "jdbc:h2:file:"${basedir}"/persistence;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=10000;WRITE_DELAY=0;AUTO_SERVER_PORT="${h2port} "dataSource.user" = sa "dataSource.password" = "" -} \ No newline at end of file +} diff --git a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/Main.kt b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/Main.kt index e148e2007c..b9c27588fb 100644 --- a/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/Main.kt +++ b/network-management/src/main/kotlin/com/r3/corda/networkmanage/hsm/Main.kt @@ -2,6 +2,7 @@ package com.r3.corda.networkmanage.hsm import com.r3.corda.networkmanage.common.persistence.PersistentNetworkMapStorage import com.r3.corda.networkmanage.common.persistence.configureDatabase +import com.r3.corda.networkmanage.common.utils.ShowHelpException import com.r3.corda.networkmanage.hsm.authentication.AuthMode import com.r3.corda.networkmanage.hsm.authentication.Authenticator import com.r3.corda.networkmanage.hsm.authentication.createProvider @@ -20,7 +21,12 @@ import java.security.Security fun main(args: Array) { - run(parseParameters(*args)) + try { + run(parseParameters(*args)) + } catch (e: ShowHelpException) { + e.errorMessage?.let(::println) + e.parser.printHelpOn(System.out) + } } fun run(parameters: Parameters) {