Skip to content
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

Enable gRPC server reflection and CORS on HTTP service #2698

Merged
merged 5 commits into from
Sep 2, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ lazy val node = (project in file("node"))
apiServerDependencies ++ commonDependencies ++ kamonDependencies ++ protobufDependencies ++ Seq(
catsCore,
grpcNetty,
grpcServices,
jline,
scallop,
scalaUri,
Expand Down
14 changes: 14 additions & 0 deletions models/src/main/protobuf/DeployService.proto
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,17 @@ message WaitingContinuationInfo {
repeated BindPattern postBlockPatterns = 1;
Par postBlockContinuation = 2;
}

// This type holds return types for success values inside Either for deploy service methods
message DeployEitherMeta {
DeployServiceResponse DoDeploy = 1;
BlockQueryResponse getBlock = 2;
VisualizeBlocksResponse visualizeDag = 3;
LightBlockInfo showMainChain = 4;
LightBlockInfo getBlocks = 5;
ListeningNameDataResponse listenForDataAtName = 6;
ListeningNameContinuationResponse listenForContinuationAtName = 7;
LightBlockQueryResponse findDeploy = 8;
PrivateNamePreviewResponse previewPrivateNames = 9;
BlockQueryResponse lastFinalizedBlock = 10;
}
7 changes: 4 additions & 3 deletions node/src/main/scala/coop/rchain/node/NodeRuntime.scala
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import monix.eval.{Task, TaskLocal}
import monix.execution.Scheduler
import org.http4s.implicits._
import org.http4s.server.blaze._
import org.http4s.server.middleware._
import org.http4s.server.Router

import scala.concurrent.duration._
Expand Down Expand Up @@ -141,9 +142,9 @@ class NodeRuntime private[node] (
.bindHttp(conf.server.httpPort, "0.0.0.0")
.withHttpApp(
Router(
"/metrics" -> prometheusService,
"/version" -> VersionInfo.service[Task],
"/status" -> StatusInfo.service[Task]
"/metrics" -> CORS(prometheusService),
"/version" -> CORS(VersionInfo.service[Task]),
"/status" -> CORS(StatusInfo.service[Task])
).orNotFound
)
.resource
Expand Down
2 changes: 2 additions & 0 deletions node/src/main/scala/coop/rchain/node/api/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import coop.rchain.node.model.repl._
import coop.rchain.rholang.interpreter.Runtime
import coop.rchain.shared._
import io.grpc.netty.NettyServerBuilder
import io.grpc.protobuf.services.ProtoReflectionService
import monix.eval.Task
import monix.execution.Scheduler

Expand Down Expand Up @@ -70,6 +71,7 @@ package object api {
ProposeServiceGrpcMonix
.bindService(ProposeGrpcService.instance(blockApiLock, tracing), grpcExecutor)
)
.addService(ProtoReflectionService.newInstance())
.build
)
}
1 change: 1 addition & 0 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ object Dependencies {
val scalapbRuntimeLib = "com.thesamet.scalapb" %% "scalapb-runtime" % scalapb.compiler.Version.scalapbVersion
val scalapbRuntimegGrpc = "com.thesamet.scalapb" %% "scalapb-runtime-grpc" % scalapb.compiler.Version.scalapbVersion
val grpcNetty = "io.grpc" % "grpc-netty" % scalapb.compiler.Version.grpcJavaVersion
val grpcServices = "io.grpc" % "grpc-services" % scalapb.compiler.Version.grpcJavaVersion
val nettyBoringSsl = "io.netty" % "netty-tcnative-boringssl-static" % "2.0.8.Final"
val nettyTcnative = "io.netty" % "netty-tcnative" % "2.0.8.Final" classifier osClassifier
val nettyTcnativeLinux = "io.netty" % "netty-tcnative" % "2.0.8.Final" classifier "linux-x86_64"
Expand Down