diff --git a/src/main/java/eu/hbp/mip/configuration/AkkaConfiguration.java b/src/main/java/eu/hbp/mip/configuration/AkkaConfiguration.java index b6322e4b5f160e889c2d6808d0f1f74bb1040aa5..d2f285d4582537c714837d16c17f934f08bc6831 100644 --- a/src/main/java/eu/hbp/mip/configuration/AkkaConfiguration.java +++ b/src/main/java/eu/hbp/mip/configuration/AkkaConfiguration.java @@ -31,8 +31,22 @@ class AkkaConfiguration { @Autowired private ApplicationContext applicationContext; - private final Config config = ConfigFactory.load("application.conf"); - + private final Config config; + + { + Config remotingConfig = ConfigFactory.parseResourcesAnySyntax("akka-remoting.conf").resolve(); + String remotingImpl = remotingConfig.getString("remoting.implementation"); + config = ConfigFactory + .parseString("akka {\n" + + " actor.provider = cluster\n" + + " extensions += \"akka.cluster.pubsub.DistributedPubSub\"\n" + + "}") + .withFallback(ConfigFactory.parseResourcesAnySyntax("akka.conf")) + .withFallback(ConfigFactory.parseResourcesAnySyntax("akka-" + remotingImpl + "-remoting.conf")) + .withFallback(ConfigFactory.parseResourcesAnySyntax("kamon.conf")) + .withFallback(ConfigFactory.load()) + .resolve(); + } @Bean public ExtendedActorSystem actorSystem() { diff --git a/src/main/resources/akka-artery-remoting.conf b/src/main/resources/akka-artery-remoting.conf new file mode 100644 index 0000000000000000000000000000000000000000..c89f41b643d8b6cff4ba5480b03bddcd57848348 --- /dev/null +++ b/src/main/resources/akka-artery-remoting.conf @@ -0,0 +1,25 @@ +akka { + + remote { + + netty.tcp { + enabled = off + } + + artery { + enabled = on + transport = tcp + + canonical.hostname = ${clustering.ip} # external (logical) hostname + canonical.port = ${clustering.port} # external (logical) port + + bind.hostname = 0.0.0.0 # internal (bind) hostname + bind.port = ${clustering.port} # internal (bind) port + + } + } +} + +remoting { + protocol = "akka" +} diff --git a/src/main/resources/akka-netty-remoting.conf b/src/main/resources/akka-netty-remoting.conf new file mode 100644 index 0000000000000000000000000000000000000000..cb11191a2d2b1133eb8d238b8c9395b60e2d9466 --- /dev/null +++ b/src/main/resources/akka-netty-remoting.conf @@ -0,0 +1,22 @@ +akka { + + remote { + + netty.tcp { + hostname = ${clustering.ip} # external (logical) hostname + port = ${clustering.port} # external (logical) port + + bind-hostname = 0.0.0.0 # internal (bind) hostname + bind-port = ${clustering.port} # internal (bind) port + } + + artery { + enabled = off + + } + } +} + +remoting { + protocol = "akka.tcp" +} diff --git a/src/main/resources/akka-remoting.conf b/src/main/resources/akka-remoting.conf new file mode 100644 index 0000000000000000000000000000000000000000..18f2189d453d0c76cbb94505af6cd735fe7c3ff4 --- /dev/null +++ b/src/main/resources/akka-remoting.conf @@ -0,0 +1,7 @@ +remoting { + + implementation = "netty" + # Alternative option is 'artery' + implementation = ${?AKKA_REMOTING} + +} diff --git a/src/main/resources/akka.conf b/src/main/resources/akka.conf new file mode 100644 index 0000000000000000000000000000000000000000..b169e7b9c2cc700b878cbce1518ecb18d8a56ebc --- /dev/null +++ b/src/main/resources/akka.conf @@ -0,0 +1,57 @@ +# Merged with defaults in woken-messages/reference.conf +akka { + loglevel = "WARNING" + loglevel = ${?LOG_LEVEL} + stdout-loglevel = "WARNING" + stdout-loglevel = ${?LOG_LEVEL} + loggers = ["akka.event.slf4j.Slf4jLogger"] + logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" + + log-config-on-start = off + log-config-on-start = ${?LOG_CONFIG} + + log-dead-letters = 10 + log-dead-letters-during-shutdown = off + + actor { + # provider = "cluster" + + allow-java-serialization = off + enable-additional-serialization-bindings = true + + } + + remote { + log-sent-messages = off + log-received-messages = off + log-remote-lifecycle-events = off + + watch-failure-detector { + acceptable-heartbeat-pause = 20 s + } + + } + + cluster { + seed-nodes = [ + ${remoting.protocol}"://"${clustering.cluster.name}"@"${clustering.seed-ip}":"${clustering.seed-port} + ] + + roles = ["portal"] + + } + + http { + server { + idle-timeout = 300s + request-timeout = 180s + ssl-encryption = off + ssl-tracing = on + } + + client { + idle-timeout = 300s + request-timeout = 20 s + } + } +} diff --git a/src/main/resources/application.conf b/src/main/resources/application.conf index 6b19303765fbe1d2cf72c1c719cf71ed19db7a44..333813a1dedc7f79090e077f1d826763ea6521f8 100644 --- a/src/main/resources/application.conf +++ b/src/main/resources/application.conf @@ -1,70 +1,3 @@ -akka { - loglevel = "WARNING" - loglevel = ${?LOG_LEVEL} - stdout-loglevel = "WARNING" - stdout-loglevel = ${?LOG_LEVEL} - loggers = ["akka.event.slf4j.Slf4jLogger"] - logging-filter = "akka.event.slf4j.Slf4jLoggingFilter" +# No specific configuration for Portal backend +# All configuration is related to Akka - log-config-on-start = off - log-config-on-start = ${?LOG_CONFIG} - - log-dead-letters = 10 - log-dead-letters-during-shutdown = off - - actor { - provider = "cluster" - - allow-java-serialization = off - enable-additional-serialization-bindings = true - - } - - remote { - log-sent-messages = off - log-received-messages = off - log-remote-lifecycle-events = off - - watch-failure-detector { - acceptable-heartbeat-pause = 20 s - } - - artery { - enabled = on - transport = tcp - - canonical.hostname = ${clustering.ip} # external (logical) hostname - canonical.port = ${clustering.port} # external (logical) port - - bind.hostname = 0.0.0.0 # internal (bind) hostname - bind.port = ${clustering.port} # internal (bind) port - - } - } - - cluster { - seed-nodes = [ - "akka://"${clustering.cluster.name}"@"${clustering.seed-ip}":"${clustering.seed-port} - ] - - roles = ["portal"] - - } - - extensions += "akka.cluster.pubsub.DistributedPubSub" - -} - -clustering { - ip = "127.0.0.1" - ip = ${?CLUSTER_IP} - port = 4489 - port = ${?CLUSTER_PORT} - seed-ip = "woken" - seed-ip = ${?CLUSTER_IP} - seed-ip = ${?WOKEN_PORT_8088_TCP_ADDR} - seed-port = 8088 - seed-port = ${?WOKEN_PORT_8088_TCP_PORT} - cluster.name = "woken" - cluster.name = ${?CLUSTER_NAME} -} diff --git a/src/main/resources/kamon.conf b/src/main/resources/kamon.conf new file mode 100644 index 0000000000000000000000000000000000000000..00b068b2199b6105255f66e86b23d67ece3e75c8 --- /dev/null +++ b/src/main/resources/kamon.conf @@ -0,0 +1,65 @@ +kamon { + enabled = no + enabled = ${?KAMON_ENABLED} + + environment { + service = "woken" + } + + zipkin = { + enabled = no + enabled = ${?ZIPKIN_ENABLED} + host = "zipkin" + host = ${?ZIPKIN_IP} + port = 9411 + port = ${?ZIPKIN_PORT} + } + + prometheus = { + enabled = no + enabled = ${?PROMETHEUS_ENABLED} + host = "prometheus" + host = ${?PROMETHEUS_IP} + port = 9090 + port = ${?PROMETHEUS_PORT} + } + + util.filters { + "akka.tracked-actor" { + includes = ["**"] + } + + "akka.tracked-dispatcher" { + includes = ["**"] + } + + "akka.traced-actor" { + includes = ["**"] + } + + } + + akka-http { + add-http-status-code-as-metric-tag = true + } + + akka { + ask-pattern-timeout-warning = lightweight + } + + trace { + join-remote-parents-with-same-span-id = yes + } + + system-metrics { + host { + enabled = no + enabled = ${?SIGAR_SYSTEM_METRICS} + } + jvm { + enabled = no + enabled = ${?JVM_SYSTEM_METRICS} + } + } + +} diff --git a/src/main/resources/reference.conf b/src/main/resources/reference.conf new file mode 100644 index 0000000000000000000000000000000000000000..c6ce4a9034d3dcca6d4d801997217c78b775684b --- /dev/null +++ b/src/main/resources/reference.conf @@ -0,0 +1,12 @@ + +app { + clusterSystemName = ${clustering.cluster.name} +} + +# Merged with defaults in woken-messages/reference.conf +clustering { + ip = "127.0.0.1" + ip = ${?CLUSTER_IP} + port = 4489 + port = ${?CLUSTER_PORT} +}