-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
akka-cluster-typed 2.6 with jackson serialization; server
docker deployment; and more
#524
base: main
Are you sure you want to change the base?
Conversation
+ 2.6.9 -> 2.6.14 for scala 2.10 + 2.9.0 -> 2.10.0-RC5 for scala 2.12, 2.13
warnings about missing `()` when calling/ overriding some methods
Don't create class fields just for initializing other field
When testing in local machine (not in CI), the order of actual result list is not always [3,2,1]
+ server use reference.conf instead of application.conf so sbtRunner should use the same naming. + This also permit use config in this file in balancer/test which has sbtRunner as a Test dependency.
# Changes + Also use jackson for serialization instead of java-serializer. - Implement in utils/ PlayJackson.scala - Config in utils/ reference.conf - Config removed: warn-about-java-serializer-usage = false + Use Actor discovery [1], so: - Remove ActorReconnecting, SbtPing, SbtPong, SbtRunnerConnect, ActorConnected - server/ balancer don't need to know sbtRunner's host/port. So, we remove some configs such as: balancer.remote-hostname, remote-sbt-ports-start,.. + Type safe configuration: - Use ConfigLoader & EnrichedConfig from playframework. - Add some case classes: BalancerConf (in DispatchActor.scala), SbtConf (in SbtActor.scala) # Configs change: + Add `com.olegych.scastie.data-dir` # Other notes + There is no sender() and parent in akka typed [2] So, we need explicitly add `replyTo` ActorRef to several messages. + Supervision: When an exception is thrown and no supervision strategy is defined, then actor will stop in akka typed instead of restart as in classic [3] So, some actors, such as SbtActor need be explicitly supervising. + SbtProcess: Migrated from classic FSM to typed [4] # Refs [1] https://doc.akka.io/docs/akka/current/typed/actor-discovery.html [2] https://doc.akka.io/docs/akka/current/typed/from-classic.html#sender [3] https://doc.akka.io/docs/akka/current/typed/from-classic.html#supervision [4] https://doc.akka.io/docs/akka/current/typed/fsm.html
The previous JsValueDeserializer implementation is working but it's a bit hacking :D
Don't consume input source beyond the ending '}' location of the parsing JsObject
+ deploy, deployServer, deployQuick, deployLocal is now commandAliases instead of TaskKeys. + Add dockerCompose task + Run `server` by `docker run --network=host ...` instead of `java ...` + Fix: deployLocal fail if you don't have access to scastie-secrets github repo. + Also remove the unused RUNNER_PRODUCTION env variable
Don't need this logic as we are now running scastie in docker
+ Exception `e` always be `AskTimeoutException` + The `scalaJsContent` and `scalaJsSourceMapContent` may be very long Strings!
Why this PR?
|
Wow! I have been talking about migrating to akka typed for a while now, I agree it is clearer and can avoid several bugs.
In the past I have used Kryo serialization for across-jvm communication and it worked quite well with very little setup required.
|
@@ -272,7 +300,7 @@ class SbtProcess(runTimeout: FiniteDuration, | |||
|
|||
private def setInputs(inputs: Inputs): Unit = { | |||
val prompt = | |||
s"""shellPrompt := {_ => println(""); "$promptUniqueId" + "\\n "}""" | |||
s"""shellPrompt := {_ => println("$promptUniqueId"); "> "}""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#520 (comment) I solved the problem mentioned in your issues by using the nix environment provided in the repo for running the project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@giabao please revert this as it breaks output parsing #520 (comment)
Would it be possible to split this PR into smaller ones?
I am ok with merging the upgrade with one of the other two although I think that the docker and vagrant modifications should be separated from the akka typed ones |
} | ||
|
||
import ProgressActor._ | ||
class ProgressActor private (ctx: ActorContext[Message]) extends AbstractBehavior[Message](ctx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could define a more precise hierarchy of messages.
ProgressActor
only needs to manage a small subset of the Message
subclasses
} | ||
} | ||
|
||
private def _reloading(sbtRun: SbtRun): PartialFunction[Event, Behavior[Event]] = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of a partial function, you can define here a Behavior[ProcessOutputEvent]
and then compose this more specific behaviors (the same applies for the other _bla
methods)
import scala.annotation.{switch, tailrec} | ||
import scala.collection.mutable.{ArrayBuffer, ListBuffer} | ||
|
||
class PlayJsonDeserializer[T: Reads](cls: Class[T]) extends StdDeserializer[T](cls) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is all this necessary?
@patriknw perhaps someone from the Akka team would enjoy taking a look at the Akka aspect of this? |
is there a specific reason or question, or just for fun? |
just for fun. and since Scastie is an important utility for the Scala community and it's cool to see it using Akka, especially if it can get on modern Akka |
@giabao this seems rather fragile https://github.com/giabao/scastie/blob/8c204aa22c6e4fe097235e5b801ea71a56026afe/utils/src/main/scala/com.olegych.scastie/util/PlayJackson.scala#L24-L30 |
@giabao i did a rebase at https://github.com/scalacenter/scastie/tree/akka-typed
can you take a look at it? |
?w=1
(or&w=1
) to the url to ignore white space changes.Sometimes, the code block are indent at a different level compare to the old code.
sbt deploy
task.deploy
task will deployserver
as a container with--network=host
. sbtRunners are deployed using docker as before.deploy
task:scastie.scala-lang.org
.server
which is run usingjava .. -jar ..
. You need manually stop the old server.