https://github.com/diamondlightsource/graph-federation
The Diamond data gateway deployment
https://github.com/diamondlightsource/graph-federation
Last synced: 4 days ago
JSON representation
The Diamond data gateway deployment
- Host: GitHub
- URL: https://github.com/diamondlightsource/graph-federation
- Owner: DiamondLightSource
- License: apache-2.0
- Created: 2024-03-13T16:35:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2026-03-25T10:20:37.000Z (12 days ago)
- Last Synced: 2026-03-25T13:12:47.441Z (12 days ago)
- Language: JavaScript
- Size: 231 KB
- Stars: 2
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://diamondlightsource.github.io/graph-federation/)
## 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](https://argoproj.github.io/cd/) [App-of-Apps](https://argo-cd.readthedocs.io/en/stable/operator-manual/cluster-bootstrapping/#app-of-apps-pattern) used to deploy the other charts in various configurations
- `charts/graph`: A Helm chart used to deploy the [Cosmo Router](https://wundergraph.com/router-gateway/), including the generated router-execution-config.json, mounted via a ConfigMap.
- `charts/monitoring`: A Helm chart used to deploy [Prometheus](https://prometheus.io/) and [Jaeger](https://www.jaegertracing.io/) for observability
- `action.yaml`: A [GitHub action](https://github.com/features/actions) used to create subgraph schema update pull requests
- `mkdocs.yaml` & `docs/`: User facing documentation, built with [mkdocs](https://www.mkdocs.org/)
## 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
```yaml
- 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 | |
##### Example
```yaml
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
```