Skip to content
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

feat: Use container names for upstream names to avoid repeats #1938

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rhansen
Copy link
Collaborator

@rhansen rhansen commented Apr 6, 2022

Note: This depends on PR #2127, and will be marked as draft until that PR is merged.

@buchdag
Copy link
Member

buchdag commented Apr 10, 2022

{{- /* TODO: Replace the next few lines with a call to join once nginx-proxy has a version of
docker-gen that includes nginx-proxy/docker-gen#418. */}}

I'm on it: #1940

@rhansen
Copy link
Collaborator Author

rhansen commented Apr 11, 2022

Thanks for updating docker-gen. I rebased and switched to the join function.

@buchdag
Copy link
Member

buchdag commented Apr 18, 2022

Thanks for the PR, unfortunately we can't make this behaviour a default one because a lot of people have custom configurations that rely on upstream names being equal to the hostnames.

See #1725, #1693 (comment), #1736 plus the release notes of version 0.9.2 and 0.9.3.

@rhansen
Copy link
Collaborator Author

rhansen commented Apr 19, 2022

I updated the PR to keep the current behavior by default.

@rhansen
Copy link
Collaborator Author

rhansen commented May 16, 2022

Friendly ping @buchdag

@rhansen
Copy link
Collaborator Author

rhansen commented Jan 1, 2023

Marking as draft until #2127 is merged.

@buchdag
Copy link
Member

buchdag commented May 9, 2023

@rhansen sorry for the incredibly long delay on this one. I've tested the PR, and I'm still a bit confused about it.

Does it provide any advantage / behaviour change when not using VIRTUAL_PATH ?

What kind of issue could the "repeat" of upstreams when using VIRTUAL_PATH cause ?

I feel like I'm completely missing the point but I seem unable to grasp what issue this PR is attempting to solve or its benefits against its non trivial added complexity. 🤔

I also don't think it could realistically be made default as it would made upstream name somewhere between very hard to predict and unpredictable on systems or setups where container names are dynamically generated or containers replica dynamically started / stopped.

@rhansen
Copy link
Collaborator Author

rhansen commented May 11, 2023

Does it provide any advantage / behaviour change when not using VIRTUAL_PATH ?

Yes. Currently, if a single container is used for multiple vhosts (e.g., VIRTUAL_HOST: foo.example,bar.example) then multiple identical upstream blocks are created, one per vhost. With this change only one upstream is generated and shared with both vhosts.

What kind of issue could the "repeat" of upstreams when using VIRTUAL_PATH cause ?

VIRTUAL_PATH is irrelevant to this change.

I think the repeated upstreams could theoretically cause minor load balancing issues.

I feel like I'm completely missing the point but I seem unable to grasp what issue this PR is attempting to solve or its benefits against its non trivial added complexity. thinking

It's been a year so a lot has slipped away from memory, but IIRC my main motivation was to facilitate a fix for #1504. Give me some time to recall what I was doing and I'll update the commit message with some rationale.

I also don't think it could realistically be made default as it would made upstream name somewhere between very hard to predict and unpredictable on systems or setups where container names are dynamically generated or containers replica dynamically started / stopped.

Hmm, that's a good point. Let me think about this some more to see if there's a good general solution that checks all of these boxes:

  • avoids duplicates
  • avoids the need to encode a path in the upstream name
  • is stable
  • is predictable
  • is human-readable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feat PR for a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants