Skip to content

Commit

Permalink
Merge branch 'release/os/5.1' into CORE-12411-add-declination-reason
Browse files Browse the repository at this point in the history
  • Loading branch information
dimosr committed Sep 26, 2023
2 parents 4673836 + 0654e5b commit 09e9a71
Show file tree
Hide file tree
Showing 71 changed files with 1,260 additions and 853 deletions.
1 change: 1 addition & 0 deletions applications/workers/release/combined-worker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ dependencies {
implementation project(':libs:crypto:crypto-config-impl')
implementation project(':libs:crypto:crypto-core')
implementation project(':libs:crypto:crypto-impl')
implementation project(":libs:lifecycle:registry")
implementation project(':libs:platform-info')
implementation project(':libs:tracing')
implementation project(':libs:web:web')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ import net.corda.application.dbsetup.PostgresDbSetup
import net.corda.applications.workers.workercommon.ApplicationBanner
import net.corda.applications.workers.workercommon.BusType
import net.corda.applications.workers.workercommon.DefaultWorkerParams
import net.corda.applications.workers.workercommon.Health
import net.corda.applications.workers.workercommon.JavaSerialisationFilter
import net.corda.applications.workers.workercommon.Metrics
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.createConfigFromParams
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.getBootstrapConfig
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.getParams
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.loggerStartupInfo
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.printHelpOrVersion
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.setupMonitor
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.setupWebserver
import net.corda.applications.workers.workercommon.WorkerMonitor
import net.corda.crypto.config.impl.createCryptoBootstrapParamsMap
import net.corda.crypto.core.CryptoConsts.SOFT_HSM_ID
import net.corda.libs.configuration.secret.SecretsServiceFactoryResolver
import net.corda.libs.configuration.validation.ConfigurationValidatorFactory
import net.corda.libs.platform.PlatformInfoProvider
import net.corda.lifecycle.registry.LifecycleRegistry
import net.corda.osgi.api.Application
import net.corda.osgi.api.Shutdown
import net.corda.processors.crypto.CryptoProcessor
Expand Down Expand Up @@ -94,8 +94,8 @@ class CombinedWorker @Activate constructor(
private val gatewayProcessor: GatewayProcessor,
@Reference(service = Shutdown::class)
private val shutDownService: Shutdown,
@Reference(service = WorkerMonitor::class)
private val workerMonitor: WorkerMonitor,
@Reference(service = LifecycleRegistry::class)
private val lifecycleRegistry: LifecycleRegistry,
@Reference(service = WebServer::class)
private val webServer: WebServer,
@Reference(service = ConfigurationValidatorFactory::class)
Expand Down Expand Up @@ -193,15 +193,15 @@ class CombinedWorker @Activate constructor(
config.factory,
).run()

webServer.setupWebserver(params.defaultParams)
setupMonitor(workerMonitor, params.defaultParams, this.javaClass.simpleName)

Metrics.configure(webServer, this.javaClass.simpleName)
Health.configure(webServer, lifecycleRegistry)
configureTracing("Combined Worker", params.defaultParams.zipkinTraceUrl, params.defaultParams.traceSamplesPerSecond)

JavaSerialisationFilter.install()

logger.info("CONFIG = $config")

webServer.start(params.defaultParams.workerServerPort)
cryptoProcessor.start(config)
dbProcessor.start(config)
persistenceProcessor.start(config)
Expand Down
1 change: 1 addition & 0 deletions applications/workers/release/crypto-worker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ dependencies {
implementation project(':libs:configuration:configuration-validation')
implementation project(':libs:crypto:cipher-suite-impl')
implementation project(':libs:crypto:crypto-config-impl')
implementation project(":libs:lifecycle:registry")
implementation project(':libs:platform-info')
implementation project(':libs:tracing')
implementation project(':libs:web:web')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ package net.corda.applications.workers.crypto

import net.corda.applications.workers.workercommon.ApplicationBanner
import net.corda.applications.workers.workercommon.DefaultWorkerParams
import net.corda.applications.workers.workercommon.Health
import net.corda.applications.workers.workercommon.JavaSerialisationFilter
import net.corda.applications.workers.workercommon.Metrics
import net.corda.applications.workers.workercommon.WorkerHelpers
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.getBootstrapConfig
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.getParams
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.loggerStartupInfo
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.printHelpOrVersion
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.setupMonitor
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.setupWebserver
import net.corda.applications.workers.workercommon.WorkerMonitor
import net.corda.crypto.config.impl.createCryptoBootstrapParamsMap
import net.corda.libs.configuration.SmartConfig
import net.corda.libs.configuration.secret.SecretsServiceFactoryResolver
import net.corda.libs.configuration.validation.ConfigurationValidatorFactory
import net.corda.libs.platform.PlatformInfoProvider
import net.corda.lifecycle.registry.LifecycleRegistry
import net.corda.osgi.api.Application
import net.corda.osgi.api.Shutdown
import net.corda.processors.crypto.CryptoProcessor
Expand All @@ -39,8 +39,8 @@ class CryptoWorker @Activate constructor(
private val processor: CryptoProcessor,
@Reference(service = Shutdown::class)
private val shutDownService: Shutdown,
@Reference(service = WorkerMonitor::class)
private val workerMonitor: WorkerMonitor,
@Reference(service = LifecycleRegistry::class)
private val lifecycleRegistry: LifecycleRegistry,
@Reference(service = WebServer::class)
private val webServer: WebServer,
@Reference(service = ConfigurationValidatorFactory::class)
Expand All @@ -65,17 +65,17 @@ class CryptoWorker @Activate constructor(

JavaSerialisationFilter.install()
val params = getParams(args, CryptoWorkerParams())
webServer.setupWebserver(params.defaultParams)
if (printHelpOrVersion(params.defaultParams, CryptoWorker::class.java, shutDownService)) {
return
}
if (params.hsmId.isBlank()) {
throw IllegalStateException("Please specify which HSM the worker must handle, like --hsm-id SOFT")
}
setupMonitor(workerMonitor, params.defaultParams, this.javaClass.simpleName)
Metrics.configure(webServer, this.javaClass.simpleName)
Health.configure(webServer, lifecycleRegistry)

configureTracing("Crypto Worker", params.defaultParams.zipkinTraceUrl, params.defaultParams.traceSamplesPerSecond)

webServer.start(params.defaultParams.workerServerPort)
processor.start(
buildBoostrapConfig(params, configurationValidatorFactory)
)
Expand Down
2 changes: 2 additions & 0 deletions applications/workers/release/db-worker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies {
implementation project(":components:security-manager")
implementation project(':libs:configuration:configuration-core')
implementation project(':libs:configuration:configuration-validation')
implementation project(":libs:lifecycle:registry")
implementation project(':libs:platform-info')
implementation project(':libs:tracing')
implementation project(':libs:messaging:messaging')
Expand Down Expand Up @@ -48,6 +49,7 @@ dependencies {
testImplementation "org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion"
testImplementation project(':libs:application:addon')
testImplementation project(':libs:application:banner')
testImplementation project(":libs:lifecycle:lifecycle")

runtimeOnly("org.apache.felix:org.apache.felix.framework.security:$felixSecurityVersion") {
exclude group: 'org.apache.felix'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ package net.corda.applications.workers.db

import net.corda.applications.workers.workercommon.ApplicationBanner
import net.corda.applications.workers.workercommon.DefaultWorkerParams
import net.corda.applications.workers.workercommon.Health
import net.corda.applications.workers.workercommon.JavaSerialisationFilter
import net.corda.applications.workers.workercommon.Metrics
import net.corda.applications.workers.workercommon.WorkerHelpers
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.getBootstrapConfig
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.getParams
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.loggerStartupInfo
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.printHelpOrVersion
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.setupMonitor
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.setupWebserver
import net.corda.applications.workers.workercommon.WorkerMonitor
import net.corda.libs.configuration.secret.SecretsServiceFactoryResolver
import net.corda.libs.configuration.validation.ConfigurationValidatorFactory
import net.corda.libs.platform.PlatformInfoProvider
import net.corda.lifecycle.registry.LifecycleRegistry
import net.corda.osgi.api.Application
import net.corda.osgi.api.Shutdown
import net.corda.processors.db.DBProcessor
Expand Down Expand Up @@ -42,8 +42,8 @@ class DBWorker @Activate constructor(
private val schedulerProcessor: SchedulerProcessor,
@Reference(service = Shutdown::class)
private val shutDownService: Shutdown,
@Reference(service = WorkerMonitor::class)
private val workerMonitor: WorkerMonitor,
@Reference(service = LifecycleRegistry::class)
private val lifecycleRegistry: LifecycleRegistry,
@Reference(service = WebServer::class)
private val webServer: WebServer,
@Reference(service = ConfigurationValidatorFactory::class)
Expand Down Expand Up @@ -72,9 +72,9 @@ class DBWorker @Activate constructor(

val params = getParams(args, DBWorkerParams())

webServer.setupWebserver(params.defaultParams)
if (printHelpOrVersion(params.defaultParams, DBWorker::class.java, shutDownService)) return
setupMonitor(workerMonitor, params.defaultParams, this.javaClass.simpleName)
Metrics.configure(webServer, this.javaClass.simpleName)
Health.configure(webServer, lifecycleRegistry)

configureTracing("DB Worker", params.defaultParams.zipkinTraceUrl, params.defaultParams.traceSamplesPerSecond)

Expand All @@ -84,7 +84,7 @@ class DBWorker @Activate constructor(
configurationValidatorFactory.createConfigValidator(),
listOf(WorkerHelpers.createConfigFromParams(BOOT_DB, params.databaseParams))
)

webServer.start(params.defaultParams.workerServerPort)
processor.start(config)
tokenCacheProcessor.start(config)
schedulerProcessor.start(config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@ import net.corda.application.addon.CordaAddonResolver
import net.corda.application.banner.StartupBanner
import net.corda.applications.workers.db.DBWorker
import net.corda.applications.workers.workercommon.ApplicationBanner
import net.corda.applications.workers.workercommon.WorkerMonitor
import net.corda.libs.configuration.SmartConfig
import net.corda.libs.configuration.SmartConfigImpl
import net.corda.libs.configuration.secret.EncryptionSecretsServiceFactory
import net.corda.libs.configuration.secret.SecretsServiceFactoryResolver
import net.corda.libs.configuration.validation.ConfigurationValidator
import net.corda.libs.configuration.validation.ConfigurationValidatorFactory
import net.corda.libs.platform.PlatformInfoProvider
import net.corda.lifecycle.LifecycleCoordinatorName
import net.corda.lifecycle.registry.CoordinatorStatus
import net.corda.lifecycle.registry.LifecycleRegistry
import net.corda.osgi.api.Shutdown
import net.corda.processors.db.DBProcessor
import net.corda.schema.configuration.BootConfig.BOOT_DB
Expand Down Expand Up @@ -54,7 +56,7 @@ class ConfigTests {
mock(),
mock(),
DummyShutdown(),
DummyWorkerMonitor(),
DummyLifecycleRegistry(),
DummyWebServer(),
DummyValidatorFactory(),
DummyPlatformInfoProvider(),
Expand Down Expand Up @@ -99,7 +101,7 @@ class ConfigTests {
mock(),
mock(),
DummyShutdown(),
DummyWorkerMonitor(),
DummyLifecycleRegistry(),
DummyWebServer(),
DummyValidatorFactory(),
DummyPlatformInfoProvider(),
Expand All @@ -108,7 +110,6 @@ class ConfigTests {
)

val args = defaultArgs + arrayOf(
FLAG_DISABLE_MONITOR,
FLAG_MONITOR_PORT, "9999"
)
dbWorker.startup(args.toTypedArray())
Expand All @@ -134,7 +135,7 @@ class ConfigTests {
mock(),
mock(),
DummyShutdown(),
DummyWorkerMonitor(),
DummyLifecycleRegistry(),
DummyWebServer(),
DummyValidatorFactory(),
DummyPlatformInfoProvider(),
Expand Down Expand Up @@ -167,7 +168,7 @@ class ConfigTests {
mock(),
mock(),
DummyShutdown(),
DummyWorkerMonitor(),
DummyLifecycleRegistry(),
DummyWebServer(),
DummyValidatorFactory(),
DummyPlatformInfoProvider(),
Expand All @@ -194,7 +195,7 @@ class ConfigTests {
mock(),
mock(),
DummyShutdown(),
DummyWorkerMonitor(),
DummyLifecycleRegistry(),
DummyWebServer(),
DummyValidatorFactory(),
DummyPlatformInfoProvider(),
Expand Down Expand Up @@ -228,9 +229,11 @@ class ConfigTests {
override fun shutdown(bundle: Bundle) = Unit
}

/** A no-op [WorkerMonitor]. */
private class DummyWorkerMonitor : WorkerMonitor {
override fun registerEndpoints(workerType: String) = Unit
private class DummyLifecycleRegistry : LifecycleRegistry {
override fun componentStatus(): Map<LifecycleCoordinatorName, CoordinatorStatus> {
TODO("Not yet implemented")
}

}

private class DummyWebServer : WebServer {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ dependencies {
implementation project(":components:security-manager")
implementation project(':libs:configuration:configuration-core')
implementation project(':libs:configuration:configuration-validation')
implementation project(":libs:lifecycle:registry")
implementation project(':libs:platform-info:')
implementation project(':libs:tracing')
implementation project(':libs:web:web')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ package net.corda.applications.workers.flow.mapper

import net.corda.applications.workers.workercommon.ApplicationBanner
import net.corda.applications.workers.workercommon.DefaultWorkerParams
import net.corda.applications.workers.workercommon.Health
import net.corda.applications.workers.workercommon.JavaSerialisationFilter
import net.corda.applications.workers.workercommon.Metrics
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.getBootstrapConfig
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.getParams
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.loggerStartupInfo
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.printHelpOrVersion
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.setupMonitor
import net.corda.applications.workers.workercommon.WorkerHelpers.Companion.setupWebserver
import net.corda.applications.workers.workercommon.WorkerMonitor
import net.corda.libs.configuration.secret.SecretsServiceFactoryResolver
import net.corda.libs.configuration.validation.ConfigurationValidatorFactory
import net.corda.libs.platform.PlatformInfoProvider
import net.corda.lifecycle.registry.LifecycleRegistry
import net.corda.osgi.api.Application
import net.corda.osgi.api.Shutdown
import net.corda.processors.flow.mapper.FlowMapperProcessor
Expand All @@ -33,8 +33,8 @@ class FlowMapperWorker @Activate constructor(
private val flowMapperProcessor: FlowMapperProcessor,
@Reference(service = Shutdown::class)
private val shutDownService: Shutdown,
@Reference(service = WorkerMonitor::class)
private val workerMonitor: WorkerMonitor,
@Reference(service = LifecycleRegistry::class)
private val lifecycleRegistry: LifecycleRegistry,
@Reference(service = ConfigurationValidatorFactory::class)
private val configurationValidatorFactory: ConfigurationValidatorFactory,
@Reference(service = PlatformInfoProvider::class)
Expand Down Expand Up @@ -65,12 +65,12 @@ class FlowMapperWorker @Activate constructor(
JavaSerialisationFilter.install()

val params = getParams(args, FlowMapperWorkerParams())
webServer.setupWebserver(params.defaultParams)
if (printHelpOrVersion(params.defaultParams, FlowMapperWorker::class.java, shutDownService)) return
setupMonitor(workerMonitor, params.defaultParams, this.javaClass.simpleName)
Metrics.configure(webServer, this.javaClass.simpleName)
Health.configure(webServer, lifecycleRegistry)

configureTracing("Flow Mapper Worker", params.defaultParams.zipkinTraceUrl, params.defaultParams.traceSamplesPerSecond)

webServer.start(params.defaultParams.workerServerPort)
val config = getBootstrapConfig(
secretsServiceFactoryResolver,
params.defaultParams,
Expand Down
1 change: 1 addition & 0 deletions applications/workers/release/flow-worker/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
implementation project(":components:security-manager")
implementation project(':libs:configuration:configuration-core')
implementation project(':libs:configuration:configuration-validation')
implementation project(":libs:lifecycle:registry")
implementation project(':libs:platform-info:')
implementation project(':libs:tracing')
implementation project(':libs:web:web')
Expand Down
Loading

0 comments on commit 09e9a71

Please sign in to comment.