Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Read-Only API in production usage. #1729

Open
winstaan74 opened this issue Jan 31, 2024 · 9 comments
Open

Allow Read-Only API in production usage. #1729

winstaan74 opened this issue Jan 31, 2024 · 9 comments
Labels
kind/proposal Something fundamentally needs to change state/gauging interest This needs to be championed before being worked on

Comments

@winstaan74
Copy link

Problem Statement

We have a use case where a single service writes relationships to SpiceDB, but other services will be calling SpiceDB to checkPermissions.

The serve-testing mode provides a read-only API on a different port.

I'd like to propose an option to enable the read-only API in the production serve mode.

If this was available then network policies, etc could be used to ensure that services that should only be checking permissions could never accidentally write to SpiceDB.

Solution Brainstorm

No response

@winstaan74 winstaan74 added the kind/proposal Something fundamentally needs to change label Jan 31, 2024
@vroldanbet
Copy link
Contributor

@winstaan74 spicedb serve offers --datastore-readonly. Does that not work for you?

@winstaan74
Copy link
Author

Hey @vroldanbet !. I don't think --datstore-readonly is what I need - because as far as I understand it makes the entire datastore readonly.

I'd still like to have single privileged service writing relationships - but would like to ensure other services can't accidently trample the relationships.

@vroldanbet
Copy link
Contributor

@winstaan74 got it. As a workaround for now, you could have 2 clusters using the same datastore. One handles writes, and the other one has --datastore-readonly enabled.

So if I understand correctly, you'd like to see the API exposed in two different ports, one that has write access, and another that is readonly, correct?

@winstaan74
Copy link
Author

Ohh 2 clusters - ok. interesting tip. thanks.

Yep - two different ports was what I was thinking - inspired by the serve-testing setup. but maybe separate clusters solves the problem already.

@josephschorr
Copy link
Member

Separate clusters also allows for different preshared keys to be used, so you can have a "read only" key

@josephschorr
Copy link
Member

@winstaan74 Also, AuthZed's paid offering provides support for https://authzed.com/docs/spicedb-dedicated/fgam, which allows for very specific permissions on the tokens calling into SpiceDB Enterprise

@winstaan74
Copy link
Author

Thanks for the pointers to alternatives - I'll close this ticket.

@josephschorr
Copy link
Member

josephschorr commented Jan 31, 2024

@winstaan74 Let us know if the separate clusters doesn't work for some reason; if not, we can investigate exposing the readonly endpoint at its own endpoint via serve, perhaps with its own configured preshared key(s)

@epbensimpson
Copy link

@winstaan74 Let us know if the separate clusters doesn't work for some reason; if not, we can investigate exposing the readonly endpoint at its own endpoint via serve, perhaps with its own configured preshared key(s)

+1 to the idea of allowing readonly endpoint/key(s) with a single cluster. We have a similar setup to OP and I suspect this will be a fairly common pattern for others self-hosting SpiceDB. While the multiple cluster setup would work it does add complexity/cost.

@winstaan74 winstaan74 reopened this Feb 1, 2024
@jzelinskie jzelinskie added state/needs discussion This can't be worked on yet state/gauging interest This needs to be championed before being worked on and removed state/needs discussion This can't be worked on yet labels Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/proposal Something fundamentally needs to change state/gauging interest This needs to be championed before being worked on
Projects
None yet
Development

No branches or pull requests

5 participants