Skip to content

Commit

Permalink
⬆️ Update to play 3 and start use pekko instead of akka (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
realstraw authored Jan 25, 2024
1 parent 65cd701 commit ae1b3bf
Show file tree
Hide file tree
Showing 23 changed files with 56 additions and 58 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Orchard is an orchestration service that manages data pipelines, compute workflo
Inspired by AWS' [Data Pipeline](https://aws.amazon.com/datapipeline/) service, Orchard is designed for enterprise use-cases that demand security, extreme concurrency, granular control over the resource lifecycle, and flexible integration with a cloud-based microservice architecture.

## Design
Like Apache Spark, Orchard is written in functional Scala. This gives Orchard the power of Scala's well-developed concurrency features, and in particular, the Actor pattern as enabled by Scala's [Akka](https://github.com/akka/akka) library.
Like Apache Spark, Orchard is written in functional Scala. This gives Orchard the power of Scala's well-developed concurrency features, and in particular, the Actor pattern as enabled by Scala's [Pekko](https://pekko.apache.org/) library.

## Setup
Orchard is designed to be deployed into a cloud environment as a service, but can alternatively be set up locally for exploration and development. To do so, follow these steps.
Expand Down
20 changes: 9 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
val slickVersion = "3.4.1"
// make sure this is the same as the playWS's dependency
val akkaVersion = "2.6.21"
val playJsonVersion = "2.9.4"
val awsVersion = "2.20.+"
val pekkoVersion = "1.0.2"
val playJsonVersion = "3.0.2"
val awsVersion = "2.23.+"
val stubbornVersion = "3.1.0"
val prometheusVersion = "0.16.0"

Expand All @@ -14,9 +14,9 @@ val awsSns = "software.amazon.awssdk" % "sns"
val slick = "com.typesafe.slick" %% "slick" % slickVersion
val slickHikaricp = "com.typesafe.slick" %% "slick-hikaricp" % slickVersion
val postgresql = "org.postgresql" % "postgresql" % "42.6.0"
val playJson = "com.typesafe.play" %% "play-json" % playJsonVersion
val akkaActor = "com.typesafe.akka" %% "akka-actor-typed" % akkaVersion
val akkaTestkit = "com.typesafe.akka" %% "akka-actor-testkit-typed" % akkaVersion % Test
val playJson = "org.playframework" %% "play-json" % playJsonVersion
val pekkoActor = "org.apache.pekko" %% "pekko-actor-typed" % pekkoVersion
val pekkoTestkit = "org.apache.pekko" %% "pekko-actor-testkit-typed" % pekkoVersion % Test

val scalaTestArtifact = "org.scalatest" %% "scalatest" % "3.2.17" % Test
val scalaPlusPlay = "org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test
Expand Down Expand Up @@ -60,8 +60,8 @@ lazy val orchardCore = (project in file("orchard-core")).
slickHikaricp,
postgresql,
playJson,
akkaActor,
akkaTestkit,
pekkoActor,
pekkoTestkit,
logback % Test,
stubbornArtifact
)
Expand All @@ -86,9 +86,7 @@ lazy val orchardWS = (project in file("orchard-ws")).
// the transitive jackson dependencies from play framework on has security vulnerabilities
"com.fasterxml.jackson.core" % "jackson-databind" % "2.15.3",
"com.fasterxml.jackson.core" % "jackson-core" % "2.15.3",
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.15.3",
"com.google.guava" % "guava" % "32.1.3-jre",
"io.netty" % "netty-codec" % "4.1.100.Final"
"com.fasterxml.jackson.module" %% "jackson-module-scala" % "2.15.3"
)
).
dependsOn(orchardCore, orchardProviderAWS)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package com.salesforce.mce.orchard.db

import java.time.LocalDateTime

import scala.compat.java8.DurationConverters._
import scala.jdk.DurationConverters._
import scala.concurrent.duration.FiniteDuration

import slick.jdbc.PostgresProfile.api._
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import java.util.UUID

import scala.concurrent.duration._

import akka.actor.typed.scaladsl.{ActorContext, Behaviors, TimerScheduler}
import akka.actor.typed.{ActorRef, Behavior}
import org.apache.pekko.actor.typed.scaladsl.{ActorContext, Behaviors, TimerScheduler}
import org.apache.pekko.actor.typed.{ActorRef, Behavior}

import com.salesforce.mce.orchard.OrchardSettings
import com.salesforce.mce.orchard.db.{OrchardDatabase, WorkflowManagerQuery, WorkflowQuery}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

package com.salesforce.mce.orchard.system.actor

import akka.actor.typed.scaladsl._
import akka.actor.typed.{ActorRef, Behavior}
import org.apache.pekko.actor.typed.scaladsl._
import org.apache.pekko.actor.typed.{ActorRef, Behavior}

import com.salesforce.mce.orchard.db.{ActionQuery, ActionTable, OrchardDatabase}
import com.salesforce.mce.orchard.model.{ActionCondition, ActionStatus, Status}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package com.salesforce.mce.orchard.system.actor

import scala.util.{Failure, Success}

import akka.actor.typed.scaladsl._
import akka.actor.typed.{ActorRef, Behavior}
import org.apache.pekko.actor.typed.scaladsl._
import org.apache.pekko.actor.typed.{ActorRef, Behavior}
import play.api.libs.json.JsValue

import com.salesforce.mce.orchard.io.ActionIO
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ package com.salesforce.mce.orchard.system.actor
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext

import akka.actor.typed._
import akka.actor.typed.scaladsl._
import org.apache.pekko.actor.typed._
import org.apache.pekko.actor.typed.scaladsl._
import play.api.libs.json.JsValue

import com.salesforce.mce.orchard.db.{ActivityAttemptQuery, OrchardDatabase}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package com.salesforce.mce.orchard.system.actor

import scala.concurrent.duration.FiniteDuration

import akka.actor.typed.scaladsl._
import akka.actor.typed.{ActorRef, Behavior}
import org.apache.pekko.actor.typed.scaladsl._
import org.apache.pekko.actor.typed.{ActorRef, Behavior}
import play.api.libs.json.JsValue

import com.salesforce.mce.orchard.OrchardSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import java.time.{Duration => JDuration, LocalDateTime}
import scala.concurrent.duration._
import scala.jdk.DurationConverters._

import akka.actor.typed._
import akka.actor.typed.scaladsl._
import org.apache.pekko.actor.typed._
import org.apache.pekko.actor.typed.scaladsl._
import play.api.libs.json.JsValue

import com.salesforce.mce.orchard.db.{OrchardDatabase, ResourceInstanceQuery}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ package com.salesforce.mce.orchard.system.actor

import scala.concurrent.duration._

import akka.actor.typed._
import akka.actor.typed.scaladsl._
import org.apache.pekko.actor.typed._
import org.apache.pekko.actor.typed.scaladsl._
import play.api.libs.json.{JsError, JsSuccess, JsValue}

import com.salesforce.mce.orchard.OrchardSettings
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

package com.salesforce.mce.orchard.system.actor

import akka.actor.typed._
import akka.actor.typed.scaladsl._
import org.apache.pekko.actor.typed._
import org.apache.pekko.actor.typed.scaladsl._

import com.salesforce.mce.orchard.OrchardSettings
import com.salesforce.mce.orchard.db.{OrchardDatabase, WorkflowQuery}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

package com.salesforce.mce.orchard

import akka.actor.typed.scaladsl.ActorContext
import akka.actor.typed.scaladsl.AbstractBehavior
import akka.actor.typed.Behavior
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
import org.apache.pekko.actor.typed.scaladsl.ActorContext
import org.apache.pekko.actor.typed.scaladsl.AbstractBehavior
import org.apache.pekko.actor.typed.Behavior
import org.apache.pekko.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
import org.scalatest.wordspec.AnyWordSpecLike
import akka.actor.typed.scaladsl.Behaviors
import akka.actor.typed.ActorRef
import org.apache.pekko.actor.typed.scaladsl.Behaviors
import org.apache.pekko.actor.typed.ActorRef

object AdhocActor {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ package com.salesforce.mce.orchard

import scala.concurrent.duration._

import akka.actor.typed._
import akka.actor.typed.scaladsl._
import akka.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
import org.apache.pekko.actor.typed._
import org.apache.pekko.actor.typed.scaladsl._
import org.apache.pekko.actor.testkit.typed.scaladsl.ScalaTestWithActorTestKit
import org.scalatest.wordspec.AnyWordSpecLike

object SelfMessage {
Expand Down
4 changes: 2 additions & 2 deletions orchard-ws/app/Module.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.time.Clock

import com.google.inject.AbstractModule
import play.api.libs.concurrent.AkkaGuiceSupport
import play.api.libs.concurrent.PekkoGuiceSupport

import services._
import tasks.AuthSettingReloadTask
Expand All @@ -23,7 +23,7 @@ import utils.{Authorization, AuthorizationSettings}
* adding `play.modules.enabled` settings to the `application.conf`
* configuration file.
*/
class Module extends AbstractModule with AkkaGuiceSupport {
class Module extends AbstractModule with PekkoGuiceSupport {

override def configure() = {
// Use the system clock as the default implementation of Clock
Expand Down
2 changes: 1 addition & 1 deletion orchard-ws/app/controllers/AsyncController.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ package controllers

import javax.inject._

import akka.actor.ActorSystem
import org.apache.pekko.actor.ActorSystem
import play.api.mvc._

import scala.concurrent.duration._
Expand Down
8 changes: 4 additions & 4 deletions orchard-ws/app/services/OrchardSystemService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import javax.inject._

import scala.concurrent.duration._

import akka.actor.ActorSystem
import akka.actor.typed.{ActorRef, Behavior, SupervisorStrategy}
import akka.actor.typed.scaladsl.Behaviors
import akka.actor.typed.scaladsl.adapter._
import org.apache.pekko.actor.ActorSystem
import org.apache.pekko.actor.typed.{ActorRef, Behavior, SupervisorStrategy}
import org.apache.pekko.actor.typed.scaladsl.Behaviors
import org.apache.pekko.actor.typed.scaladsl.adapter._
import play.api.Configuration

import com.salesforce.mce.orchard.OrchardSettings
Expand Down
2 changes: 1 addition & 1 deletion orchard-ws/app/tasks/AuthSettingReloadTask.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import javax.inject.Inject

import scala.concurrent.ExecutionContext

import akka.actor.ActorSystem
import org.apache.pekko.actor.ActorSystem
import play.api.Logging

import utils.Authorization
Expand Down
2 changes: 1 addition & 1 deletion orchard-ws/app/utils/MetricFilter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package utils
import javax.inject.Inject

import scala.concurrent.{ExecutionContext, Future}
import akka.stream.Materializer
import org.apache.pekko.stream.Materializer

import play.api.mvc.{Filter, RequestHeader, Result}

Expand Down
14 changes: 7 additions & 7 deletions orchard-ws/conf/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -36,20 +36,20 @@ orchard.auth = {
# restart-jitter-probability = 0.1 # between 0 and 1
# }

## Akka
# https://www.playframework.com/documentation/latest/ScalaAkka#Configuration
# https://www.playframework.com/documentation/latest/JavaAkka#Configuration
## Pekko
# https://www.playframework.com/documentation/latest/ScalaPekko#Configuration
# https://www.playframework.com/documentation/latest/JavaPekko#Configuration
# ~~~~~
# Play uses Akka internally and exposes Akka Streams and actors in Websockets and
# Play uses Pekko internally and exposes Pekko Streams and actors in Websockets and
# other streaming HTTP responses.
akka {
# "akka.log-config-on-start" is extraordinarly useful because it log the complete
pekko {
# "pekko.log-config-on-start" is extraordinarly useful because it log the complete
# configuration at INFO level, including defaults and overrides, so it s worth
# putting at the very top.
#
# Put the following in your conf/logback.xml file:
#
# <logger name="akka.actor" level="INFO" />
# <logger name="org.apache.pekko.actor" level="INFO" />
#
# And then uncomment this line to debug the configuration.
#
Expand Down
2 changes: 1 addition & 1 deletion orchard-ws/conf/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<logger name="application" level="DEBUG" />
<logger name="com.salesforce.mce.orchard.system" level="INFO" />
<!-- this is the root actor created by play -->
<logger name="akka.actor.ActorCell" level="INFO" />
<logger name="org.apache.pekko.actor.ActorCell" level="INFO" />

<!-- Off these ones as they are annoying, and anyway we manage configuration ourselves -->
<logger name="com.avaje.ebean.config.PropertyMapLoader" level="OFF" />
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.3
sbt.version=1.9.8
2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.1")
addSbtPlugin("org.playframework" % "sbt-plugin" % "3.0.1")

addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")

Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ThisBuild / version := "0.20.13"
ThisBuild / version := "0.21.0"

0 comments on commit ae1b3bf

Please sign in to comment.