...

Command stop-service

contains an example of how to use the /internal/ api of gRPC servers to shutdown a server gracefully.