0

I'm trying to use GCP Cloud run to host both a REST and a gRPC service. I'm using sonora to multiplex the server so to be able to use the same port (443) for both services.

This is my init application so far:

from flask import Flask
from sonora.wsgi import grpcWSGI
from app.services.api.analyse.v1 import servicer
from app.domain.entity.analysis.proto.analysis_pb2_grpc import add_AnalyserServicer_to_server
from app.services.api.health.v1.health import health_check_blueprint
from app.services.api.analyse.v1.analyse import analyse_blueprint

app = Flask(__name__)

app.register_blueprint(health_check_blueprint)
app.register_blueprint(analyse_blueprint)

app.wsgi_app = grpcWSGI(app.wsgi_app)
add_AnalyserServicer_to_server(servicer, app)

But unfortunately I'm getting the error in the title when using my client to hit the gRPC function.

The REST endpoint seems to be working just fine.

The cmd in my Dockerfile stands as follows:

CMD exec gunicorn --bind :${PORT} --workers 1 --threads 8 --timeout 0 --log-level=error app.services.server.v1:app
nicolasassi
  • 490
  • 4
  • 14
  • You cannot have two connection with same three parameter 1) Source IP 2) Destination IP 3) Port number. If both apps are using local host it won't work. Also port number 443 ,may be blocked by virus checker. If you change the order of connecting to the two services from client what happens? – jdweng Jun 02 '21 at 23:45
  • In cloud run 443 is the port for gRPC requests. The idea is to multiplex the server to be able to use the same Source, IP and PORT to both requests. Seems that the goal of Sonora is to achive that. I think I can't change the order :/ – nicolasassi Jun 02 '21 at 23:49
  • Switching the is only a test to see if the port is really the issue. If the second app connects when it is run first than you know it is the reuse of the port number. – jdweng Jun 03 '21 at 09:24

0 Answers0