-
Notifications
You must be signed in to change notification settings - Fork 5
[bugfix] Frontend: give GQ_BACKEND_HOST a working default to fix 503s #483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
els0r
wants to merge
1
commit into
main
Choose a base branch
from
claude/github-issue-480-backend-default
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -58,6 +58,28 @@ make docker-up # run the hardened image (docker compose up --build) | |
| make docker-build # build Caddy image locally | ||
| ``` | ||
|
|
||
| ### Runtime configuration | ||
|
|
||
| The image is configured entirely through environment variables, read at | ||
| container startup. The two networking knobs are easy to confuse: | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A small chart displaying the interaction between the components, in particular frontend + caddy, global query and goprobe nodes (+ e.g. production environment with an nginx / TLS reverse proxy in front) would help. |
||
|
|
||
| | Variable | Consumed by | Purpose | Default | | ||
| | --- | --- | --- | --- | | ||
| | `GQ_BACKEND_HOST` | Caddy (reverse proxy) | Where Caddy forwards `/_query*` and `/-/*` **server-side**. Point it at the global-query backend. | `http://127.0.0.1:8146` | | ||
| | `GQ_API_BASE_URL` | Browser (env.js) | URL the **browser** uses to reach the API. Leave empty to route through Caddy's same-origin proxy (recommended — keeps the CSP intact and avoids CORS). | empty | | ||
| | `HOST_RESOLVER_TYPES` | Browser (env.js) | Comma-separated resolver types offered in the UI. | `string` | | ||
| | `SSE_ON_LOAD` | Browser (env.js) | Enable SSE streaming by default. | `true` | | ||
|
|
||
| Browser API calls go to `/_query*` on the same origin as the UI, and Caddy | ||
| proxies them on to `GQ_BACKEND_HOST` — so under normal use you only set | ||
| `GQ_BACKEND_HOST`, and leave `GQ_API_BASE_URL` empty. The default backend | ||
| (`http://127.0.0.1:8146`) matches the global-query address in the single-host | ||
| `docker-compose.yaml`; override it for other topologies, e.g. in Kubernetes: | ||
|
|
||
| ```bash | ||
| GQ_BACKEND_HOST=http://global-query.observability.svc.cluster.local:8145 | ||
| ``` | ||
|
|
||
| ## Using the UI | ||
|
|
||
| - Time range: quick presets (5m…30d) or set exact From/To. | ||
|
|
@@ -95,6 +117,13 @@ make docker-build # build Caddy image locally | |
|
|
||
| ## Troubleshooting | ||
|
|
||
| - API requests fail with `503` and Caddy logs `"no upstreams available"`: the | ||
| reverse proxy has no backend to dial because `GQ_BACKEND_HOST` resolved to an | ||
| empty value. Set it to your global-query address (see | ||
| [Runtime configuration](#runtime-configuration)). Note that listing the | ||
| variable with an empty value (e.g. `GQ_BACKEND_HOST=` or `${GQ_BACKEND_HOST:-}`) | ||
| overrides the built-in default with empty — leave it unset to take the default. | ||
|
|
||
| - If the editor reports a spurious import error for a newly added view file, run a fresh typecheck: | ||
|
|
||
| ```bash | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment here is still weak in terms of clarity (it should be clear that this the global query endpoint, the phrase is still too weak, even more so if an actual reverse proxy like nginx is involved in a production environment).