Closed bhardwahnitish19 closed 3 years ago
How did you build the image with grpc server?
Regarding server started twice - because you enabled inpoc server, -1
is its port
I created a jar using gradle and ran docker build . -t xxxx-node
Can you share your. dockerfile? You are running image: node
in your compose file... right?
yes, updated the question with Dockerfile. Actually, it'simage: xxxx-node,
the same name that is being used in the image tag.
Can you try to pass environment variable GRPC_PORT=7575
in docker compose and bind 8121 to 7575?
Just tried it, but it's ignored too as it's being ignored in local IDE. The server started on 6565.
distc-node1 | 2021-04-22 15:32:07.211 INFO 1 --- [ main] o.l.springboot.grpc.GRpcServerRunner : gRPC Server started, listening on port 6565.
distc-node1 | 2021-04-22 15:32:07.213 INFO 1 --- [ main] o.l.springboot.grpc.GRpcServerRunner : Starting gRPC Server ...
docker-compose.yaml
version: '2'
networks:
basic:
external:
name: cluster
services:
distc-node:
container_name: distc-node1
image: distc-node
environment:
- GRPC_PORT=7575
- SERVER_NAME=Distc-node1
- NETTY_KEEP_ALIVE_TIME=30s
- NETTY_MAX_INBOUND_MESSAGE_SIZE=500MB
- NETTY_LISTEN_ADDRESS=:6565
- GOSSIP_ROUNDS=2
- GOSSIP_FANOUT=2
- GOSSIP_CLIENT_ID=127.0.0.1:7575
- TIMER=5
ports:
- "8121:7575"
- "8122:6767"
Can you show the IDE settings how you run your app? Can try also with --grpc.port=7575
argument from IDE?
I changed NETTY_LISTEN_ADDRESS=:6565
to NETTY_LISTEN_ADDRESS=:7575
and kept everything as is in docker-compose.yaml, I can see the log that this time server has started on 7575
distc-node1 | 2021-04-22 16:03:20.673 INFO 1 --- [ main] o.l.springboot.grpc.GRpcServerRunner : 'com.jio.distc.grpc.service.HelloService' service has been registered.
distc-node1 | 2021-04-22 16:03:20.688 INFO 1 --- [ main] o.l.springboot.grpc.GRpcServerRunner : 'io.grpc.protobuf.services.ProtoReflectionService' service has been registered.
distc-node1 | 2021-04-22 16:03:20.833 INFO 1 --- [ main] o.l.springboot.grpc.GRpcServerRunner : gRPC Server started, listening on port 7575.
But, still getting the same error from GRPC client
I am using the same setting/config in application.yaml. When I use NETTY_LISTEN_ADDRESS=:7575
server in IDE starts at 7575
.
I am able to access API using localhost 127.0.0.1 when the server is running in IDE. But, it's unreachable as docker container.
Don't you need to expose port in docker file?
Also, I haven't seen double quotes being used when binding ports in compose file
Yeah, but even that doesn't help. Exposed port 7575 in docker file and server started on 7575 as a docker container. But, still getting the same error.
{
"error": "2 UNKNOWN: Stream removed"
}
I guess we can use double quotes in docker-compose to bind ports.
Please check this same: https://github.com/hyperledger/fabric-samples/blob/main/test-network/docker/docker-compose-couch.yaml
Try to remove primary-listen-address from application yaml
Thanks, it works on removing primary-listen-address
from application yaml. Server started on port 7575 and able to connect to docker container from bloomrpc.
Thanks a lot for your support and patience. :)
Yes, primarily listen address takes precedence over grpc.port property and is expected to be in host:port format. Missed that....
makes sense. Thanks @jvmlet really appreciate your support.
I am facing hard time overriding default port of grpc:6565. Strange thing is that the services starts twice, once over default port and then on port -1.
application.yaml
Moreover, grpc service is not accessible as a docker container.
Dockerfile
docker-compose.yaml
Logs from docker container:
But, the service doesn't work either on 8121 or 7575 or 6565
On 8121, an error returned:
On 6565 and 7575: