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

Supporting "both" / "only" option for graceful migration #15

Closed
bradleyayers opened this issue Jan 9, 2019 · 2 comments
Closed

Supporting "both" / "only" option for graceful migration #15

bradleyayers opened this issue Jan 9, 2019 · 2 comments

Comments

@bradleyayers
Copy link

We've deployed our GraphQL schema to production (though only for internal use) before enabling this plugin. It would be useful to have a graceful migration strategy, and I see two options:

  • Add support to the plugin for a both / only option, and use both to expose the old names and the new names. Deploy this to production, migrate all our consume code to use the new APIs, deploy that, and wait a week for old code to evaporate from production systems. Then switch the plugin to only and deploy that.
  • Deploy a second GraphQL API to /graphql2, that uses the same postgraphile configuration as /graphql but has this plugin installed. Then migrate all consumer clients to use /graphql2, deploy that, wait a week for legacy production code to evaporate, then remove /graphql.

I'm leaning towards the second option, since it's something we can do without depending on changes to this plugin.

Thoughts?

@benjie
Copy link
Member

benjie commented Jan 10, 2019

I’ve thought about this in the past and unfortunately I think it’d be a lot of work for PostGraphile to support both concurrently due to the way the schema is built currently. I think your latter option is good, but I’d expose both over the same endpoint and use a version header of some kind to indicate which to use. If you’ve the performance space to spare (I expect so?) it would actually be possible to validate the incoming query against the latest schema and if it fails pass it up the tree of older schemas, this would mean the client doesn’t need to know which version or even that there are multiple versions. Probably good to add a header or similar to warn though. And obviously metrics so you know when it’s safe to disable.

@bradleyayers
Copy link
Author

Sounds good to me, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants