mercurius icon indicating copy to clipboard operation
mercurius copied to clipboard

Create an open source implementation of a Federated Schema Registry

Open simoneb opened this issue 3 years ago • 22 comments

Netflix is publishing how they're approaching implementing GraphQL Federation on their blog.

An interesting element is the existence of a schema registry (picture taken from the blog post, highlight is mine).

image

The registry is described as:

Schema Registry is a stateful component that stores all the schemas and schema changes for every DGS. It exposes CRUD APIs for schemas, which are used by developer tools and CI/CD pipelines. It is responsible for schema validation, both for the individual DGS schemas and for the combined schema. Last, the registry composes together the unified schema and provides it to the gateway.

And its functionality as:

Whenever a new schema is pushed by a DGS, the Schema Registry validates that:

  • New schema is a valid GraphQL schema
  • New schema composes seamlessly with the rest of the DGSs schemas to create a valid composed schema
  • New schema is backwards compatible

If all of the above conditions are met, then the schema is checked into the Schema Registry.

We should consider creating an open source implementation of a schema registry for Mercurius.

simoneb avatar Nov 11 '20 16:11 simoneb

cc @adamovittorio

mcollina avatar Nov 11 '20 16:11 mcollina

I've been working something like this for quite some time now (after we realized, that we can't handle a large graph properly without one). We've tried https://github.com/pipedrive/graphql-schema-registry but it has quite some limitations that render it impossible to use for us, and even if we would continue to use Apollo (which is something we want to trade in for mercurius early next year), we wouldn't be able to use Studio (or whatever it's called these days), as on-premise hostability is a must have for us as well.

It is not yet in a working state, but I would happily put it under the umbrella of an org, you know...

Bildschirmfoto 2020-11-11 um 17 42 45 Redacted Bildschirmfoto 2020-11-11 um 17 42 54 Bildschirmfoto 2020-11-11 um 17 43 02 Bildschirmfoto 2020-11-11 um 17 43 18

asciidisco avatar Nov 11 '20 16:11 asciidisco

This is a fascinating topic for us too. cc @projectjudge @aleccool213 @edno

adamovittorio avatar Nov 11 '20 17:11 adamovittorio

also @lucamaraschi is very interested!

mcollina avatar Nov 11 '20 21:11 mcollina

@asciidisco

It would be fascinating to know the limitations you encountered when using graphql-schema-registry. That could really influence the decisions made here.

aleccool213 avatar Nov 16 '20 14:11 aleccool213

One option might be to fork https://github.com/pipedrive/graphql-schema-registry and make the changes we want?

mcollina avatar Nov 16 '20 16:11 mcollina

One option might be to fork https://github.com/pipedrive/graphql-schema-registry and make the changes we want?

That's a great idea. Its either fork or develop a close relationship with the maintainer to have pull requests go into that repo. Its using fairly standard tech (react/node) so should be fairly easy for everyone who would be contributing to mercurius to also contribute there.

aleccool213 avatar Nov 17 '20 15:11 aleccool213

An update here, from the sounds of it, The Guild will be releasing "Hive" which is their version of an open-source graphql schema registry. Might be good just to wait for that.

aleccool213 avatar Dec 14 '20 19:12 aleccool213

If someone wants to meet with us and discuss their needs to make sure we are covering it, feel free to reach out and let's meet early next year! We want to hear as much feedback, use cases and most importantly workflows you are having and make sure that by the time we open source it, it fits to the important workflows people are having

Urigo avatar Dec 28 '20 20:12 Urigo

@Urigo we have not defined our requirements at NearForm - I'll likely ping you in the coming weeks.

mcollina avatar Dec 29 '20 08:12 mcollina

We would love to have something like this. I'm very interested in following along and contributing!

jkirkpatrick24 avatar Jan 09 '21 19:01 jkirkpatrick24

For sure, I'm in ! Here is the schema reporting protocol from Apollo : https://www.apollographql.com/docs/studio/schema/schema-reporting-protocol/

jbpin avatar Jan 22 '21 08:01 jbpin

Just wanted to mention the availability of a new schema registry reporting plugin for Mercurius: https://github.com/nearform/mercurius-apollo-registry.

nigelhanlon avatar Feb 15 '21 09:02 nigelhanlon

Hi all, I'm currently working on a GraphQL Registry https://github.com/StarpTech/graphql-registry I'm open to contributions. My goal is to provide a similar experience with Apollo Studio in terms of schema and client management.

StarpTech avatar May 02 '21 14:05 StarpTech

https://github.com/StarpTech/graphql-registry/tree/main/examples/mercurius-federation

StarpTech avatar May 21 '21 00:05 StarpTech

Since my last comment here, we've released GraphQL Hive as a SAAS schema registry and also as a completely open source MIT project you can self host. There is now a huge community of companies using it, many using it as self hosted (the code and feature are completely identical to the SAAS version). Just realized I haven't gave an update here so I hope it would be valuable for people Here is the link to the repo: http://github.com/kamilkisiela/graphql-hive and here is a link to a talk I gave with full background on the solution

We would love to hear feedback from everyone here on what's missing and what we can improve!

Urigo avatar Nov 09 '22 13:11 Urigo

@Urigo - OMG!!! :star_struck: :star_struck: :star_struck:

Thanks for the tip! I'm not so far with the project I'm working on to need federation, but this will certainly be in my to-do list for the future. Thanks again!

Scott

smolinari avatar Nov 09 '22 14:11 smolinari

@Urigo thanks for the update, we are looking at it and we'll come back with meaningful feedback! cc: @aleccool213

adamovittorio avatar Nov 09 '22 19:11 adamovittorio

From a quick look at GraphQL Hive, I think the complexity of the deployment actually makes it arguably cheaper to go for hosted / SaaS options. Nonetheless, great that such a technology is open source! Very useful.

MrSaints avatar Nov 09 '22 22:11 MrSaints

@MrSaints of course we would prefer that you would pay us for SAAS and we believe we are doing it in a cheap and good way ;) but we still want to make self hosting Hive the easiest it can be! Can you share a bit about what was the complexity you've seen?

Quoting from the self hosting docs by @n1ru4l :

Pre-Requisites

The easiest way of running GraphQL Hive is using Docker and docker-compose.

All the services required for running GraphQL Hive are published to the GitHub container registry (GraphQL Hive Docker Images).

Please make sure to install the Docker daemon as well as docker-compose on your machine before proceeding.

Urigo avatar Nov 10 '22 11:11 Urigo

@Urigo Sure. To clarify, I don't think the complexity is in the installation itself / following the Docker instructions.

I'm thinking more in terms of architectural complexity and costs.

I may be mistaken, but looking at the docs, and https://github.com/kamilkisiela/graphql-hive/blob/08c2a9fe317ad1079d57d0f24110988d183bf46c/docker-compose.community.yml, it seems running Hive requires:

  • Postgresql
  • Redis
  • Kafka
  • Clickhouse

The first 2 is alright. Kafka, and Clickhouse however, are not exactly cheap to run in production. Getting a team to manage that too is not exactly cheap, which is why I was saying it may be better to opt for a SaaS / Cloud option :)

BTW, I'm not saying they are not necessary costs. I'm sure they are more than justified. That's a separate discussion which I don't think I can comment on at this stage without looking deeper.

MrSaints avatar Nov 10 '22 17:11 MrSaints

@MrSaints Registry requires only Redis and PostgreSQL, ClickHouse and Kafka are used for Usage Reporting

kamilkisiela avatar Nov 21 '22 16:11 kamilkisiela