gRPC Integration
gRPC is currently available for self-hosted deployments and supports unary requests and responses today.
In addition to REST and GraphQL based APIs, Retool supports connecting to services via gRPC. Here is how you can setup gRPC endpoints for your deployment.
gRPC Setup
1. Update Retool to the latest build
./update_retool.sh
2. Add proto files
On the host machine create a protos/ folder and add the .proto files into there
3. Mount Volumes
In the docker-compose.yml
add
- ./protos:/retool_backend/protos
to the 3 volume sections for api, db-connector and db-ssh-connector
4. Add folder path ENV Variable
In docker.env
add the path to the proto files
PROTO_DIRECTORY_PATH=/retool_backend/protos
Retool will automatically include the Google proto files and the /retool_backend/protos
folder in the include directories. If your proto files use imports which rely on a different base folder you can add that directory to the PROTO_IMPORT_DIRECTORY_PATH
environment variable and it will also include that path.
5. Restart Retool
sudo docker-compose up -d
Creating a gRPC Resource
Â
Now that your proto files are setup you should be able to select gRPC under APIs and see the service names for your proto files in the list:
Self-signed and client certs
For self signed certs you can set the path to the .pem
file in the NODE_EXTRA_CA_CERTS
environment variable: https://docs.retool.com/docs/configure-ssl-certificates
For client side certs you can add those into the resource form:
Once you have a resource connected you can create a query using it. The methods/rpc’s for that service will be available in the query. Placeholder JSON is generated to match the Request message.
Then you can use your query in your apps
Let us know if you have any questions or run into any roadblocks!
Updated 3 months ago