Skip to content

Conversation

@sebastienbaillet
Copy link

@sebastienbaillet sebastienbaillet commented Jan 10, 2026

Identify the Bug

To fix #794

Description of the Change

Allow graphql_engine hostname customization in collab-server deployment, to allow Ghostwriter to be fully operational when deployed in Kubernetes.
To do so, you can set GRAPHQL_HOST env var in collab-server deployment to match graphql_engine service name.

Alternate Designs

We may have graphql_engine change to something RFC1123 compliant everywhere, but it's way more easier to allow to set graphql_engine hostname in collab-server.

Possible Drawbacks

There should be none, as the default behavior (not setting the env var) is the same as before.

Verification Process

I've tested the modification in a kubernetes cluster.

Release Notes

Allow graphql_engine hostname customization in collab-server deployment

@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.43%. Comparing base (b7c6706) to head (92c9333).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #795   +/-   ##
=======================================
  Coverage   91.43%   91.43%           
=======================================
  Files         368      368           
  Lines       20941    20941           
=======================================
  Hits        19148    19148           
  Misses       1793     1793           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@chrismaddalena
Copy link
Collaborator

Thanks for submitting this PR. The change looks fine to me. Are you setting the GRAPHQL_HOST env var in Kubernetes? It's not in the Docker environment or config.

I ask because we use HASURA_GRAPHQL_SERVER_HOSTNAME in the config. You can see it used for Django in base.py. Here we set a Django settings value, GRAPHQL_HOST, to the value from the Docker environment:

GRAPHQL_HOST = env("HASURA_GRAPHQL_SERVER_HOSTNAME", default="graphql_engine")

We can also add this to the collab-server service's environment list:

HASURA_GRAPHQL_SERVER_HOSTNAME=${HASURA_GRAPHQL_SERVER_HOSTNAME}

We actually added this specifically for Kubernetes in v4.3.10, but graphql-engine was hard-coded for the collab server here, as you've noted.

@sebastienbaillet
Copy link
Author

Indeed, it would make more sense to use the variable HASURA_GRAPHQL_SERVER_HOSTNAME. I'll make the change.

@sebastienbaillet
Copy link
Author

We can also add this to the collab-server service's environment list:

HASURA_GRAPHQL_SERVER_HOSTNAME=${HASURA_GRAPHQL_SERVER_HOSTNAME}

You mean in production.yml and in local.yml ?

@chrismaddalena
Copy link
Collaborator

We can also add this to the collab-server service's environment list:

HASURA_GRAPHQL_SERVER_HOSTNAME=${HASURA_GRAPHQL_SERVER_HOSTNAME}

You mean in production.yml and in local.yml ?

Yes, but under the collab-server service entry. b51acd9 added it to the Hasura container, so if we move that to colab-server we should be OK.

@ColonelThirtyTwo Could you confirm?

Copy link
Contributor

@ColonelThirtyTwo ColonelThirtyTwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise looks ok. I'm a bit surprised that kubernetes doesn't copy Docker's DNS server where the containers in a project can resolve each other via their container name - seems like that would mess many things up.

@sebastienbaillet
Copy link
Author

sebastienbaillet commented Jan 15, 2026

Otherwise looks ok. I'm a bit surprised that kubernetes doesn't copy Docker's DNS server where the containers in a project can resolve each other via their container name - seems like that would mess many things up.

In fact, it's quiet normal. In Kubernetes, we create "deployment", it's a kind of contract that tells what pod you want, and the orchestrator will do its best to honor it. Kubernetes will then create pod(s) and the name of this pod will contain a short random suffix that will allow the rollout mechanism without having 2 pods with the same name.
k8s deployment documentation

To have consistent name, Kubernetes offers you to create services. Services have constant ip and domain name, and, in the same namespace the service name is sufficient for the domain name resolution.
k8s service documentation

@sebastienbaillet
Copy link
Author

Tell if (and where) you want me to provide some examples of Kubernetes deployment in the documentation.

@ColonelThirtyTwo
Copy link
Contributor

Can you add the HASURA_GRAPHQL_SERVER_HOSTNAME variable to the frontend container in local.yml as well, so that codegen.ts can use it?

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

Successfully merging this pull request may close these issues.

collab-server can't connect to graphql engine in Kubernetes

3 participants