Conversation
…le URLs for deployment
There was a problem hiding this comment.
Pull request overview
This PR updates the SciServer GraphQL deployment configuration to use environment-specific upstream service URLs, and simplifies the GraphQL server bootstrap to always use the real schema/resolvers (removing test-only mocking).
Changes:
- Updated the GraphQL Helm Deployment template to conditionally set
FILES_BASE_URL,COMPUTE_BASE_URL,RACM_BASE_URL, andLOGIN_PORTAL_BASE_URLbased on.Values.graphql.env. - Removed
addMocksToSchemausage so the Apollo Server always runs with the real schema.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
helm/sciserver/templates/graphql/graphql-deployment.yaml |
Adds environment-conditioned base URLs for downstream services used by GraphQL. |
components/ui/graphql/src/main.ts |
Removes test-only schema mocking and keeps a single real schema configuration. |
Comments suppressed due to low confidence (1)
components/ui/graphql/src/main.ts:50
- The landing page plugin toggle checks
process.env.IDIES_ENV !== 'production', but the rest of this repo/Helm values usedev/prod(e.g.,environment.tschecks for'prod'and the chart setsIDIES_ENVfrom.Values.graphql.env). As written, the landing page will remain enabled even whenIDIES_ENV=prod, which is likely unintended for production. Align this comparison with the actual environment values used by the chart/app.
plugins: process.env.IDIES_ENV !== 'production' ?
[
// eslint-disable-next-line new-cap
ApolloServerPluginLandingPageLocalDefault({ footer: false })
]
: [],
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import { ApolloServer } from '@apollo/server'; | ||
| import { expressMiddleware } from '@apollo/server/express4'; | ||
| import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default'; | ||
| import { addMocksToSchema } from '@graphql-tools/mock'; | ||
| import { makeExecutableSchema } from '@graphql-tools/schema'; | ||
| import express from 'express'; |
There was a problem hiding this comment.
addMocksToSchema was removed and there are no remaining references to @graphql-tools/mock in this package (it now only appears in package.json). Consider removing that devDependency to avoid carrying an unused dependency in builds.
| resources: | ||
| {{- toYaml .Values.compute.resources | nindent 12 }} | ||
| env: | ||
| env: |
There was a problem hiding this comment.
There is a duplicated env: key here (env: followed by another env: with mismatched indentation). This will render invalid YAML for the Deployment and prevent the chart from installing. Remove the extra env: line and ensure the env var list is directly under the single env: key.
| env: |
| - name: FILES_BASE_URL | ||
| value: '{{ include "sciserver.url" . }}fileservice/api/' | ||
| value: '{{- if eq .Values.graphql.env "dev" -}}https://apps.sciserver.org/{{- else -}}{{ include "sciserver.url" . }}fileservice/api/{{- end -}}' | ||
| - name: COMPUTE_BASE_URL | ||
| value: '{{ include "sciserver.url" . }}compute/api/' | ||
| value: '{{- if eq .Values.graphql.env "dev" -}}https://apps.sciserver.org/{{- else -}}{{ include "sciserver.url" . }}compute/api/{{- end -}}' | ||
| - name: RACM_BASE_URL | ||
| value: '{{ include "sciserver.url" . }}racm/' | ||
| value: '{{- if eq .Values.graphql.env "dev" -}}https://apps.sciserver.org/{{- else -}}{{ include "sciserver.url" . }}racm/{{- end -}}' | ||
| - name: LOGIN_PORTAL_BASE_URL | ||
| value: '{{ include "sciserver.url" . }}login-portal/api/' | ||
| value: '{{- if eq .Values.graphql.env "dev" -}}https://apps.sciserver.org/{{- else -}}{{ include "sciserver.url" . }}login-portal/api/{{- end -}}' |
There was a problem hiding this comment.
These base URLs no longer include the service path and (for FILES/COMPUTE/LOGIN_PORTAL) also drop the trailing / that the GraphQL REST data sources assume when they append paths like volumes/ or containers/. In dev this would call https://apps.sciserver.org/volumes/ instead of something like .../fileservice/api/volumes/, and in non-dev it risks producing .../apivolumes/. Update the conditional values so both branches include the correct service prefix and a trailing slash.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| value: '{{ include "sciserver.url" . }}login-portal/' | ||
| - name: NEXT_PUBLIC_GRAPHQL_URL | ||
| value: '{{ include "sciserver.url" . }}graphql' | ||
| value: '{{- if eq .Values.graphql.env "dev" -}}https://apps.sciserver.org/{{- else -}}{{ include "sciserver.url" . }}{{- end -}}graphql' |
There was a problem hiding this comment.
The PR description mentions updating graphql-deployment.yaml to set service base URLs conditionally based on the environment, but these changes are not present in the diff. The graphql-deployment.yaml file still uses non-conditional values for FILES_BASE_URL, COMPUTE_BASE_URL, RACM_BASE_URL, and LOGIN_PORTAL_BASE_URL. Please ensure that either the changes to graphql-deployment.yaml are included in this PR, or update the PR description to accurately reflect what changes are being made.
| value: '{{ include "sciserver.url" . }}login-portal/' | ||
| - name: NEXT_PUBLIC_GRAPHQL_URL | ||
| value: '{{ include "sciserver.url" . }}graphql' | ||
| value: '{{- if eq .Values.graphql.env "dev" -}}https://apps.sciserver.org/{{- else -}}{{ include "sciserver.url" . }}{{- end -}}graphql' |
There was a problem hiding this comment.
When graphql.env is set to "dev", the GraphQL URL points to the production environment (https://apps.sciserver.org/). This means the dev web deployment will be making requests to the production GraphQL endpoint. Please confirm this is intentional. If the dev environment should use its own GraphQL service, this conditional logic may be inverted. Additionally, consider the implications of having dev clients communicate with production services, such as potential data consistency issues or unintended side effects on production data.
| value: '{{- if eq .Values.graphql.env "dev" -}}https://apps.sciserver.org/{{- else -}}{{ include "sciserver.url" . }}{{- end -}}graphql' | |
| value: '{{- if eq .Values.graphql.env "prod" -}}https://apps.sciserver.org/{{- else -}}{{ include "sciserver.url" . }}{{- end -}}graphql' |
| mocks: { DateTime: () => new Date() } | ||
| } | ||
| ) : schema, | ||
| schema, |
There was a problem hiding this comment.
The removal of mocking logic has eliminated the DateTime mock resolver without providing a real resolver. The schema defines a DateTime scalar type, and it's used throughout the schema (e.g., Container.createdAt, Job.submissionTime, File.lastModified), but there's no resolver for it in the resolvers object. The mock previously provided DateTime: () => new Date(), which has now been removed. You need to add a DateTime resolver to handle this scalar type. Consider using DateTimeResolver from the graphql-scalars package (which is already used for JSONObject and URL), or implement a custom resolver that properly serializes, parses, and validates DateTime values.
| import { expressMiddleware } from '@apollo/server/express4'; | ||
| import { ApolloServerPluginLandingPageLocalDefault } from '@apollo/server/plugin/landingPage/default'; | ||
| import { addMocksToSchema } from '@graphql-tools/mock'; | ||
| import { makeExecutableSchema } from '@graphql-tools/schema'; |
There was a problem hiding this comment.
The import for makeExecutableSchema from @graphql-tools/schema is still present, but since addMocksToSchema has been removed, this package may no longer be necessary. Please verify if makeExecutableSchema is actually needed or if you can use the schema directly. If it's not required, consider removing both the import and the package from devDependencies in package.json to reduce bundle size and dependencies.
Environment-specific configuration:
graphql-deployment.yamlHelm template to set service base URLs (FILES_BASE_URL,COMPUTE_BASE_URL,RACM_BASE_URL,LOGIN_PORTAL_BASE_URL) tohttps://apps.sciserver.org/when running in thedevenvironment, and to the usual values otherwise. This ensures the correct endpoints are used depending on the deployment environment.GraphQL server setup simplification:
addMocksToSchemaand related mocking logic frommain.ts, so the server always uses the real schema and resolvers regardless of environment. This reduces complexity and avoids unnecessary test-only code in production and development. [1] [2]