How to connect a with SpiceDB running inside a docker compose #1644
-
Hi, I'm playing around and getting familiar with SpiceDB, I have a service A that connects with SpiceDB. My SpiceDB always runs in docker. I can connect with SpiceDB from my machine (when I run the API locally). But once I dockerize the Any idea if I'm missing any configuration/flag? Thanks This is the docker-compose version: '3'
services:
spicedb:
image: authzed/spicedb:1.27.0
command: "serve"
restart: always
ports:
- "9351:50051"
environment:
SPICEDB_GRPC_PRESHARED_KEY: ${SPICEDB_KEY}
SPICEDB_DATASTORE_ENGINE: postgres
SPICEDB_DATASTORE_CONN_URI: postgres://${DB_USERNAME}:${DB_PASSWORD}@postgres:5432/spicedb?sslmode=${DB_SSL_MODE}
SPICEDB_METRICS_ENABLED: FALSE
service-a:
image: service-a:local
restart: always
ports:
- "9430:80"
environment:
API_HOST: "0.0.0.0"
API_PORT: 80
SPICEDB_HOST: spicedb
SPICEDB_PORT: 50051
# SPICEDB_PORT: 9351
SPICEDB_API_KEY: ${SPICEDB_KEY}
depends_on:
- spicedb This is the error I get from the container when I try to connect using the port
This is the error I get from the container when I try to connect using the port
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
As you noted, you are most likely hitting authzed/authzed-py#89. Here is the simplest example I could come up with that works and does not involve a python client: version: "3"
services:
spicedb:
image: "authzed/spicedb"
command: "serve"
restart: "always"
ports:
- "50051:50051"
environment:
- "SPICEDB_GRPC_PRESHARED_KEY=foobar"
- "SPICEDB_DATASTORE_ENGINE=memory"
my_service:
image: authzed/zed:latest
command: ["schema", "read", "--insecure=true", "--endpoint", "spicedb:50051", "--token", "foobar"]
restart: unless-stopped
depends_on:
- spicedb |
Beta Was this translation helpful? Give feedback.
-
I just change the implementation to use the HTTP Gateway instead of the gRPC server |
Beta Was this translation helpful? Give feedback.
As you noted, you are most likely hitting authzed/authzed-py#89. Here is the simplest example I could come up with that works and does not involve a python client: