Skip to content

feat: allow nginx / docker-gen network segregation #2279

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

Merged

Conversation

Knapoc
Copy link
Contributor

@Knapoc Knapoc commented Jul 24, 2023

This PR adds the ability to allow for network segregation of the nginx and docker-gen containers in a separate container setup.

As of now this is not possible as it is assumed, that docker-gen and nginx are attached to the same networks.

In case

  1. docker-gen and nginx do not share a network,
  2. docker-gen cannot reach the backend,
  3. and nginx would be able to connect to the backends,

docker-gen would set the server to a fallback-entry within the upstream directive.

This behavior is changed with this PR when the nginx-container is known to docker-gen (by having a label applied). In this case the fallback-entry is only set, when the backend is not available to nginx.

@Knapoc Knapoc force-pushed the network-segregation-seperate-containers branch 2 times, most recently from 8bcb1c7 to 5ed66ea Compare July 24, 2023 13:07
@buchdag buchdag added the type/feat PR for a new feature label May 5, 2024
@Knapoc Knapoc force-pushed the network-segregation-seperate-containers branch 2 times, most recently from 92316cd to 390223a Compare April 22, 2025 10:33
@Knapoc Knapoc marked this pull request as draft April 22, 2025 10:45
@Knapoc Knapoc force-pushed the network-segregation-seperate-containers branch 7 times, most recently from dc9a559 to b14140f Compare April 22, 2025 14:57
* fix tests
* remove obsolete compose version
@Knapoc Knapoc force-pushed the network-segregation-seperate-containers branch from b14140f to c338e1b Compare April 22, 2025 15:04
@Knapoc Knapoc marked this pull request as ready for review April 22, 2025 15:08
@Knapoc
Copy link
Contributor Author

Knapoc commented Apr 22, 2025

@buchdag sorry to ping you, but is there a chance that this gets merged?

@buchdag
Copy link
Member

buchdag commented May 9, 2025

@Knapoc yes I'd like to see this merged, but I know I worked on it on a different computer last december and it looks like I lost my work. I can't remember everything I did but I think I made the label configurable.

@buchdag
Copy link
Member

buchdag commented May 11, 2025

@Knapoc I was able to remember what I did and pushed that in this branch:

  • ability to customise the label used to find the nginx container + test and doc for this feature
  • a bit of refactor to avoid some code duplication
  • use an internal network for docker-gen in tests
  • a bit of unrelated doc cleanup on the docker-gen section

The tests on this branch are okay.

If you're okay with those change I can add them to your PR's branch and merge the PR.

@Knapoc
Copy link
Contributor Author

Knapoc commented May 15, 2025

@buchdag your changes make total sense and provide a cleaner solution. I'm totally fine with them. Also thank you for considering this feature/pull requests.

@buchdag
Copy link
Member

buchdag commented May 15, 2025

@Knapoc thank you for the PR and sorry for the long wait 😅

@buchdag buchdag merged commit 145278b into nginx-proxy:main May 15, 2025
2 checks passed
@Knapoc Knapoc deleted the network-segregation-seperate-containers branch May 15, 2025 13:45
@SchoNie
Copy link
Contributor

SchoNie commented May 21, 2025

The tests seems to be a bit flaky. Failing for me most of the time.
Also in: Merge pull request #2602 from p12tic/acme-unknown-virtual-host

@buchdag
Copy link
Member

buchdag commented May 23, 2025

@SchoNie indeed the tests for the feature I added (custom label) seems flaky, I'll remove the feature and test for now until I can understand what's happening / reproduce what's going on during tests.

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.

3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy