From ed50d779c54e82d3f6b0afa9eaae457caef7f7e2 Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Tue, 24 Sep 2024 16:18:03 +0200 Subject: [PATCH 1/2] chore: Deprecate marathon-api --- README.md | 2 +- .../src/main/resources/reference.conf | 1 + .../akka/discovery/marathon/AppList.scala | 2 + .../akka/discovery/marathon/JsonFormat.scala | 1 + .../MarathonApiServiceDiscovery.scala | 2 + .../akka/discovery/marathon/Settings.scala | 2 + .../MarathonApiServiceDiscoverySpec.scala | 1 + docs/src/main/paradox/bootstrap/index.md | 2 +- docs/src/main/paradox/discovery/index.md | 2 - docs/src/main/paradox/discovery/marathon.md | 85 ------------------- docs/src/main/paradox/index.md | 1 - project/project-info.conf | 5 ++ 12 files changed, 16 insertions(+), 90 deletions(-) delete mode 100644 docs/src/main/paradox/discovery/marathon.md diff --git a/README.md b/README.md index efd9bcc12..f05fe6fa8 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ between releases. Breaking API changes may be introduced without notice as we re A module may be dropped in any release without prior deprecation. The Lightbend subscription does not cover support for the following modules. -* akka-discovery-marathon-api * akka-discovery-aws-api * akka-discovery-aws-api-async +* akka-discovery-marathon-api (End of Life) License ------- diff --git a/discovery-marathon-api/src/main/resources/reference.conf b/discovery-marathon-api/src/main/resources/reference.conf index 0a4650572..012f68f16 100644 --- a/discovery-marathon-api/src/main/resources/reference.conf +++ b/discovery-marathon-api/src/main/resources/reference.conf @@ -6,6 +6,7 @@ akka.discovery { # Set the following in your application.conf if you want to use this discovery mechanism: # method = marathon-api # ApiMayChange + # Deprecated: Use another discovery method instead. Since 1.6.0. marathon-api { class = akka.discovery.marathon.MarathonApiServiceDiscovery diff --git a/discovery-marathon-api/src/main/scala/akka/discovery/marathon/AppList.scala b/discovery-marathon-api/src/main/scala/akka/discovery/marathon/AppList.scala index bd8858e04..d743cb7c1 100644 --- a/discovery-marathon-api/src/main/scala/akka/discovery/marathon/AppList.scala +++ b/discovery-marathon-api/src/main/scala/akka/discovery/marathon/AppList.scala @@ -6,6 +6,7 @@ package akka.discovery.marathon import scala.collection.immutable.Seq +@deprecated("Use another discovery method instead.", "1.6.0") object AppList { case class App(container: Option[Container], portDefinitions: Option[Seq[PortDefinition]], tasks: Option[Seq[Task]]) case class Container(portMappings: Option[Seq[PortMapping]], docker: Option[Docker]) @@ -17,4 +18,5 @@ object AppList { import AppList._ +@deprecated("Use another discovery method instead.", "1.6.0") case class AppList(apps: Seq[App]) diff --git a/discovery-marathon-api/src/main/scala/akka/discovery/marathon/JsonFormat.scala b/discovery-marathon-api/src/main/scala/akka/discovery/marathon/JsonFormat.scala index b2751a3c3..32a16ea65 100644 --- a/discovery-marathon-api/src/main/scala/akka/discovery/marathon/JsonFormat.scala +++ b/discovery-marathon-api/src/main/scala/akka/discovery/marathon/JsonFormat.scala @@ -8,6 +8,7 @@ import akka.http.scaladsl.marshallers.sprayjson.SprayJsonSupport import spray.json._ import AppList._ +@deprecated("Use another discovery method instead.", "1.6.0") object JsonFormat extends SprayJsonSupport with DefaultJsonProtocol { implicit val taskFormat: JsonFormat[Task] = jsonFormat2(Task.apply) implicit val portDefinitionFormat: JsonFormat[PortDefinition] = jsonFormat2(PortDefinition.apply) diff --git a/discovery-marathon-api/src/main/scala/akka/discovery/marathon/MarathonApiServiceDiscovery.scala b/discovery-marathon-api/src/main/scala/akka/discovery/marathon/MarathonApiServiceDiscovery.scala index 6f01ca0c9..4650f488d 100644 --- a/discovery-marathon-api/src/main/scala/akka/discovery/marathon/MarathonApiServiceDiscovery.scala +++ b/discovery-marathon-api/src/main/scala/akka/discovery/marathon/MarathonApiServiceDiscovery.scala @@ -23,6 +23,7 @@ import akka.discovery.ServiceDiscovery.{ Resolved, ResolvedTarget } import akka.event.Logging @ApiMayChange +@deprecated("Use another discovery method instead.", "1.6.0") object MarathonApiServiceDiscovery { /** @@ -74,6 +75,7 @@ object MarathonApiServiceDiscovery { * Service discovery that uses the Marathon API. */ @ApiMayChange +@deprecated("Use another discovery method instead.", "1.6.0") class MarathonApiServiceDiscovery(implicit system: ActorSystem) extends ServiceDiscovery { import MarathonApiServiceDiscovery._ import system.dispatcher diff --git a/discovery-marathon-api/src/main/scala/akka/discovery/marathon/Settings.scala b/discovery-marathon-api/src/main/scala/akka/discovery/marathon/Settings.scala index 5353e4c9a..134731abc 100644 --- a/discovery-marathon-api/src/main/scala/akka/discovery/marathon/Settings.scala +++ b/discovery-marathon-api/src/main/scala/akka/discovery/marathon/Settings.scala @@ -8,6 +8,7 @@ import akka.actor._ import akka.annotation.ApiMayChange @ApiMayChange +@deprecated("Use another discovery method instead.", "1.6.0") final class Settings(system: ExtendedActorSystem) extends Extension { private val marathonApi = system.settings.config.getConfig("akka.discovery.marathon-api") @@ -22,6 +23,7 @@ final class Settings(system: ExtendedActorSystem) extends Extension { } @ApiMayChange +@deprecated("Use another discovery method instead.", "1.6.0") object Settings extends ExtensionId[Settings] with ExtensionIdProvider { override def get(system: ActorSystem): Settings = super.get(system) diff --git a/discovery-marathon-api/src/test/scala/akka/discovery/marathon/MarathonApiServiceDiscoverySpec.scala b/discovery-marathon-api/src/test/scala/akka/discovery/marathon/MarathonApiServiceDiscoverySpec.scala index bd1686478..ebcf30a36 100644 --- a/discovery-marathon-api/src/test/scala/akka/discovery/marathon/MarathonApiServiceDiscoverySpec.scala +++ b/discovery-marathon-api/src/test/scala/akka/discovery/marathon/MarathonApiServiceDiscoverySpec.scala @@ -12,6 +12,7 @@ import scala.io.Source import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec +@deprecated("Use another discovery method instead.", "1.6.0") class MarathonApiServiceDiscoverySpec extends AnyWordSpec with Matchers { "targets" should { "calculate the correct list of resolved targets" in { diff --git a/docs/src/main/paradox/bootstrap/index.md b/docs/src/main/paradox/bootstrap/index.md index 352de1bd0..826cd6daf 100644 --- a/docs/src/main/paradox/bootstrap/index.md +++ b/docs/src/main/paradox/bootstrap/index.md @@ -186,7 +186,7 @@ that your deployment is robust. Since the target environments for this module are dynamic, that is, instances can come and go, failure needs to be considered. The following configuration will result in your application being shut down after 30 seconds if it is unable to -join the discovered seed nodes. In this case, the orchestrator (i.e. Kubernetes or Marathon) will restart your node +join the discovered seed nodes. In this case, the orchestrator (i.e. Kubernetes) will restart your node and the operation will (presumably) eventually succeed. You'll want to specify the following in your `application.conf` file: @@snip [CompileOnly.scala](/integration-test/local/src/main/resources/application.conf) { #coorindated-shutdown } diff --git a/docs/src/main/paradox/discovery/index.md b/docs/src/main/paradox/discovery/index.md index eb466149d..e21d9da73 100644 --- a/docs/src/main/paradox/discovery/index.md +++ b/docs/src/main/paradox/discovery/index.md @@ -7,7 +7,6 @@ Akka Discovery module in Akka. Akka Management contains methods for: * @ref[Kubernetes](kubernetes.md) - * @ref[Marathon](marathon.md) * @ref[AWS](aws.md) * @ref[Azure](azure.md) @@ -18,7 +17,6 @@ part of the build and release process. @@@ index - [Kubernetes](kubernetes.md) - - [Marathon](marathon.md) - [AWS](aws.md) - [Azure](azure.md) - [Consul (discontinued)](consul.md) diff --git a/docs/src/main/paradox/discovery/marathon.md b/docs/src/main/paradox/discovery/marathon.md deleted file mode 100644 index 6bb91b0c3..000000000 --- a/docs/src/main/paradox/discovery/marathon.md +++ /dev/null @@ -1,85 +0,0 @@ -## Marathon API - -@@@ warning - -This module is community maintained and the Lightbend subscription doesn't cover support for this module. - It is also marked as @extref:[may change](akka:common/may-change.html). - That means that the API, configuration or semantics can change without warning or deprecation period. - -@@@ - -Marathon currently ignores all fields apart from service name. This is expected to change. - -If you're a Mesos or DC/OS user, you can use the provided Marathon API implementation. You'll need to add a label -to your Marathon JSON (named `ACTOR_SYSTEM_NAME` by default) and set the value equal to the name of the configured -effective name, which defaults to your applications actor system name. - -You'll also have to add a named port, by default `akkamgmthttp`, and ensure that Akka Management's HTTP interface -is bound to this port. - -## Project Info - -@@project-info{ projectId="akka-discovery-marathon-api" } - -### Dependencies and usage - -The Akka dependencies are available from Akka's library repository. To access them there, you need to configure the URL for this repository. - -@@repository [sbt,Gradle,Maven] { -id="akka-repository" -name="Akka library repository" -url="https://repo.akka.io/maven" -} - -Additionally, add the dependency as below. - -@@dependency[sbt,Gradle,Maven] { - symbol1=AkkaManagementVersion - value1=$project.version$ - group="com.lightbend.akka.discovery" - artifact="akka-discovery-marathon-api_$scala.binary.version$" - version=AkkaManagementVersion -} - -`akka-discovery-marathon-api` can be used with Akka $akka.version$ or later. -You have to override the following Akka dependencies by defining them explicitly in your build and -define the Akka version to the one that you are using. Latest patch version of Akka is recommended and -a later version than $akka.version$ can be used. - -@@dependency[sbt,Gradle,Maven] { - symbol=AkkaVersion - value=$akka.version$ - group=com.typesafe.akka - artifact=akka-cluster_$scala.binary.version$ - version=AkkaVersion - group2=com.typesafe.akka - artifact2=akka-discovery_$scala.binary.version$ - version2=AkkaVersion -} - -And in your `application.conf`: - -``` -akka.discovery { - method = marathon-api -} -``` - -And in your `marathon.json`: -``` -{ - ... - "cmd": "path-to-your-app -Dakka.remote.netty.tcp.hostname=$HOST -Dakka.remote.netty.tcp.port=$PORT_AKKAREMOTE -Dakka.management.http.hostname=$HOST -Dakka.management.http.port=$PORT_AKKAMGMTHTTP", - - "labels": { - "ACTOR_SYSTEM_NAME": "my-system" - }, - - "portDefinitions": [ - { "port": 0, "name": "akkaremote" }, - { "port": 0, "name": "akkamgmthttp" } - ] - ... -} -``` - diff --git a/docs/src/main/paradox/index.md b/docs/src/main/paradox/index.md index c1ac82841..bbbbb39de 100644 --- a/docs/src/main/paradox/index.md +++ b/docs/src/main/paradox/index.md @@ -16,7 +16,6 @@ Akka Management consists of multiple modules: As well as @extref:[Akka Discovery](akka:discovery/index.html) methods for: * @ref[Kubernetes API](discovery/kubernetes.md) - * @ref[Marathon API](discovery/marathon.md) * @ref[AWS](discovery/aws.md) * @ref[Azure](discovery/azure.md) diff --git a/project/project-info.conf b/project/project-info.conf index 9b33f5708..0e1e0c10e 100644 --- a/project/project-info.conf +++ b/project/project-info.conf @@ -75,6 +75,11 @@ project-info { readiness: CommunityDriven since: "2018-01-26" since-version: "0.10.0" + }, + { + readiness: EndOfLife + since: "2024-09-24" + since-version: "1.6.0" } ] } From 37740d5d1d645a50e58f80d7f578eabce41415ab Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Tue, 24 Sep 2024 16:22:35 +0200 Subject: [PATCH 2/2] remove marathon integration tests --- integration-test/dns-api-mesos/README.md | 24 ------ integration-test/dns-api-mesos/build.sbt | 17 ---- .../marathon/app.bridge-mode.json | 57 ------------- .../dns-api-mesos/marathon/app.host-mode.json | 41 --------- .../dns-api-mesos/project/build.properties | 1 - .../dns-api-mesos/project/plugins.sbt | 3 - .../src/main/resources/application.conf | 72 ---------------- .../akka/cluster/bootstrap/DemoApp.scala | 47 ----------- .../marathon-api-docker/README.md | 84 ------------------- .../marathon-api-docker/build.sbt | 21 ----- .../marathon/marathon-api-docker-app.json | 84 ------------------- .../project/build.properties | 1 - .../marathon-api-docker/project/plugins.sbt | 1 - .../src/main/resources/application.conf | 71 ---------------- .../bootstrap/MarathonApiDockerDemoApp.scala | 43 ---------- integration-test/marathon-api/README.md | 60 ------------- integration-test/marathon-api/build.sbt | 17 ---- .../marathon-api/marathon/app.json | 65 -------------- .../marathon-api/project/build.properties | 1 - .../marathon-api/project/plugins.sbt | 1 - .../src/main/resources/application.conf | 29 ------- .../akka/cluster/bootstrap/DemoApp.scala | 43 ---------- 22 files changed, 783 deletions(-) delete mode 100644 integration-test/dns-api-mesos/README.md delete mode 100644 integration-test/dns-api-mesos/build.sbt delete mode 100644 integration-test/dns-api-mesos/marathon/app.bridge-mode.json delete mode 100644 integration-test/dns-api-mesos/marathon/app.host-mode.json delete mode 100644 integration-test/dns-api-mesos/project/build.properties delete mode 100644 integration-test/dns-api-mesos/project/plugins.sbt delete mode 100644 integration-test/dns-api-mesos/src/main/resources/application.conf delete mode 100644 integration-test/dns-api-mesos/src/main/scala/akka/cluster/bootstrap/DemoApp.scala delete mode 100644 integration-test/marathon-api-docker/README.md delete mode 100644 integration-test/marathon-api-docker/build.sbt delete mode 100644 integration-test/marathon-api-docker/marathon/marathon-api-docker-app.json delete mode 100644 integration-test/marathon-api-docker/project/build.properties delete mode 100644 integration-test/marathon-api-docker/project/plugins.sbt delete mode 100644 integration-test/marathon-api-docker/src/main/resources/application.conf delete mode 100644 integration-test/marathon-api-docker/src/main/scala/akka/cluster/bootstrap/MarathonApiDockerDemoApp.scala delete mode 100644 integration-test/marathon-api/README.md delete mode 100644 integration-test/marathon-api/build.sbt delete mode 100644 integration-test/marathon-api/marathon/app.json delete mode 100644 integration-test/marathon-api/project/build.properties delete mode 100644 integration-test/marathon-api/project/plugins.sbt delete mode 100644 integration-test/marathon-api/src/main/resources/application.conf delete mode 100644 integration-test/marathon-api/src/main/scala/akka/cluster/bootstrap/DemoApp.scala diff --git a/integration-test/dns-api-mesos/README.md b/integration-test/dns-api-mesos/README.md deleted file mode 100644 index a9cec2272..000000000 --- a/integration-test/dns-api-mesos/README.md +++ /dev/null @@ -1,24 +0,0 @@ -DNS lookup example -================== - -Build and publish docker image into the local repo. -`sbt Docker/publishLocal` - -Tag built image: -`docker tag integration-test-dns-api:1.0 /integration-test-dns-api:1.0` - -Push image into DockerHub -`docker push /integration-test-dns-api:1.0` - -Mesosphere DC/OS -================ - -Host mode ---------- -Use `marathon/app.host-mode.json` service description. - -Bridge mode ------------ - -Use `marathon/app.bridge-mode.json` service description. - diff --git a/integration-test/dns-api-mesos/build.sbt b/integration-test/dns-api-mesos/build.sbt deleted file mode 100644 index 0886abbee..000000000 --- a/integration-test/dns-api-mesos/build.sbt +++ /dev/null @@ -1,17 +0,0 @@ -enablePlugins(JavaAppPackaging) - -resolvers += "Akka library repository".at("https://repo.akka.io/maven") - -name := "bootstrap-demo-dns-api" - -scalaVersion := "2.13.14" - -def akkaManagementVersion(version: String) = version.split('+')(0) - -libraryDependencies += "com.lightbend.akka.management" %% "akka-management-cluster-bootstrap" % akkaManagementVersion( - version.value) - -libraryDependencies += "com.lightbend.akka.management" %% "akka-management-cluster-http" % akkaManagementVersion( - version.value) - -libraryDependencies += "com.typesafe.akka" %% "akka-discovery" % "2.9.3" diff --git a/integration-test/dns-api-mesos/marathon/app.bridge-mode.json b/integration-test/dns-api-mesos/marathon/app.bridge-mode.json deleted file mode 100644 index c920908f1..000000000 --- a/integration-test/dns-api-mesos/marathon/app.bridge-mode.json +++ /dev/null @@ -1,57 +0,0 @@ -{ - "id": "/products-api", - "instances": 2, - "cpus": 0.1, - "mem": 1024, - "disk": 0, - "gpus": 0, - "constraints": [], - "fetch": [], - "storeUrls": [], - "backoffSeconds": 1, - "backoffFactor": 1.15, - "maxLaunchDelaySeconds": 3600, - "container": { - "type": "DOCKER", - "volumes": [], - "docker": { - "image": "occo6er/bootstrap-demo-dns-api:1.0", - "network": "BRIDGE", - "portMappings": [ - { - "containerPort": 2551, - "hostPort": 0, - "servicePort": 10205, - "protocol": "udp,tcp", - "name": "remoting" - }, - { - "containerPort": 8558, - "hostPort": 8558, - "servicePort": 10206, - "protocol": "tcp", - "name": "http" - } - ], - "privileged": false, - "parameters": [], - "forcePullImage": true - } - }, - "healthChecks": [], - "readinessChecks": [], - "dependencies": [], - "upgradeStrategy": { - "minimumHealthCapacity": 1, - "maximumOverCapacity": 1 - }, - "unreachableStrategy": { - "inactiveAfterSeconds": 300, - "expungeAfterSeconds": 600 - }, - "killSelection": "YOUNGEST_FIRST", - "requirePorts": true, - "env": { - "SERVICE_NAME": "products-api.marathon.mesos" - } -} \ No newline at end of file diff --git a/integration-test/dns-api-mesos/marathon/app.host-mode.json b/integration-test/dns-api-mesos/marathon/app.host-mode.json deleted file mode 100644 index 75419972f..000000000 --- a/integration-test/dns-api-mesos/marathon/app.host-mode.json +++ /dev/null @@ -1,41 +0,0 @@ -{ - "id": "/products-api", - "instances": 0, - "cpus": 0.1, - "mem": 1024, - "disk": 0, - "gpus": 0, - "constraints": [], - "fetch": [], - "storeUrls": [], - "backoffSeconds": 1, - "backoffFactor": 1.15, - "maxLaunchDelaySeconds": 3600, - "container": { - "type": "DOCKER", - "volumes": [], - "docker": { - "image": "occo6er/bootstrap-demo-dns-api:1.0", - "network": "HOST", - "privileged": false, - "parameters": [], - "forcePullImage": true - } - }, - "healthChecks": [], - "readinessChecks": [], - "dependencies": [], - "upgradeStrategy": { - "minimumHealthCapacity": 1, - "maximumOverCapacity": 1 - }, - "unreachableStrategy": { - "inactiveAfterSeconds": 300, - "expungeAfterSeconds": 600 - }, - "killSelection": "YOUNGEST_FIRST", - "requirePorts": false, - "env": { - "SERVICE_NAME": "products-api.marathon.mesos" - } -} \ No newline at end of file diff --git a/integration-test/dns-api-mesos/project/build.properties b/integration-test/dns-api-mesos/project/build.properties deleted file mode 100644 index 406a7d255..000000000 --- a/integration-test/dns-api-mesos/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=0.13.16 \ No newline at end of file diff --git a/integration-test/dns-api-mesos/project/plugins.sbt b/integration-test/dns-api-mesos/project/plugins.sbt deleted file mode 100644 index b6e4f0416..000000000 --- a/integration-test/dns-api-mesos/project/plugins.sbt +++ /dev/null @@ -1,3 +0,0 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.2") - -addSbtPlugin("com.github.sbt" % "sbt-dynver" % "2.0.0") diff --git a/integration-test/dns-api-mesos/src/main/resources/application.conf b/integration-test/dns-api-mesos/src/main/resources/application.conf deleted file mode 100644 index 643bb67a0..000000000 --- a/integration-test/dns-api-mesos/src/main/resources/application.conf +++ /dev/null @@ -1,72 +0,0 @@ -akka { - - loglevel = INFO - - actor { - provider = "cluster" - } - - remote { - netty.tcp { - hostname = ${HOST} - port = 2551 - port = ${?PORT_2551} - - bind-hostname = 0.0.0.0 - bind-port = 2551 - } - } - - management { - http { - # The hostname where the HTTP Server for Http Cluster Management will be started. - # This defines the interface to use. - # InetAddress.getLocalHost.getHostAddress is used not overriden or empty - hostname = ${HOST} - port = 8558 - port = ${?PORT_8558} - - bind-hostname = 0.0.0.0 - bind-port = 8558 - } - - cluster.bootstrap { - - # Configuration for the first phase of bootstraping, during which contact points are discovered - # using the configured service discovery mechanism (e.g. DNS records). - contact-point-discovery { - - # Define this name to be looked up in service discovery for "neighboring" nodes - # If undefined, the name will be taken from the AKKA_CLUSTER_BOOTSTRAP_SERVICE_NAME - # environment variable or extracted from the ActorSystem name - service-name = ${MARATHON_APP_ID} - - # Added as suffix to the service-name to build the effective-service name used in the contact-point service lookups - # If undefined, nothing will be appended to the service-name. - # - # Examples, set this to: - # "default.svc.cluster.local" or "my-namespace.svc.cluster.local" for kubernetes clusters. - service-namespace = ".marathon.mesos" - - # The effective service name is the exact string that will be used to perform service discovery. - # - # Set this value to a specific string to override the default behaviour of building the effective name by - # concatenating the `service-name` with the optional `service-namespace` (e.g. "name.default"). - effective-name = ${?SERVICE_NAME} - - # Config path of discovery method to be used to locate the initial contact points. - discovery-method = akka-dns - } - - # Configured how we communicate with the contact point once it is discovered - contact-point { - # If no port is discovered along with the host/ip of a contact point this port will be used as fallback - fallback-port = 8558 - fallback-port = ${?PORT_8558} - } - - } - - } - -} diff --git a/integration-test/dns-api-mesos/src/main/scala/akka/cluster/bootstrap/DemoApp.scala b/integration-test/dns-api-mesos/src/main/scala/akka/cluster/bootstrap/DemoApp.scala deleted file mode 100644 index dd93e4e16..000000000 --- a/integration-test/dns-api-mesos/src/main/scala/akka/cluster/bootstrap/DemoApp.scala +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (C) 2017 Lightbend Inc. - */ -package akka.cluster.bootstrap - -import akka.actor.{ Actor, ActorLogging, ActorSystem, Props } -import akka.cluster.ClusterEvent.ClusterDomainEvent -import akka.cluster.{ Cluster, ClusterEvent } -import akka.http.scaladsl.Http -import akka.management.scaladsl.AkkaManagement -import akka.management.cluster.bootstrap.ClusterBootstrap -import akka.stream.scaladsl.Sink -import akka.stream.scaladsl.Source -import com.typesafe.config.ConfigFactory - -object DemoApp extends App { - - implicit val system: ActorSystem = ActorSystem("simple") - - import system.log - import system.dispatcher - val cluster = Cluster(system) - - log.info("Started [{}], cluster.selfAddress = {}", system, cluster.selfAddress) - - AkkaManagement(system).start() - ClusterBootstrap(system).start() - - cluster - .subscribe(system.actorOf(ClusterWatcher.props()), ClusterEvent.InitialStateAsEvents, classOf[ClusterDomainEvent]) - - import akka.http.scaladsl.server.Directives._ - Http().bindAndHandle(complete("Hello world"), "0.0.0.0", 8080) - -} - -object ClusterWatcher { - def props(): Props = Props(new ClusterWatcher) - } - -class ClusterWatcher extends Actor with ActorLogging { - val cluster = Cluster(context.system) - - override def receive = { - case msg => log.info("Cluster {} >>> {}", msg, cluster.selfAddress) - } -} diff --git a/integration-test/marathon-api-docker/README.md b/integration-test/marathon-api-docker/README.md deleted file mode 100644 index 60867ea5d..000000000 --- a/integration-test/marathon-api-docker/README.md +++ /dev/null @@ -1,84 +0,0 @@ -Marathon API Docker lookup example -================================== - -This example demonstrates Marathon API discovery mechanism when an application runs inside a docker container in -network bridge mode with automatic host port allocation. - -Marathon API discovery mechanism uses Marathon API to find other application instances (contact points) to form Akka cluster. -In order to identify contact points it uses a label assigned to the application in the application description and -a port name to identify Akka HTTP management port: - -Label need to be defined in two places. -First place is the application configuration: -see `integration-test/marathon-api-docker/src/main/resources/application.conf`: -``` - akka.management.cluster.bootstrap.contact-point-discovery.effective-name = "marathon-api-docker-app-label" -``` - -> NOTE: if `effective-name` is not defined explicitly then Discovery Mechanism will use concatenation of -> `service-name` and `.service-namespace` if any of them defined in the application config. Otherwise, it will use -> the application ActorSystem name. - -The second place is the application description: -see `marathon/marathon-api-docker-app.json`: -``` - ... - "labels": { - "ACTOR_SYSTEM_NAME": "marathon-api-docker-app-label" - } - ... - -``` - -> NOTE: Discovery Mechanism uses `ACTOR_SYSTEM_NAME` label name as a part of Marathon API query param to find relevant contact points. -> This default value can be overridden in the application config `akka.discovery.marathon-api.app-label-query` - -After Discovery mechanism found potential contact points by the label it needs to find Akka HTTP management port. - -It uses `app-port-name`: -see `src/main/resources/application.conf`: -``` -... -akka.discovery.marathon-api.app-port-name = "akkamgmthttp" -... -``` - -it should match with Akka HTTP management port name in Marathon application description docker port declaration: -see `marathon/marathon-api-docker-app.json`: -``` -... - "container": { - "type": "DOCKER", - "docker": { - ... - "portMappings": [ - ... - { - "containerPort": 8558, - "hostPort": 0, - "servicePort": 10206, - "protocol": "tcp", - "name": "akkamgmthttp" -... -``` - -How to Build ------------- - -1. Set DOCKER_USER env variable and authenticated to your docker hub account: - -`export DOCKER_USER=` - -2. In order to build and publish this example into your docker hub repo run next command from `akka-management` work folder - -`sbt integration-test-marathon-api-docker/docker:publish` - -How to Deploy -------------- - -Use next template for Marathon application descriptor. - -`marathon/marathon-api-docker-app.json` - -> NOTE: Make sure to substitute $DOCKER_USER in it to point to your docker hub repo. - diff --git a/integration-test/marathon-api-docker/build.sbt b/integration-test/marathon-api-docker/build.sbt deleted file mode 100644 index 404a0ada2..000000000 --- a/integration-test/marathon-api-docker/build.sbt +++ /dev/null @@ -1,21 +0,0 @@ -import com.typesafe.sbt.packager.docker._ - -name := "bootstrap-demo-marathon-api-docker" - -scalaVersion := "2.13.14" - -enablePlugins(JavaServerAppPackaging) - -resolvers += "Akka library repository".at("https://repo.akka.io/maven") - -version := "1.0" - -dockerUsername := sys.env.get("DOCKER_USER") - -val akkaManagementVersion = "1.5.2" - -libraryDependencies ++= Vector( - "com.lightbend.akka.management" %% "akka-management-cluster-bootstrap" % akkaManagementVersion, - "com.lightbend.akka.management" %% "akka-management-cluster-http" % akkaManagementVersion, - "com.lightbend.akka.discovery" %% "akka-discovery-marathon-api" % akkaManagementVersion -) diff --git a/integration-test/marathon-api-docker/marathon/marathon-api-docker-app.json b/integration-test/marathon-api-docker/marathon/marathon-api-docker-app.json deleted file mode 100644 index e285c2d4c..000000000 --- a/integration-test/marathon-api-docker/marathon/marathon-api-docker-app.json +++ /dev/null @@ -1,84 +0,0 @@ -{ - "id": "/bootstrap-demo-marathon-api-docker", - "instances": 2, - "labels": { - "ACTOR_SYSTEM_NAME": "marathon-api-docker-app-label" - }, - "cpus": 0.25, - "mem": 512, - "disk": 0, - "gpus": 0, - "constraints": [], - "fetch": [], - "storeUrls": [], - "backoffSeconds": 1, - "backoffFactor": 1.15, - "maxLaunchDelaySeconds": 3600, - "container": { - "type": "DOCKER", - "volumes": [], - "docker": { - "image": "$DOCKER_USER/akka-management-bootstrap-demo-marathon-api-docker:1.0", - "network": "BRIDGE", - "portMappings": [ - { - "containerPort": 8080, - "hostPort": 0, - "servicePort": 10204, - "protocol": "tcp", - "name": "http" - }, - { - "containerPort": 2551, - "hostPort": 0, - "servicePort": 10205, - "protocol": "udp,tcp", - "name": "remoting" - }, - { - "containerPort": 8558, - "hostPort": 0, - "servicePort": 10206, - "protocol": "tcp", - "name": "akkamgmthttp" - } - ], - "privileged": false, - "parameters": [], - "forcePullImage": true - } - }, - "readinessChecks": [{ - "path": "/ready", - "portName": "http", - "protocol": "HTTP", - "gracePeriodSeconds": 300, - "intervalSeconds": 10, - "timeoutSeconds": 5, - "maxConsecutiveFailures": 3, - "ignoreHttp1xx": false - }], - "healthChecks": [ - { - "path": "/healthy", - "portName": "http", - "protocol": "HTTP", - "gracePeriodSeconds": 300, - "intervalSeconds": 10, - "timeoutSeconds": 5, - "maxConsecutiveFailures": 3, - "ignoreHttp1xx": false - } - ], - "dependencies": [], - "upgradeStrategy": { - "maximumOverCapacity": 0, - "minimumHealthCapacity": 0.5 - }, - "unreachableStrategy": { - "inactiveAfterSeconds": 300, - "expungeAfterSeconds": 600 - }, - "killSelection": "YOUNGEST_FIRST", - "requirePorts": true -} \ No newline at end of file diff --git a/integration-test/marathon-api-docker/project/build.properties b/integration-test/marathon-api-docker/project/build.properties deleted file mode 100644 index 406a7d255..000000000 --- a/integration-test/marathon-api-docker/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=0.13.16 \ No newline at end of file diff --git a/integration-test/marathon-api-docker/project/plugins.sbt b/integration-test/marathon-api-docker/project/plugins.sbt deleted file mode 100644 index 3b2db136d..000000000 --- a/integration-test/marathon-api-docker/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.2") \ No newline at end of file diff --git a/integration-test/marathon-api-docker/src/main/resources/application.conf b/integration-test/marathon-api-docker/src/main/resources/application.conf deleted file mode 100644 index 884fd0503..000000000 --- a/integration-test/marathon-api-docker/src/main/resources/application.conf +++ /dev/null @@ -1,71 +0,0 @@ -akka { - - loglevel = INFO - - discovery { - marathon-api { - class = akka.discovery.marathon.MarathonApiServiceDiscovery - - # URL for getting list of apps from Marathon. Verified on OSS DC/OS 1.8, 1.9 - app-api-url = "http://marathon.mesos:8080/v2/apps" - - # The name of the akka management port - this cannot have underscores or dashes (env var name) - app-port-name = "akkamgmthttp" - - # Used to find other apps running by Marathon. This will be passed as the label query string parameter - # to the apps-api-url defined above. - # `%s` will be replaced with the configured effective name, which defaults to the actor system name - app-label-query = "ACTOR_SYSTEM_NAME==%s" - } - } - - actor { - provider = "cluster" - } - - remote { - netty.tcp { - hostname = ${HOST} - port = 2551 - port = ${?PORT_2551} - - bind-hostname = 0.0.0.0 - bind-port = 2551 - } - } - - management { - http { - # The hostname where the HTTP Server for Http Cluster Management will be started. - # This defines the interface to use. - # InetAddress.getLocalHost.getHostAddress is used not overriden or empty - hostname = ${HOST} - port = 8558 - port = ${?PORT_8558} - - bind-hostname = 0.0.0.0 - bind-port = 8558 - } - - cluster.bootstrap { - - # Configuration for the first phase of bootstraping, during which contact points are discovered - # using the configured service discovery mechanism. - contact-point-discovery { - - # Marathon API discovery uses effective-name when it's defined. - # - # Marathon API dicsovery uses this value to substitute to the query `app-label-query` - # - # It should match with application LABEL value declared in Marathon description. - # - effective-name= "marathon-api-docker-app-label" - - discovery-method = marathon-api - } - - } - - } - -} diff --git a/integration-test/marathon-api-docker/src/main/scala/akka/cluster/bootstrap/MarathonApiDockerDemoApp.scala b/integration-test/marathon-api-docker/src/main/scala/akka/cluster/bootstrap/MarathonApiDockerDemoApp.scala deleted file mode 100644 index eac39809b..000000000 --- a/integration-test/marathon-api-docker/src/main/scala/akka/cluster/bootstrap/MarathonApiDockerDemoApp.scala +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2017-2024 Lightbend Inc. - */ - -package akka.cluster.bootstrap - -import akka.actor.ActorSystem -import akka.cluster.{ Cluster, MemberStatus } -import akka.http.scaladsl.Http -import akka.http.scaladsl.model._ -import akka.http.scaladsl.server.Directives._ -import akka.management.cluster.bootstrap.ClusterBootstrap -import akka.management.scaladsl.AkkaManagement - -object MarathonApiDockerDemoApp extends App { - implicit val system: ActorSystem = ActorSystem("my-system") - - val cluster = Cluster(system) - - def isReady() = { - val selfNow = cluster.selfMember - - selfNow.status == MemberStatus.Up - } - - def isHealthy() = { - isReady() - } - - val route = - concat( - path("ping")(complete("pong!")), - path("healthy")(complete(if (isHealthy()) StatusCodes.OK else StatusCodes.ServiceUnavailable)), - path("ready")(complete(if (isReady()) StatusCodes.OK else StatusCodes.ServiceUnavailable)) - ) - - AkkaManagement(system).start() - ClusterBootstrap(system).start() - - private val host: String = sys.env.get("HOST").getOrElse("127.0.0.1") - private val port: Int = sys.env.get("PORT_HTTP").map(_.toInt).getOrElse(8080) - Http().newServerAt(host, port).bind(route) -} diff --git a/integration-test/marathon-api/README.md b/integration-test/marathon-api/README.md deleted file mode 100644 index 8fcbe3263..000000000 --- a/integration-test/marathon-api/README.md +++ /dev/null @@ -1,60 +0,0 @@ -Your Akka Cluster on DC/OS -========================== - -Prerequisites -------------- - -* A DC/OS cluster with `dcos` command configured to point at it -* SBT -* Webserver to host build artifact -* A terminal with working directory `integration-test/marathon-api` - -Step 1: Package the App ------------------------ - -Compile and package the demo app. - -```bash -sbt universal:packageZipTarball -``` - -Now, in the `target/universal` folder, you should have a -`integration-test-marathon-api-0.1.0.tgz` file. - -Step 2: Upload the App ----------------------- - -Upload `integration-test-marathon-api-0.1.0.tgz` to a webserver that your DC/OS cluster can access. - - -Step 3: Edit Config -------------------- - -Edit `marathon/app.json`, replacing the value at `fetch[0].uri` ("https://yourwebserver.example.com/integration-test-marathon-api-0.1.0.tgz") -with the URL of the packaged application. - -Step 4: Deploy the App ----------------------- - -Using the `dcos` command, deploy the application: - -```bash -dcos marathon app add dcos/marathon.json -``` - -Step 5: Verify the cluster formation ------------------------------------- - -Using `dcos task log` you can watch the output of the application. - -```bash -dcos task log --follow integration-test-marathon-api-0.1.0 -``` - -Successful log output will look something like the following: - -``` -[INFO] [01/11/2018 21:19:48.113] [my-system-akka.actor.default-dispatcher-6] [akka.cluster.Cluster(akka://my-system)] Cluster Node [akka.tcp://my-system@192.168.65.111:14878] - Sending InitJoinAck message from node [akka.tcp://my-system@192.168.65.111:14878] to [Actor[akka.tcp://my-system@192.168.65.111:7664/system/cluster/core/daemon/joinSeedNodeProcess-1#-1012708477]] -[INFO] [01/11/2018 21:19:48.145] [my-system-akka.actor.default-dispatcher-6] [akka.cluster.Cluster(akka://my-system)] Cluster Node [akka.tcp://my-system@192.168.65.111:14878] - Node [akka.tcp://my-system@192.168.65.111:7664] is JOINING, roles [dc-default] -[INFO] [01/11/2018 21:19:49.139] [my-system-akka.actor.default-dispatcher-18] [akka.cluster.Cluster(akka://my-system)] Cluster Node [akka.tcp://my-system@192.168.65.111:14878] - Leader is moving node [akka.tcp://my-system@192.168.65.111:7664] to [Up] -``` diff --git a/integration-test/marathon-api/build.sbt b/integration-test/marathon-api/build.sbt deleted file mode 100644 index f41e2f555..000000000 --- a/integration-test/marathon-api/build.sbt +++ /dev/null @@ -1,17 +0,0 @@ -enablePlugins(JavaServerAppPackaging) - -name := "bootstrap-demo-marathon-api" - -resolvers += "Akka library repository".at("https://repo.akka.io/maven") - -version := "0.1.0" - -scalaVersion := "2.13.14" - -val akkaManagementVersion = "1.5.2" - -libraryDependencies ++= Vector( - "com.lightbend.akka.management" %% "akka-management-cluster-bootstrap" % akkaManagementVersion, - "com.lightbend.akka.management" %% "akka-management-cluster-http" % akkaManagementVersion, - "com.lightbend.akka.discovery" %% "akka-discovery-marathon-api" % akkaManagementVersion -) diff --git a/integration-test/marathon-api/marathon/app.json b/integration-test/marathon-api/marathon/app.json deleted file mode 100644 index 87325d58d..000000000 --- a/integration-test/marathon-api/marathon/app.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "id": "/bootstrap-demo-marathon-api-0.1.0", - "cmd": "./bootstrap-demo-marathon-api-0.1.0/bin/bootstrap-joining-demo-marathon-api -java-home $(echo $(pwd)/jre*) -Dakka.remote.netty.tcp.hostname=$HOST -Dakka.remote.netty.tcp.port=$PORT_AKKAREMOTE -Dakka.management.http.hostname=$HOST -Dakka.management.http.port=$PORT_AKKAMGMTHTTP", - "cpus": 1.0, - "mem": 512, - "instances": 2, - "labels": { - "ACTOR_SYSTEM_NAME": "my-system" - }, - "portDefinitions": [ - { - "port": 0, - "name": "http" - }, - { - "port": 0, - "name": "akkaremote" - }, - { - "port": 0, - "name": "akkamgmthttp" - } - ], - "readinessChecks": [{ - "path": "/ready", - "portName": "http", - "protocol": "HTTP", - "gracePeriodSeconds": 300, - "intervalSeconds": 10, - "timeoutSeconds": 5, - "maxConsecutiveFailures": 3, - "ignoreHttp1xx": false - }], - "healthChecks": [ - { - "path": "/healthy", - "portName": "http", - "protocol": "HTTP", - "gracePeriodSeconds": 300, - "intervalSeconds": 10, - "timeoutSeconds": 5, - "maxConsecutiveFailures": 3, - "ignoreHttp1xx": false - } - ], - "upgradeStrategy": { - "maximumOverCapacity": 0, - "minimumHealthCapacity": 0.5 - }, - "killSelection": "YOUNGEST_FIRST", - "fetch": [ - { - "uri": "http://yourwebserver.example.com/bootstrap-demo-marathon-api-0.1.0.tgz", - "extract": true, - "executable": false, - "cache": false - }, - { - "uri": "https://downloads.mesosphere.com/java/jre-8u121-linux-x64.tar.gz", - "extract": true, - "executable": false, - "cache": true - } - ] -} diff --git a/integration-test/marathon-api/project/build.properties b/integration-test/marathon-api/project/build.properties deleted file mode 100644 index 406a7d255..000000000 --- a/integration-test/marathon-api/project/build.properties +++ /dev/null @@ -1 +0,0 @@ -sbt.version=0.13.16 \ No newline at end of file diff --git a/integration-test/marathon-api/project/plugins.sbt b/integration-test/marathon-api/project/plugins.sbt deleted file mode 100644 index 3b2db136d..000000000 --- a/integration-test/marathon-api/project/plugins.sbt +++ /dev/null @@ -1 +0,0 @@ -addSbtPlugin("com.typesafe.sbt" % "sbt-native-packager" % "1.3.2") \ No newline at end of file diff --git a/integration-test/marathon-api/src/main/resources/application.conf b/integration-test/marathon-api/src/main/resources/application.conf deleted file mode 100644 index c2ee4a769..000000000 --- a/integration-test/marathon-api/src/main/resources/application.conf +++ /dev/null @@ -1,29 +0,0 @@ -akka { - actor { - provider = "cluster" - } - - remote { - netty.tcp { - port = 2551 - } - } - - management { - http { - port = 8558 - } - } - - management { - cluster.bootstrap { - contact-point-discovery { - stable-margin = 5 seconds - discovery-method = marathon-api - } - contact-point { - fallback-port = 8558 - } - } - } -} diff --git a/integration-test/marathon-api/src/main/scala/akka/cluster/bootstrap/DemoApp.scala b/integration-test/marathon-api/src/main/scala/akka/cluster/bootstrap/DemoApp.scala deleted file mode 100644 index 5df32c22a..000000000 --- a/integration-test/marathon-api/src/main/scala/akka/cluster/bootstrap/DemoApp.scala +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (C) 2017 Lightbend Inc. - */ - -package akka.cluster.bootstrap - -import akka.actor.ActorSystem -import akka.cluster.{ Cluster, MemberStatus } -import akka.http.scaladsl.Http -import akka.http.scaladsl.model._ -import akka.http.scaladsl.server.Directives._ -import akka.management.scaladsl.AkkaManagement -import akka.management.cluster.bootstrap.ClusterBootstrap - -object DemoApp extends App { - implicit val system = ActorSystem("my-system") - - val cluster = Cluster(system) - - def isReady() = { - val selfNow = cluster.selfMember - - selfNow.status == MemberStatus.Up - } - - def isHealthy() = { - isReady() - } - - val route = - concat( - path("ping")(complete("pong!")), - path("healthy")(complete(if (isHealthy()) StatusCodes.OK else StatusCodes.ServiceUnavailable)), - path("ready")(complete(if (isReady()) StatusCodes.OK else StatusCodes.ServiceUnavailable))) - - AkkaManagement(system).start() - ClusterBootstrap(system).start() - - Http().bindAndHandle( - route, - sys.env.get("HOST").getOrElse("127.0.0.1"), - sys.env.get("PORT_HTTP").map(_.toInt).getOrElse(8080)) -}