Skip to content
Snippets Groups Projects
Verified Commit 1167f351 authored by Timm Fitschen's avatar Timm Fitschen
Browse files

Add ssl and rest to grpc

parent ca9b2078
No related branches found
No related tags found
2 merge requests!44Release 0.6,!43Merge f-GRPC-main to dev
Pipeline #5870 failed
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
<project.build.testSourceDirectory>src/test/java</project.build.testSourceDirectory> <project.build.testSourceDirectory>src/test/java</project.build.testSourceDirectory>
<protobuf.version>3.14.0</protobuf.version> <protobuf.version>3.14.0</protobuf.version>
<grpc.version>1.35.0</grpc.version> <grpc.version>1.35.0</grpc.version>
<netty-tcnative.version>2.0.34.Final</netty-tcnative.version>
</properties> </properties>
<repositories> <repositories>
<repository> <repository>
...@@ -184,6 +185,13 @@ ...@@ -184,6 +185,13 @@
<artifactId>grpc-netty</artifactId> <artifactId>grpc-netty</artifactId>
<version>${grpc.version}</version> <version>${grpc.version}</version>
</dependency> </dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative</artifactId>
<version>${netty-tcnative.version}</version>
<classifier>${os.detected.classifier}</classifier>
<scope>runtime</scope>
</dependency>
<dependency> <dependency>
<groupId>io.grpc</groupId> <groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId> <artifactId>grpc-protobuf</artifactId>
......
...@@ -354,7 +354,7 @@ public class CaosDBServer extends Application { ...@@ -354,7 +354,7 @@ public class CaosDBServer extends Application {
runHTTPSServer( runHTTPSServer(
port_https, port_http, port_redirect_https, initialConnections, maxTotalConnections); port_https, port_http, port_redirect_https, initialConnections, maxTotalConnections);
} }
GRPCServer.startServer(8080); GRPCServer.startServer(8080, 8443, 8070);
} }
private static void initDatatypes(final Access access) throws Exception { private static void initDatatypes(final Access access) throws Exception {
......
...@@ -2,12 +2,33 @@ package org.caosdb.server.grpc; ...@@ -2,12 +2,33 @@ package org.caosdb.server.grpc;
import io.grpc.Server; import io.grpc.Server;
import io.grpc.ServerBuilder; import io.grpc.ServerBuilder;
import io.grpcweb.GrpcPortNumRelay;
import io.grpcweb.JettyWebserverForGrpcwebTraffic;
import java.io.File;
import java.io.IOException; import java.io.IOException;
public class GRPCServer { public class GRPCServer {
public static void startServer(int port) throws IOException, InterruptedException { public static void startServer(int port_http, int port_https, int port_web)
Server server = ServerBuilder.forPort(port).addService(new EntityTransactionImpl()).build(); throws IOException, InterruptedException {
server.start(); Server https_server =
ServerBuilder.forPort(port_https)
.useTransportSecurity(
new File("/home/tf/ssl/server-certificates/localhost-belial/localhost-belial.pem"),
new File(
"/home/tf/ssl/server-certificates/localhost-belial/localhost-belial.key.pk8"))
.addService(new EntityTransactionImpl())
.build();
https_server.start();
Server http_server =
ServerBuilder.forPort(port_http).addService(new EntityTransactionImpl()).build();
http_server.start();
JettyWebserverForGrpcwebTraffic web = new JettyWebserverForGrpcwebTraffic(8070);
web.starts();
// grpc-web proxy needs to know the grpc-port# so it could connect to the grpc service.
GrpcPortNumRelay.setGrpcPortNum(port_http);
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment