Repository navigation
feat(docker): resolve the Hasura instances at run time in the nginx image - #26349
Conversation
…mage With the resolver the image already has for webhooks, more or fewer graphql-server instances behind the one name take effect within 30 s, without reloading nginx. nginx also starts before Hasura resolves.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review: 4
Please check the settings in the CodeRabbit UI or the
|
🚨 Automated tests failed |
|
@tibroc BBB could benefit a lot from routing all users from the same meeting to the same Hasura instance, while routing users from other meetings to different instances. Since Hasura uses query multiplexing, it can execute a single query for all users in the same meeting. However, if those users are split across two Hasura instances, each instance would need to execute the same query, effectively doubling the number of queries. Keeping users from the same meeting on the same Hasura instance could significantly reduce resource consumption. Of course, this would mainly make sense for servers hosting multiple smaller meetings. For a single meeting with a large number of users, distributing the load across multiple Hasura instances might still be necessary. |
1203989
into
bigbluebutton:v4.1.x-develop
Follow-up to bigbluebutton#26349: scaling takes effect in about 30 s; on Kubernetes the short name does not resolve (own hasura-loadbalancer.conf with the full name) and resolve spreads over several pods only with a headless Service. The comments in the nginx Dockerfile and the compose file still described the resolver as for webhooks only and every upstream as resolved at start.
The upstreams were resolved when nginx started, so a service recreated alone with a new address (up -d --force-recreate <service>, or up -d after a change in .env) answered 502 until nginx restarted. Like graphql-server since bigbluebutton#26349, the upstreams of web, graphql-middleware, webrtc-sfu, shared-notes-server, html5-client and learning-dashboard now have a zone and resolve their names every 30 s; livekit keeps its fixed address. docker/README.md describes it, with the Kubernetes note: own files with the full service names, and several pods only behind a headless Service.
Follow-up to bigbluebutton#26349: scaling takes effect in about 30 s; on Kubernetes the short name does not resolve (own hasura-loadbalancer.conf with the full name) and resolve spreads over several pods only with a headless Service. The comments in the nginx Dockerfile and the compose file still described the resolver as for webhooks only and every upstream as resolved at start.
The upstreams were resolved when nginx started, so a service recreated alone with a new address (up -d --force-recreate <service>, or up -d after a change in .env) answered 502 until nginx restarted. Like graphql-server since bigbluebutton#26349, the upstreams of web, graphql-middleware, webrtc-sfu, shared-notes-server, html5-client and learning-dashboard now have a zone and resolve their names every 30 s; livekit keeps its fixed address. docker/README.md describes it, with the Kubernetes note: own files with the full service names, and several pods only behind a headless Service.
What does this PR do?
The nginx image's Hasura balancer gets
resolveon its one server line:nginx now looks the name up again every 30 s through the resolver the image already has for
webhooks (#26217), with the
zonefrom #26248. More or fewer graphql-server instances behind the onename take effect within 30 s, without
nginx -s reload. The README paragraph on the edge nginx sayswhich names are resolved at run time.
Closes Issue(s)
None
Motivation
Follow-up to the review of #26217 (point 4, @antobinary) and the "two Hasuras" question there: until
now nginx resolved
graphql-serveronce at start, so after scaling it had to be reloaded.Two consequences, both in the README:
--entrypoint nginx, or aKubernetes
command:) it exits withno resolver defined to resolve names at run time in upstream "hasura". On Kubernetesgraphql-serverneeds its full service name, because nginx's resolverignores search domains (as for
webhooks), or the deployment mounts its ownhasura-loadbalancer.conf.How to test
Built the nginx image and ran it with a read-only root, stub backends and stub Hasura instances
(nginx returning its host name on 8085) under the alias
graphql-server, without reloading nginx:--entrypoint nginx: exits 1 with theno resolver definedmessage above.With the compose setup of #26186 and the published
v4.1.x-develop-c90e70aimages, only nginx builtfrom this branch, nginx never reloaded or restarted:
docker compose up -d --scale graphql-server=2, after 35 s nginx resolves both addresses; duringjoins both instances get websocket connections; 6 joins and a recorded meeting through to playback
pass;
removed address (without
resolve, joins took 17–19 s and nginx loggedHost is unreachableuntila reload).