[prototype] Compiled schema synchronization #113
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Eases the synchronization of graphql schema when using multiple servers.
Publishing a schema
One server will do the schema generation + compiling, and run a command (
ibexa:graphql:publish-schema
) to publish the schema. Publishing will a) push the compiled schema (%kernel.cache_dir%/overblog/graphql-bundle/__definitions__/*
) to aSharedSchema
, and b) set the published schema timestamp using aTimestampHandler
.In the current prototype, the
TimestampHandler
is based on Redis, and theSharedSchema
on a locally mounted shared folder.Pulling a published schema
Other servers, when a GraphQL query is executed (
UpdateSchemaIfNeeded
subscriber), will compare the timestamp to theirs (mtime of__classes.map
). If a newer one is available, it will be pulled from theSharedSchema
, and copied locally. It will get installed in a shutdown function to prevent op cache issues.Since the graphql schema types are compiled into the container as services, types that were added to the published schema (new content types, etc) need to be registered on runtime. This is done by the
Schema\Sync\AddTypesSolutions
subscriber. It checks which of the type classes do not have a solution in the current schema, and adds them to it.TODO
Add a flysystem based implementation, that would include local, but also support any remote filesystem(need to update our version of flysystem to the new stable)