Skip to content

fix: delay upstream DNS resolution to prevent nginx startup failures#2718

Merged
peace-maker merged 1 commit intoGallopsled:devfrom
ZackaryShen:fix/nginx-upstream-resolver
Apr 19, 2026
Merged

fix: delay upstream DNS resolution to prevent nginx startup failures#2718
peace-maker merged 1 commit intoGallopsled:devfrom
ZackaryShen:fix/nginx-upstream-resolver

Conversation

@ZackaryShen
Copy link
Copy Markdown
Contributor

Summary

The nginx cache proxy fails to start in CI with the error:

nginx: [emerg] host not found in upstream "debuginfod.elfutils.org"

This happens because nginx resolves upstream domains at config parse time,
but Docker's embedded DNS (127.0.0.11) may not be fully available when
the container starts.

Solution

Changed all proxy_pass directives from:

proxy_pass https://debuginfod.elfutils.org/;

To use the variable pattern:

set $upstream_host "debuginfod.elfutils.org";
proxy_pass https://$upstream_host/;

This defers DNS resolution to the first request, when Docker DNS is guaranteed
to be available.

Testing

The change can be verified by running:

./travis/test_nginx_cache.sh

Fixes

Fixes #2712

Use nginx variable pattern (set $upstream + proxy_pass https://$upstream)
to defer DNS resolution until first request instead of at config parse time.

This fixes the occasional 'host not found in upstream' error in CI when
nginx container starts before Docker DNS is fully available.

Fixes Gallopsled#2712
Copy link
Copy Markdown
Member

@peace-maker peace-maker left a comment

Choose a reason for hiding this comment

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

Thank you. There was another PR for this problem very recently :D #2715 that came to the same solution, but has implementation problems. It seems there's some interest in pointing agents at this repo.

@peace-maker peace-maker merged commit c59b5cd into Gallopsled:dev Apr 19, 2026
13 checks passed
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.

libcdb CI cache doesn't start sometimes

2 participants