Skip to content

DiamondLightSource/graph-federation

Repository files navigation

Data Gateway

A deployment of a GraphQL router, acting as the Data Gateway for Diamond Light Source.

Docs

Docs can be found on github pages

Structure

  • supergraph-config.yaml & schema/: A description of subgraph schemas and how they are composed a runtime execution configuration for the Cosmo Router.
  • apps.yaml & charts/apps/: An ArgoCD App-of-Apps used to deploy the other charts in various configurations
  • charts/graph: A Helm chart used to deploy the Cosmo Router, including the generated router-execution-config.json, mounted via a ConfigMap.
  • charts/monitoring: A Helm chart used to deploy Prometheus and Jaeger for observability
  • action.yaml: A GitHub action used to create subgraph schema update pull requests
  • mkdocs.yaml & docs/: User facing documentation, built with mkdocs

Action

Update Supergraph

This workflow may be used to create or update a Subgraph Schema by adding the schema to the schema/ directory and an entry in the supergraph-config.yaml of this repository. The workflow composes the federated graph using Cosmo's composition pipeline, generates a new router-execution-config.json. The action can be used to simply check that the schema will federate by setting publish to false.

Usage

Inputs
- uses: diamondlightsource/graph-federation@main
  with:
    # A unique name given to the subgraph.
    # Required.
    name:

    # The public-facing URL of the subgraph.
    # Required.
    routing-url:

    # Optional subscription URL (WS/SSE) for Cosmo
    subscription-url:
    subscription-protocol: ws

    # The name of an artifact from this workflow run containing the subgraph schema.
    # Required.
    subgraph-schema-artifact:

    # The name of the subgraph schema file within the artifact.
    # Required.
    subgraph-schema-filename:

    # The name of the artifact to be created containing the generated router execution config.
    # Optional. Default is 'router-execution-config'
    execution-config-artifact:

    # The name of the generated execution config within the created artifact.
    # Optional. Default is 'router-execution-config.json'
    execution-config-filename:

    # The ID of the GitHub App used to create the commit / pull request
    # Required when publish is true.
    github-app-id:

    # The private key of the GitHub App used to create the commit / pull request
    # Required when publish is true.
    github-app-private-key:

    # A boolean value which determines whether a pull request should be created
    # Optional. Default is ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
    publish:
Outputs
Name Description Example
execution-config-artifact-id The id of the artifact containing the router execution config 1234
execution-config-artifact-url The url of the artifact containing the router execution config https://github.com/example-org/example-repo/actions/runs/1/artifacts/1234
Example
steps:
  - name: Create Test Subgraph schema
    run: >
      echo "
        schema {
          query: Query
        }
        type Query {
          _empty: String
        }
      " > test-schema.graphql

  - name: Upload Test Subgraph schema
    uses: actions/upload-artifact@v4.4.3
    with:
      name: test-schema
      path: test-schema.graphql

  - name: Update Composition
    uses: diamondlightsource/graph-federation@main
    with:
      name: test
      routing-url: https://example.com/graphql
      subgraph-schema-artifact: test-schema
      subgraph-schema-filename: test-schema.graphql
      github-app-id: 1010045
      github-app-private-key: ${{ secrets.GRAPH_FEDERATOR }}
      publish: false

About

The Diamond data gateway deployment

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors