Apollo-server: [Federation] Need hot reload of gateway for schema changes in federated service

Created on 24 Jul 2019  ·  7Comments  ·  Source: apollographql/apollo-server

In Apollo Federation, I am facing this problem:
The gateway needs to be restarted every time we make a change in the schema of any federated service in service list.
I understand that every time a gateway starts and it collects all the schema and aggregates the data graph. But is there a way this can be handled with any plugin or any suggested third party solution?

Can we expect an official solution for this problem very soon?

👩‍🚀 federation

Most helpful comment

@omkarprabhu-continuum @ronan we don't think that polling downstream services is the right model for a federated gateway. It presents a footgun where gateway flapping (going from one version to another and back while a service is being incrementally rolled back) can happen and/or an intermittent outage of a downstream service can cause composition failures at the gateway. We poll a managed config file for the platform support because that file is updated through a manual hook that teams call via the CLI.

To support teams that can't use the managed version or want to provided additional fallbacks, we are landing full control over the schema fetching processes via observability hooks in this PR https://github.com/apollographql/apollo-server/pull/3110

That PR will allow you to provide your own way to fetch a schema from something like a centralized cache, filesystem, or what have you. If you must call into the downstream resources, that PR will give you the ability to do that as well though we don't recommend it

All 7 comments

@fernandobandeira Suppose I do not want any dependency on a third party platform. How can I solve this problem then?

I have created a PR that solves this need for non-manged federation: #3117

3102 is also to solve the same problem

I don't feel polling is the right solution for me and just a question:
Is there a pub/sub way to deal with this?

@omkarprabhu-continuum @ronan we don't think that polling downstream services is the right model for a federated gateway. It presents a footgun where gateway flapping (going from one version to another and back while a service is being incrementally rolled back) can happen and/or an intermittent outage of a downstream service can cause composition failures at the gateway. We poll a managed config file for the platform support because that file is updated through a manual hook that teams call via the CLI.

To support teams that can't use the managed version or want to provided additional fallbacks, we are landing full control over the schema fetching processes via observability hooks in this PR https://github.com/apollographql/apollo-server/pull/3110

That PR will allow you to provide your own way to fetch a schema from something like a centralized cache, filesystem, or what have you. If you must call into the downstream resources, that PR will give you the ability to do that as well though we don't recommend it

Closing by the many-times-referenced #3110. We'd love to hear any feedback on the custom configuration fetcher and observability hooks!

Was this page helpful?
0 / 5 - 0 ratings