diff --git a/grpc-example/grpc-example-java/build.sbt b/grpc-example/grpc-example-java/build.sbt index 53bff607..fc24af44 100644 --- a/grpc-example/grpc-example-java/build.sbt +++ b/grpc-example/grpc-example-java/build.sbt @@ -9,9 +9,6 @@ version in ThisBuild := "1.0-SNAPSHOT" // the Java version that will be used for cross-compiled libraries scalaVersion in ThisBuild := "2.12.12" -lagomServiceEnableSsl in ThisBuild := true -val `hello-impl-HTTPS-port` = 11000 - val playGrpcRuntime = "com.lightbend.play" %% "play-grpc-runtime" % BuildInfo.playGrpcVersion val lagomGrpcTestkit = "com.lightbend.play" %% "lagom-javadsl-grpc-testkit" % BuildInfo.playGrpcVersion % Test // TODO remove after upgrade Akka gRPC @@ -42,10 +39,6 @@ lazy val `hello-impl` = (project in file("hello-impl")) ), akkaGrpcExtraGenerators in Compile += PlayJavaServerCodeGenerator, - // WORKAROUND: Lagom still can't register a service under the gRPC name so we hard-code - // the port and the use the value to add the entry on the Service Registry - lagomServiceHttpsPort := `hello-impl-HTTPS-port`, - libraryDependencies ++= Seq( lagomJavadslTestKit, lagomLogback, @@ -92,9 +85,8 @@ lagomKafkaEnabled in ThisBuild := false // This adds an entry on the LagomDevMode Service Registry. With this information on // the Service Registry a client using Service Discovery to Lookup("helloworld.GreeterService") -// will get "https://localhost:11000" and then be able to send a request. -// See declaration and usages of `hello-impl-HTTPS-port`. -lagomUnmanagedServices in ThisBuild := Map("helloworld.GreeterService" -> s"https://localhost:${`hello-impl-HTTPS-port`}") +// will get "http://localhost:11000" and then be able to send a request. +lagomUnmanagedServices in ThisBuild := Map("helloworld.GreeterService" -> s"http://127.0.0.1:11000") def common = Seq( diff --git a/grpc-example/grpc-example-java/hello-impl/pom.xml b/grpc-example/grpc-example-java/hello-impl/pom.xml index 86fdd712..35eccc79 100644 --- a/grpc-example/grpc-example-java/hello-impl/pom.xml +++ b/grpc-example/grpc-example-java/hello-impl/pom.xml @@ -104,9 +104,8 @@ lagom-maven-plugin true - ${hello-impl.https.port} + ${hello-impl.http.port} 127.0.0.1 - true diff --git a/grpc-example/grpc-example-java/hello-proxy-impl/pom.xml b/grpc-example/grpc-example-java/hello-proxy-impl/pom.xml index 8c600855..7c77e6fd 100644 --- a/grpc-example/grpc-example-java/hello-proxy-impl/pom.xml +++ b/grpc-example/grpc-example-java/hello-proxy-impl/pom.xml @@ -69,7 +69,6 @@ lagom-maven-plugin true - true diff --git a/grpc-example/grpc-example-java/hello-proxy-impl/src/main/resources/application.conf b/grpc-example/grpc-example-java/hello-proxy-impl/src/main/resources/application.conf index d99f7628..fd255755 100644 --- a/grpc-example/grpc-example-java/hello-proxy-impl/src/main/resources/application.conf +++ b/grpc-example/grpc-example-java/hello-proxy-impl/src/main/resources/application.conf @@ -9,12 +9,12 @@ akka.grpc.client { service-discovery { mechanism = "lagom-dev-mode" service-name = "helloworld.GreeterService" - port-name = "https" + port-name = "http" } override-authority = "localhost" deadline = 5s connection-attempts = 5 + use-tls = false } } - diff --git a/grpc-example/grpc-example-java/pom.xml b/grpc-example/grpc-example-java/pom.xml index e1fe1817..42d21d8b 100644 --- a/grpc-example/grpc-example-java/pom.xml +++ b/grpc-example/grpc-example-java/pom.xml @@ -36,7 +36,7 @@ false false - https://127.0.0.1:${hello-impl.https.port} + http://127.0.0.1:${hello-impl.http.port} @@ -82,6 +82,6 @@ 1.0.2 0.9.1 - 11000 + 11000 diff --git a/grpc-example/grpc-example-java/ssl-lagom b/grpc-example/grpc-example-java/ssl-lagom deleted file mode 100755 index 626bab6f..00000000 --- a/grpc-example/grpc-example-java/ssl-lagom +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -## Based on https://github.com/playframework/play-scala-tls-example/edit/2.5.x/play -## All JVM_XXX options are removed because Lagom does a different handling of SSL -## than Play. Only the ALPN Agent setup is relevant for Lagom. - -# ssl-play requires an ALPN Agent. This is downdloaded and stored in the target -# folder of each subproject that needs ALPN enabled. -# This snippet detects when the ALPN agent hasn't been downloaded yet and runs -# `sbt stage` to obtain it. -export AGENT_TEST=$(pwd)/$(find . -name 'jetty-alpn-agent-*.jar') -export NUM_AGENTS_FOUND=$(echo $AGENT_TEST| grep target | wc -l) - -if [ $NUM_AGENTS_FOUND -eq "0" ]; then - sbt stage; -fi - -# Start `sbt` with the JVM_OPTIONS and the ALPN agent -export AGENT=$(pwd)/$(find . -name 'jetty-alpn-agent-*.jar' | head -1) -echo "Detected ALPN Agent: $AGENT " -export SBT_OPTS="$SBT_OPTS -javaagent:$AGENT" -# Run Play -sbt $JVM_OPTIONS $*; diff --git a/grpc-example/grpc-example-scala/build.sbt b/grpc-example/grpc-example-scala/build.sbt index 4826e39a..c6980c28 100644 --- a/grpc-example/grpc-example-scala/build.sbt +++ b/grpc-example/grpc-example-scala/build.sbt @@ -14,9 +14,6 @@ val lagomGrpcTestkit = "com.lightbend.play" %% "lagom-scaladsl-grpc-testkit" % B // TODO remove after upgrade Akka gRPC val akkaHttp = "com.typesafe.akka" %% "akka-http2-support" % "10.1.12" -lagomServiceEnableSsl in ThisBuild := true -val `hello-impl-HTTPS-port` = 11000 - def dockerSettings = Seq( dockerUpdateLatest := true, dockerBaseImage := "adoptopenjdk/openjdk8", @@ -24,12 +21,6 @@ def dockerSettings = Seq( dockerRepository := sys.props.get("docker.registry") ) -// ALL SETTINGS HERE ARE TEMPORARY WORKAROUNDS FOR KNOWN ISSUES OR WIP -def workaroundSettings: Seq[sbt.Setting[_]] = Seq( - // Lagom still can't register a service under the gRPC name so we hard-code - // the port and use the value to add the entry on the Service Registry - lagomServiceHttpsPort := `hello-impl-HTTPS-port` -) lazy val `lagom-scala-grpc-example` = (project in file(".")) .aggregate(`hello-api`, `hello-impl`, `hello-proxy-api`, `hello-proxy-impl`) @@ -51,8 +42,6 @@ lazy val `hello-impl` = (project in file("hello-impl")) AkkaGrpc.Client // the client is only used in tests. See https://github.com/akka/akka-grpc/issues/410 ), akkaGrpcExtraGenerators in Compile += PlayScalaServerCodeGenerator, - ).settings( - workaroundSettings:_* ).settings( libraryDependencies ++= Seq( lagomScaladslTestKit, @@ -81,6 +70,7 @@ lazy val `hello-proxy-impl` = (project in file("hello-proxy-impl")) libraryDependencies ++= Seq( lagomScaladslAkkaDiscovery, lagomScaladslTestKit, + playGrpcRuntime, akkaHttp, macwire, scalaTest @@ -101,13 +91,11 @@ lagomKafkaEnabled in ThisBuild := false // This adds an entry on the LagomDevMode Service Registry. With this information on // the Service Registry a client using Service Discovery to Lookup("helloworld.GreeterService") -// will get "https://localhost:11000" and then be able to send a request. -// See declaration and usages of `hello-impl-HTTPS-port`. -lagomUnmanagedServices in ThisBuild := Map("helloworld.GreeterService" -> s"https://localhost:${`hello-impl-HTTPS-port`}") +// will get "http://127.0.0.1:11000" and then be able to send a request. +lagomUnmanagedServices in ThisBuild := Map("helloworld.GreeterService" -> s"http://127.0.0.1:11000") //---------------------------------- - // Documentation for this project: // sbt "project docs" "~ paradox" // open docs/target/paradox/site/main/index.html diff --git a/grpc-example/grpc-example-scala/ssl-lagom b/grpc-example/grpc-example-scala/ssl-lagom deleted file mode 100755 index 626bab6f..00000000 --- a/grpc-example/grpc-example-scala/ssl-lagom +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -## Based on https://github.com/playframework/play-scala-tls-example/edit/2.5.x/play -## All JVM_XXX options are removed because Lagom does a different handling of SSL -## than Play. Only the ALPN Agent setup is relevant for Lagom. - -# ssl-play requires an ALPN Agent. This is downdloaded and stored in the target -# folder of each subproject that needs ALPN enabled. -# This snippet detects when the ALPN agent hasn't been downloaded yet and runs -# `sbt stage` to obtain it. -export AGENT_TEST=$(pwd)/$(find . -name 'jetty-alpn-agent-*.jar') -export NUM_AGENTS_FOUND=$(echo $AGENT_TEST| grep target | wc -l) - -if [ $NUM_AGENTS_FOUND -eq "0" ]; then - sbt stage; -fi - -# Start `sbt` with the JVM_OPTIONS and the ALPN agent -export AGENT=$(pwd)/$(find . -name 'jetty-alpn-agent-*.jar' | head -1) -echo "Detected ALPN Agent: $AGENT " -export SBT_OPTS="$SBT_OPTS -javaagent:$AGENT" -# Run Play -sbt $JVM_OPTIONS $*;