Docker requirements to connect with EventStore using EventStore.Client.Grpc.Streams C#

223 Views Asked by At

I just migrated one of my services to connect to Eventstore using the GRPC c# Library instead of TCP. I am running the following environment:

  • Eventstore OSS deployed on an azure virtual machine (outside of docker)
  • some services in local environment connecting to Eventstore via docker

If i run my api in kestrel (without docker), i can connect to the eventstore. But if i run the service with docker, i got the following exception

EventStore.Client.DiscoveryException: Failed to discover candidate in 10 attempts.

Connection string is:

"esdb+discover://{DNSName}:2113?keepAliveTimeout=10000&keepAliveInterval=10000"

where {DNSName} is a placeholder for the hostname.

I guess there are some network contraints failing. My question is about what's requirements must be fit to establish a connection? Any ports on the CLIENT that must be open?

After opening port 2113 in the docker Container meaning the following:

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
RUN apt-get update
RUN apt-get install -y netcat curl sudo iputils-ping dnsutils telnet vim less
EXPOSE 80
EXPOSE 443
EXPOSE 2113

in the Dockerfile and

    ports:
  - 8081:80
  - 2113:2113

in the docker-compose.yaml i can see that port 2113 is exposed. I am not an network specialist, but my test from telnet i got the following

telnet example.com 2113 Trying ip... Connected to example.com:2113. Escape character is '^]'.

Most recently I guess this indicates the ports are open and accessible?

Thanks in regards.

1

There are 1 best solutions below

4
ylorph On

The standard port is 2113, so the client & server must be able to communnicate over it.

your connection string should look either like ( I'm assuming single node)

esdb+discover://[host]:2113
esdb://[host]:2113

and Docker needs to expose the port :

   ports:
      - 2113:2113

( example Docker files for a multi node cluster here : https://github.com/EventStore/EventStore/blob/master/docker-compose.yml)

Related Questions in GRPC-C#