knoxcoder
08/29/2023, 7:49 PMversion: '3.9'
services:
db:
image: postgres:15
restart: always
container_name: platform-db
ports:
- '5432:5432'
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: platform
healthcheck:
test: pg_isready -U postgres -p 5432 -d platform
interval: 1s
timeout: 3s
retries: 5
spicedb:
image: authzed/spicedb:latest
container_name: platform-spicedb
restart: always
command: 'serve-testing --load-configs /app/spicedb/schema.yaml'
ports:
- '50051:50051'
environment:
- SPICEDB_GRPC_PRESHARED_KEY=local
- SPICEDB_DATASTORE_ENGINE=postgres
- SPICEDB_DATASTORE_CONN_URI=postgres://postgres:postgres@db:5432/platform
- SPICEDB_GRPC_ADDR=:${SPICEDB_PORT:-50051}
- SPICEDB_METRICS_ENABLED=false
- SPICEDB_TELEMETRY_ENDPOINT=
volumes:
- ./data/spicedb/:/app/spicedb/
depends_on:
db:
condition: service_healthy
healthcheck:
test:
[
"CMD",
"/usr/local/bin/grpc_health_probe",
"-addr",
"spicedb:50051",
]
interval: 3s
timeout: 3s
retries: 5
it runs fine initially but then i start hitting Error: 2 UNKNOWN: failed to load config files: open /app/spicedb/schema.yaml: no such file or directory after awhile and the only way to fix it is to restart the container. Have I missed something in the compose file?vroldanbet
08/29/2023, 7:52 PMserve-testing with a datastore?knoxcoder
08/29/2023, 7:56 PMvroldanbet
08/29/2023, 7:57 PM--datastore-bootstrap-files command of spicedb serve (or its equivalent env variable SPICEDB_DATASTORE_BOOTSTRAP_FILESvroldanbet
08/29/2023, 7:57 PMknoxcoder
08/29/2023, 7:57 PMvroldanbet
08/29/2023, 7:57 PMserve-testing is meant to be used with a datastore. It's just an in-memory datastore that you typically use in test suitesknoxcoder
08/29/2023, 7:58 PMvroldanbet
08/29/2023, 7:58 PMknoxcoder
08/29/2023, 7:58 PMknoxcoder
08/29/2023, 7:58 PMvroldanbet
08/29/2023, 7:58 PMserve-testingknoxcoder
08/29/2023, 7:59 PMvroldanbet
08/29/2023, 7:59 PMserve-testing yesknoxcoder
08/29/2023, 7:59 PMvroldanbet
08/29/2023, 8:00 PMknoxcoder
08/29/2023, 8:01 PMJoey
08/29/2023, 8:05 PMopen /app/spicedb/schema.yaml: no such file or directoryvroldanbet
08/29/2023, 8:05 PMserve-testing is the right tool for the job when running unit tests in your CI pipeline, and also when running unit-testing locallyJoey
08/29/2023, 8:05 PMvroldanbet
08/29/2023, 8:06 PMserve instead of serve-testing.knoxcoder
08/29/2023, 8:06 PMvroldanbet
08/29/2023, 8:06 PMserve-testing = serve with memdb datastore, and one new memdb instance per preshared keyknoxcoder
08/29/2023, 8:07 PMJoey
08/29/2023, 8:07 PMvroldanbet
08/29/2023, 8:10 PMserve-testing mode. Maybe you docker run -ti into the container and see what's up. I recommend using the authzed/spicedb:latest-debug container image so you get a busybox in the containerknoxcoder
08/29/2023, 8:39 PMuthzed/spicedb:latest-debug imagevroldanbet
08/29/2023, 9:54 PMknoxcoder
08/30/2023, 5:25 PMvroldanbet
08/30/2023, 7:59 PM