1
0
mirror of https://github.com/thib8956/nginx-proxy synced 2025-07-01 14:25:46 +00:00
Commit Graph

1168 Commits

Author SHA1 Message Date
b5a54ac219 tests: Reduce scope of docker_compose fixture (and friends)
This makes it possible to bring up different compose files for
different tests in the same test module.

This change does not negatively affect performance because the fixture
is a no-op if the docker compose filename is unchanged between tests.
2023-02-17 02:34:08 -05:00
4d8f878ba7 tests: Fixture that simplifies Docker compose file changes 2023-02-17 02:34:08 -05:00
f5a3492926 tests: Factor out DNS monkey patching to its own fixture 2023-02-17 02:34:08 -05:00
09a2f40633 tests: Turn helper function into docker_compose_file fixture
This makes it easier for tests to override the filename.
2023-02-17 02:34:08 -05:00
01745a836f tests: Fix path to ca-root.crt
`os.getcwd()` is not guaranteed to always return the `test/`
directory.
2023-02-17 02:34:08 -05:00
6207be5f8f fix: Partially revert "chore: Remove support for legacy swarm"
This partially reverts commit 2494e20784
by ignoring any network named "ingress" when searching for a
container's IP address.

That commit was technically a backwards-incompatible change: Some
users use nginx-proxy with Swarm mode even though it is not fully
supported.  In such cases nginx-proxy should ignore the `ingress`
network, otherwise nginx will not be able to reach the
server (container-to-container traffic apparently doesn't work over
the Swarm `ingress` network).

The parts of that commit that examine the `SwarmNode` structure are
not reverted here because docker-gen does not currently populate that
structure -- not even when both docker-gen and the service task
container are running on the same manager node.
2023-02-17 01:52:05 -05:00
6f2a549ef1 Merge pull request #2175 from nginx-proxy/dependabot/docker/golang-1.20.1
build: bump golang from 1.20.0 to 1.20.1
2023-02-15 03:47:19 -05:00
de4386e440 build: bump golang from 1.20.0 to 1.20.1
Bumps golang from 1.20.0 to 1.20.1.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-15 04:57:57 +00:00
bc2ada1f44 Merge pull request #2163 from nginx-proxy/dockergen-0.10.0
build: dockergen 0.9.4 -> 0.10.0
2023-02-09 08:28:09 +01:00
c10c7bcbe9 build: dockergen 0.9.4 -> 0.10.0 2023-02-09 08:10:43 +01:00
41e025f0f0 Merge pull request #2159 from rhansen/refactor
chore: Factor out container IP:port lookup
2023-02-09 08:01:26 +01:00
9b4bb07b34 fix: Don't create fallback http(s) server when http(s) disabled
Before, a fallback http server was created to handle requests for
unknown virtual hosts even when `HTTPS_METHOD=nohttp`.  (In this case,
all http vhosts would be unknown.)  Likewise, a catch-all fallback
https server was still created even if `HTTPS_METHOD=nohttps`.

Now the fallback servers are created only if needed.  This brings the
behavior in line with the documentation and user expectation.  It will
also make it easier to implement a planned feature: different servers
on different ports.
2023-02-04 18:59:38 -05:00
9297e94389 fix: Emit TLS error if there are no certs available
Before, if neither the vhost-specific cert nor `default.crt` existed,
nginx-proxy would not create the https vhost.  This resulted in nginx
either refusing the connection or serving the wrong vhost depending on
whether there was another https vhost with a certificate.

Now nginx-proxy always creates an https server for a vhost, even if
the vhost-specific certificate and the default certificate are both
missing.  When both certs are missing, nginx is given empty
certificate data to make it possible for it to start up without an
error.  The empty certificate data causes the user to see a TLS error,
which is much easier to troubleshoot than a connection refused error
or serving the wrong vhost.
2023-02-02 22:02:06 -05:00
16066cab61 fix: Don't create cert error https server if https is not enabled 2023-02-02 17:17:00 -05:00
ee8d2cede4 Merge pull request #2162 from nginx-proxy/dependabot/docker/golang-1.20.0
build: bump golang from 1.19.5 to 1.20.0
2023-02-02 02:20:26 -05:00
7b6b2f773d build: bump golang from 1.19.5 to 1.20.0
Bumps golang from 1.19.5 to 1.20.0.

---
updated-dependencies:
- dependency-name: golang
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-02 04:01:39 +00:00
18d0671312 chore: Factor out duplicate checks for default.crt
for improved readability.
2023-02-01 18:56:16 -05:00
7a2b1f8833 chore: Split $is_https variable into two separate checks
for improved readability.
2023-02-01 18:17:43 -05:00
11a46f728c chore: Factor out container IP:port lookup
This will make planned future changes easier.
2023-02-01 03:06:39 -05:00
2494e20784 chore: Remove support for legacy swarm
It doesn't work with the newer Docker Swarm mode so it doesn't have
much value anymore.
2023-02-01 03:04:37 -05:00
1462ff019d Merge pull request #1179 from harvdogg/master
Allow complete override of location blocks
2023-02-01 07:42:42 +01:00
2115974e93 feat: Add ability to completely override location blocks
Co-authored-by: Trent Harvey <trent@harvdog.net>
2023-01-31 04:53:12 -05:00
8ac8b021b8 Merge pull request #2155 from rhansen/docker-pull
chore: Pass `--pull` to `docker build` to get fresh images
2023-01-30 07:57:44 +01:00
926bd43cff Merge pull request #2153 from rhansen/upstream-cleanup
fix: Generate at most one `server` directive per container
2023-01-30 07:56:50 +01:00
912a065406 chore: Pass --pull to docker build to get fresh images
This is a no-op if the images are already up to date, and it prevents
puzzling problems when the images are old.
2023-01-28 18:17:40 -05:00
6162427c45 fix: Generate at most one server directive per container 2023-01-28 18:01:19 -05:00
bcec2d9075 chore: Refactor upstream template for readability
In particular, reduce the nesting depth to make it easier to
understand what the code is doing by:

  * converting an $O(nm)$ nested loop into two serial $O(n)+O(m)$
    loops, and
  * consolidating similar nested `if` cases.
2023-01-28 18:01:19 -05:00
daeed502cb feat: Add a warning comment if the container port is published 2023-01-28 18:01:19 -05:00
5a8a6ceae2 chore: Improve debug comments in upstream template 2023-01-28 18:01:19 -05:00
2760ead490 chore: Remove warning comment when port is not exposed
Exposing ports is largely deprecated because it doesn't actually do
anything in Docker.
2023-01-28 18:01:19 -05:00
e97bf606c8 chore: Move version comment to the top of the template
to ensure that the version is always the first output line.

Also, always output `# nginx-proxy`, even if the version isn't known.
This makes it easier to find the start of the generated config in the
output of `nginx -T`.
2023-01-28 18:01:19 -05:00
d6d53893e8 Merge pull request #2152 from vincent-herlemont/documentation-log-format
Documentation custom log format.
2023-01-28 03:32:21 -05:00
aa50116272 Documentation custom log format. 2023-01-27 23:16:49 +01:00
07cc80ac6b feat: Support LOG_FORMAT env variable (#2151) 2023-01-27 12:28:40 -05:00
8346b68a28 fix: Ignore VIRTUAL_HOST set to the empty string
Fixes #2144
2023-01-23 20:48:16 -05:00
f8ae0a4b00 feat: DEFAULT_ROOT=none disables the default location / block 2023-01-23 20:47:00 -05:00
d3ded293ac Merge pull request #2147 from nginx-proxy/dockergen-0.9.4
build: dockergen 0.9.3 -> 0.9.4
2023-01-24 00:27:54 +01:00
fa52426d54 ci: set Dependabot commit prefixs 2023-01-23 23:24:58 +01:00
8df67cdde8 build: dockergen 0.9.3 -> 0.9.4 2023-01-23 23:14:42 +01:00
98b6473c84 Merge pull request #2141 from rhansen/debug
feat: Unconditionally produce debug comments
2023-01-21 19:02:27 -05:00
8fbc8514ef feat: Unconditionally produce debug comments
Rationale for eliminating the check to see if the `DEBUG` environment
variable holds a true value:
  * The `DEBUG` environment variable might be set on a container (for
    purposes specific to that container, not `nginx-proxy`) to a value
    that cannot be parsed as a bool, which would break `nginx-proxy`.
  * It simplifies the template.
  * It eliminates a cold code path.
  * It avoids heisenbugs.
  * It makes debugging easier for users.

Also delete the debug info tests, as they are fragile and they provide
limited value.

Alternatively, we could avoid collision with the container's use of
the `DEBUG` environment variable by using a container label [1] such
as `com.google.nginx-proxy.nginx-proxy.debug`.  I think doing so has
dubious value, especially if we want to attempt backwards
compatibility with the `DEBUG` environment variable.

Fixes #2139

[1] https://docs.docker.com/engine/reference/commandline/run/#-set-metadata-on-container--l---label---label-file

Co-authored-by: Nicolas Duchon <nicolas.duchon@gmail.com>
2023-01-18 17:27:04 -05:00
1775420592 Merge pull request #2140 from rhansen/tests
Minor test fixes
2023-01-18 08:02:02 +01:00
92e1a6567e tests: Remove extraction of nginx.tmpl (now unnecessary) 2023-01-17 18:02:30 -05:00
486addd144 tests: Bind-mount the entire nginx-proxy directory in the container 2023-01-17 18:02:30 -05:00
569953521a tests: Exit non-zero if creation of nginx-proxy-tester image fails 2023-01-17 18:02:30 -05:00
55cfae9636 tests: Avoid unnecessary bashisms 2023-01-17 18:02:30 -05:00
d56b5b370d tests: Whitespace fixes 2023-01-17 18:02:30 -05:00
26b0b05f73 tests: Fix test_debug/* tests when IPv6 is enabled 2023-01-17 18:02:29 -05:00
5d22134ee6 Merge pull request #2137 from nginx-proxy/dockergen-0.9.3
build: dockergen 0.9.2 -> 0.9.3
2023-01-17 08:35:18 +01:00
b16ad27878 build: dockergen 0.9.2 -> 0.9.3 2023-01-17 08:17:02 +01:00