Fetching schema from remote Prisma service
Closed this issue ยท 3 comments
The current Prisma full-stack boilerplates are basically separated into two parts: the actual Prisma service with it's data model and the front-facing GraphQL API which sits on top. Having those two components in one project is very good for development, because you can use the Prisma CLI in order to deploy it to a local cluster a.k.a. run it as local Docker containers. For production I envision a slightly different scenario. Here I would love to deploy the actual Prisma service as a separate unit and let my front-facing GraphQL API fetch the Prisma schema
from that deployed service.
So instead of importing the generated schema via
# import Post from "./generated/prisma.graphql"
I would like to import it directly from the Prisma service endpoint, like
# import Post from "http://my-prisma-endpoint:4466"
In the end, this would result in a more flexible way of approaching different deployment scenarios, like deploying a Prisma service to Mesos or Kubernetes.
I would love to hear your thoughts :)
Hi @akoenig. I would highly recommend a workflow that is still based on static files. In your scenario simply run the following command as part of your deployment flow (or use a .graphqlconfig
file):
graphql get-schema -e http://my-prisma-endpoint:4466 -o generated/prisma.graphql
Generally, while possible, I'm hesitant to add support for the import from remote endpoint syntax, as it would (1) make importSchema
an asynchronous function and (2) encourages/make it too easy to implement inefficient behaviour.
Hi @schickling ๐ โ ah okay, cool. Sorry, didn't know that this is possible / currently the internal process. Well, this is awesome. IMHO my proposal is not necessary anymore then. Thanks for the heads-up :)
Awesome! I'm closing this issue for now. If someone has more thoughts on this topic, I'm happy to re-open the issue.