Skip to content

Commit 61fb0e5

Browse files
committed
Merge branch 'master' of https://github.com/LePresidente/docker-nginx-proxy-manager into crowdsec_rework
2 parents 8a06521 + 5ab02e9 commit 61fb0e5

12 files changed

+136
-186
lines changed

.github/workflows/build-image.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,22 @@ jobs:
100100
#echo "build_date=$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> $GITHUB_OUTPUT
101101
102102
- name: Setup QEMU
103-
uses: docker/setup-qemu-action@v2
103+
uses: docker/setup-qemu-action@v3
104104
with:
105105
platforms: arm,arm64,ppc64le,mips64,s390x
106106

107107
- name: Setup Docker Buildx
108-
uses: docker/setup-buildx-action@v2
108+
uses: docker/setup-buildx-action@v3
109109

110110
- name: Login to DockerHub
111111
if: ${{ steps.prep.outputs.is_release == 'yes' }}
112-
uses: docker/login-action@v2
112+
uses: docker/login-action@v3
113113
with:
114114
username: ${{ secrets.DOCKERHUB_USERNAME }}
115115
password: ${{ secrets.DOCKERHUB_PASSWORD }}
116116

117117
- name: Build and push
118-
uses: docker/build-push-action@v4
118+
uses: docker/build-push-action@v5
119119
with:
120120
push: ${{ steps.prep.outputs.is_release == 'yes' }}
121121
provenance: false
@@ -132,12 +132,12 @@ jobs:
132132
docker buildx imagetools inspect ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.prep.outputs.version }}
133133
134134
- name: Checkout
135-
uses: actions/checkout@v3
135+
uses: actions/checkout@v4
136136
if: ${{ steps.prep.outputs.release_type == 'standard' }}
137137

138138
- name: Dockerhub description
139139
if: ${{ steps.prep.outputs.release_type == 'standard' }}
140-
uses: peter-evans/dockerhub-description@v3
140+
uses: peter-evans/dockerhub-description@v4
141141
with:
142142
username: ${{ secrets.DOCKERHUB_USERNAME }}
143143
password: ${{ secrets.DOCKERHUB_PASSWORD }}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ ARG DOCKER_IMAGE_VERSION=
1010
# Define software versions.
1111
ARG OPENRESTY_VERSION=1.19.9.1
1212
ARG CROWDSEC_OPENRESTY_BOUNCER_VERSION=1.0.2
13-
ARG NGINX_PROXY_MANAGER_VERSION=2.10.4
13+
ARG NGINX_PROXY_MANAGER_VERSION=2.11.3
1414
ARG NGINX_HTTP_GEOIP2_MODULE_VERSION=3.3
1515
ARG LIBMAXMINDDB_VERSION=1.5.0
1616
ARG BCRYPT_TOOL_VERSION=1.1.2
@@ -89,7 +89,7 @@ COPY src/cs-openresty-bouncer /build
8989
RUN /build/build.sh "$CROWDSEC_OPENRESTY_BOUNCER_URL"
9090

9191
# Pull base image.
92-
FROM jlesage/baseimage:alpine-3.16-v3.5.2
92+
FROM jlesage/baseimage:alpine-3.16-v3.6.2
9393

9494
ARG NGINX_PROXY_MANAGER_VERSION
9595
ARG DOCKER_IMAGE_VERSION

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Jocelyn Le Sage
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 65 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,39 @@
1+
## Note
2+
3+
This is a drop in replacement for [jlesage/nginx-proxy-manager](https://hub.docker.com/r/jlesage/nginx-proxy-manager)
4+
5+
This fork includes the [OpenResty Crowdsec Bouncer](https://github.com/crowdsecurity/cs-openresty-bouncer)
6+
7+
Please see the [crowdsec_support](https://github.com/LePresidente/docker-nginx-proxy-manager/tree/crowdsec_support) branch for the changes as
8+
9+
Docker images hosted on dockerhub.
10+
11+
https://hub.docker.com/r/lepresidente/nginx-proxy-manager
12+
13+
| TAG | cs-openresty-bouncer version|
14+
|-----------|-----------------------------|
15+
| latest | 0.1.10 (PreRelease) |
16+
17+
18+
Instructions to use:
19+
Starting the container at this point will start Nginx-Proxy-Manager as before but will create a new file in /config/crowdsec/ called crowdsec-openresty-bouncer.conf
20+
21+
You will need to edit this file with at least the following changes then restart the container.
22+
23+
```
24+
ENABLED=true
25+
API_URL=http://<crowdsecserver>:8080
26+
API_KEY=<APIKEY>
27+
```
28+
29+
the crowdsec api key can be generated on the crowdsec instance using the following command
30+
31+
```
32+
cscli bouncers add npm-proxy
33+
```
34+
35+
Currently this is a side project and I will try keep this up to date
36+
137
# Docker container for Nginx Proxy Manager
238
[![Release](https://img.shields.io/github/release/jlesage/docker-nginx-proxy-manager.svg?logo=github&style=for-the-badge)](https://github.com/jlesage/docker-nginx-proxy-manager/releases/latest)
339
[![Docker Image Size](https://img.shields.io/docker/image-size/jlesage/nginx-proxy-manager/latest?logo=docker&style=for-the-badge)](https://hub.docker.com/r/jlesage/nginx-proxy-manager/tags)
@@ -79,15 +115,15 @@ docker run [-d] \
79115
80116
| Parameter | Description |
81117
|-----------|-------------|
82-
| -d | Run the container in the background. If not set, the container runs in the foreground. |
83-
| -e | Pass an environment variable to the container. See the [Environment Variables](#environment-variables) section for more details. |
84-
| -v | Set a volume mapping (allows to share a folder/file between the host and the container). See the [Data Volumes](#data-volumes) section for more details. |
85-
| -p | Set a network port mapping (exposes an internal container port to the host). See the [Ports](#ports) section for more details. |
118+
| -d | Run the container in the background. If not set, the container runs in the foreground. |
119+
| -e | Pass an environment variable to the container. See the [Environment Variables](#environment-variables) section for more details. |
120+
| -v | Set a volume mapping (allows to share a folder/file between the host and the container). See the [Data Volumes](#data-volumes) section for more details. |
121+
| -p | Set a network port mapping (exposes an internal container port to the host). See the [Ports](#ports) section for more details. |
86122
87123
### Environment Variables
88124
89125
To customize some properties of the container, the following environment
90-
variables can be passed via the `-e` parameter (one for each variable). Value
126+
variables can be passed via the `-e` parameter (one for each variable). Value
91127
of this parameter has the format `<VARIABLE_NAME>=<VALUE>`.
92128
93129
| Variable | Description | Default |
@@ -108,7 +144,7 @@ of this parameter has the format `<VARIABLE_NAME>=<VALUE>`.
108144
#### Deployment Considerations
109145
110146
Many tools used to manage Docker containers extract environment variables
111-
defined by the Docker image and use them to create/deploy the container. For
147+
defined by the Docker image and use them to create/deploy the container. For
112148
example, this is done by:
113149
- The Docker application on Synology NAS
114150
- The Container Station on QNAP NAS
@@ -120,33 +156,33 @@ variables to fit its needs, it can also be confusing and dangerous to keep all
120156
of them.
121157
122158
A good practice is to set/keep only the variables that are needed for the
123-
container to behave as desired in a specific setup. If the value of variable is
124-
kept to its default value, it means that it can be removed. Keep in mind that
159+
container to behave as desired in a specific setup. If the value of variable is
160+
kept to its default value, it means that it can be removed. Keep in mind that
125161
all variables are optional, meaning that none of them is required for the
126162
container to start.
127163
128164
Removing environment variables that are not needed provides some advantages:
129165
130-
- Prevents keeping variables that are no longer used by the container. Over
166+
- Prevents keeping variables that are no longer used by the container. Over
131167
time, with image updates, some variables might be removed.
132-
- Allows the Docker image to change/fix a default value. Again, with image
168+
- Allows the Docker image to change/fix a default value. Again, with image
133169
updates, the default value of a variable might be changed to fix an issue,
134170
or to better support a new feature.
135171
- Prevents changes to a variable that might affect the correct function of
136-
the container. Some undocumented variables, like `PATH` or `ENV`, are
137-
required to be exposed, but are not meant to be changed by users. However,
172+
the container. Some undocumented variables, like `PATH` or `ENV`, are
173+
required to be exposed, but are not meant to be changed by users. However,
138174
container management tools still show these variables to users.
139175
- There is a bug with the Container Station on QNAP and the Docker application
140176
on Synology, where an environment variable without value might not be
141-
allowed. This behavior is wrong: it's absolutely fine to have a variable
142-
without value. In fact, this container does have variables without value by
143-
default. Thus, removing unneeded variables is a good way to prevent
177+
allowed. This behavior is wrong: it's absolutely fine to have a variable
178+
without value. In fact, this container does have variables without value by
179+
default. Thus, removing unneeded variables is a good way to prevent
144180
deployment issue on these devices.
145181
146182
### Data Volumes
147183
148-
The following table describes data volumes used by the container. The mappings
149-
are set via the `-v` parameter. Each mapping is specified with the following
184+
The following table describes data volumes used by the container. The mappings
185+
are set via the `-v` parameter. Each mapping is specified with the following
150186
format: `<HOST_DIR>:<CONTAINER_DIR>[:PERMISSIONS]`.
151187
152188
| Container path | Permissions | Description |
@@ -158,8 +194,8 @@ format: `<HOST_DIR>:<CONTAINER_DIR>[:PERMISSIONS]`.
158194
Here is the list of ports used by the container.
159195
160196
When using the default bridge network, ports can be mapped to the host via the
161-
`-p` parameter (one per port mapping). Each mapping is defined with the
162-
following format: `<HOST_PORT>:<CONTAINER_PORT>`. The port number used inside
197+
`-p` parameter (one per port mapping). Each mapping is defined with the
198+
following format: `<HOST_PORT>:<CONTAINER_PORT>`. The port number used inside
163199
the container might not be changeable, but you are free to use any port on the
164200
host side.
165201
@@ -178,7 +214,7 @@ As can be seen, environment variables, volume and port mappings are all specifie
178214
while creating the container.
179215
180216
The following steps describe the method used to add, remove or update
181-
parameter(s) of an existing container. The general idea is to destroy and
217+
parameter(s) of an existing container. The general idea is to destroy and
182218
re-create the container:
183219
184220
1. Stop the container (if it is running):
@@ -205,7 +241,7 @@ docker rm nginx-proxy-manager
205241
Here is an example of a `docker-compose.yml` file that can be used with
206242
[Docker Compose](https://docs.docker.com/compose/overview/).
207243
208-
Make sure to adjust according to your needs. Note that only mandatory network
244+
Make sure to adjust according to your needs. Note that only mandatory network
209245
ports are part of the example.
210246
211247
```yaml
@@ -223,11 +259,11 @@ services:
223259
224260
## Docker Image Versioning
225261
226-
Each release of a Docker image is versioned. Prior to october 2022, the
262+
Each release of a Docker image is versioned. Prior to october 2022, the
227263
[semantic versioning](https://semver.org) was used as the versioning scheme.
228264
229265
Since then, versioning scheme changed to
230-
[calendar versioning](https://calver.org). The format used is `YY.MM.SEQUENCE`,
266+
[calendar versioning](https://calver.org). The format used is `YY.MM.SEQUENCE`,
231267
where:
232268
- `YY` is the zero-padded year (relative to year 2000).
233269
- `MM` is the zero-padded month.
@@ -238,10 +274,10 @@ where:
238274
239275
Because features are added, issues are fixed, or simply because a new version
240276
of the containerized application is integrated, the Docker image is regularly
241-
updated. Different methods can be used to update the Docker image.
277+
updated. Different methods can be used to update the Docker image.
242278
243279
The system used to run the container may have a built-in way to update
244-
containers. If so, this could be your primary way to update Docker images.
280+
containers. If so, this could be your primary way to update Docker images.
245281
246282
An other way is to have the image be automatically updated with [Watchtower].
247283
Watchtower is a container-based solution for automating Docker image updates.
@@ -279,12 +315,12 @@ container image.
279315
2. Click on *Registry* in the left pane.
280316
3. In the search bar, type the name of the container (`jlesage/nginx-proxy-manager`).
281317
4. Select the image, click *Download* and then choose the `latest` tag.
282-
5. Wait for the download to complete. A notification will appear once done.
318+
5. Wait for the download to complete. A notification will appear once done.
283319
6. Click on *Container* in the left pane.
284320
7. Select your Nginx Proxy Manager container.
285321
8. Stop it by clicking *Action*->*Stop*.
286322
9. Clear the container by clicking *Action*->*Reset* (or *Action*->*Clear* if
287-
you don't have the latest *Docker* application). This removes the
323+
you don't have the latest *Docker* application). This removes the
288324
container while keeping its configuration.
289325
10. Start the container again by clicking *Action*->*Start*. **NOTE**: The
290326
container may temporarily disappear from the list while it is re-created.
@@ -300,8 +336,8 @@ For unRAID, a container image can be updated by following these steps:
300336
## User/Group IDs
301337
302338
When using data volumes (`-v` flags), permissions issues can occur between the
303-
host and the container. For example, the user within the container may not
304-
exist on the host. This could prevent the host from properly accessing files
339+
host and the container. For example, the user within the container may not
340+
exist on the host. This could prevent the host from properly accessing files
305341
and folders on the shared volume.
306342
307343
To avoid any problem, you can specify the user the application should run as.

appdefs.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ app:
9898
- `CONTAINER_NAME` is the name of the running container.
9999
- `USER_EMAIL` is the email of the address to reset the password.
100100
changelog:
101+
- version: 24.07.1
102+
date: 2024-07-05
103+
changes:
104+
- 'Updated Nginx Proxy Manager to version 2.11.3.'
105+
- 'Updated baseimage to version 3.6.2.'
101106
- version: 23.12.2
102107
date: 2023-12-20
103108
changes:

rootfs/startapp.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ export SUPPRESS_NO_CONFIG_WARNING=1
99

1010
cd /opt/nginx-proxy-manager
1111
exec node --abort_on_uncaught_exception --max_old_space_size=250 index.js
12+
13+
# vim:ft=sh:ts=4:sw=4:et:sts=4

src/nginx-proxy-manager/build.sh

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,14 @@ sed -i "s/\"version\": \"0.0.0\",/\"version\": \"${NGINX_PROXY_MANAGER_VERSION}\
7474
sed -i "s/\"version\": \"0.0.0\",/\"version\": \"${NGINX_PROXY_MANAGER_VERSION}\",/" /tmp/nginx-proxy-manager/backend/package.json
7575

7676
log "Patching Nginx Proxy Manager backend..."
77-
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/pip-install.patch
78-
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/remove-certbot-dns-oci.patch
79-
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/powerdns-fix.patch
80-
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/http2-support-fix.patch
81-
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/reachability-test-fix.patch
77+
PATCHES="
78+
pip-install.patch
79+
remove-certbot-dns-oci.patch
80+
"
81+
for P in $PATCHES; do
82+
echo "Applying $P..."
83+
patch -p1 -d /tmp/nginx-proxy-manager < "$SCRIPT_DIR"/"$P"
84+
done
8285

8386
cp -r /tmp/nginx-proxy-manager /app
8487

@@ -166,7 +169,7 @@ sed -i 's|user npm;|#user npm;|' $ROOTFS/etc/nginx/nginx.conf
166169
sed -i 's|/tmp/nginx/body|/var/tmp/nginx/body|' $ROOTFS/etc/nginx/nginx.conf
167170

168171
# Fix the logrotate config.
169-
sed -i 's|root root|app app|' $ROOTFS/etc/logrotate.d/nginx-proxy-manager
172+
sed -i 's|npm npm|app app|' $ROOTFS/etc/logrotate.d/nginx-proxy-manager
170173
sed -i 's|/run/nginx.pid|/run/nginx/nginx.pid|' $ROOTFS/etc/logrotate.d/nginx-proxy-manager
171174
sed -i 's|logrotate /etc/logrotate.d/nginx-proxy-manager|logrotate -s /config/logrotate.status /etc/logrotate.d/nginx-proxy-manager|' $ROOTFS/opt/nginx-proxy-manager/setup.js
172175
sed -i 's|/data/logs/\*/access.log|/data/logs/access.log|' $ROOTFS/etc/logrotate.d/nginx-proxy-manager

src/nginx-proxy-manager/http2-support-fix.patch

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,11 @@
1-
diff --git a/backend/internal/certificate.js b/backend/internal/certificate.js
2-
index da104a2..730d826 100644
3-
--- a/backend/internal/certificate.js
4-
+++ b/backend/internal/certificate.js
5-
@@ -871,7 +871,7 @@ const internalCertificate = {
6-
const escapedCredentials = certificate.meta.dns_provider_credentials.replaceAll('\'', '\\\'').replaceAll('\\', '\\\\');
7-
const credentialsCmd = 'mkdir -p /etc/letsencrypt/credentials 2> /dev/null; echo \'' + escapedCredentials + '\' > \'' + credentialsLocation + '\' && chmod 600 \'' + credentialsLocation + '\'';
8-
// we call `. /opt/certbot/bin/activate` (`.` is alternative to `source` in dash) to access certbot venv
9-
- const prepareCmd = '. /opt/certbot/bin/activate && pip install --no-cache-dir ' + dns_plugin.package_name + (dns_plugin.version_requirement || '') + ' ' + dns_plugin.dependencies + ' && deactivate';
10-
+ const prepareCmd = 'pip install --no-cache-dir ' + dns_plugin.package_name + (dns_plugin.version_requirement || '') + ' ' + dns_plugin.dependencies;
11-
12-
// Whether the plugin has a --<name>-credentials argument
13-
const hasConfigArg = certificate.meta.dns_provider !== 'route53';
14-
diff --git a/backend/setup.js b/backend/setup.js
15-
index a4b51c9..6d3d3e3 100644
16-
--- a/backend/setup.js
17-
+++ b/backend/setup.js
18-
@@ -189,7 +189,7 @@ const setupCertbotPlugins = () => {
19-
});
20-
21-
if (plugins.length) {
22-
- const install_cmd = '. /opt/certbot/bin/activate && pip install --no-cache-dir ' + plugins.join(' ') + ' && deactivate';
23-
+ const install_cmd = 'pip install --no-cache-dir ' + plugins.join(' ');
24-
promises.push(utils.exec(install_cmd));
25-
}
1+
--- a/backend/lib/certbot.js
2+
+++ b/backend/lib/certbot.js
3+
@@ -63,7 +63,7 @@
4+
plugin.version = plugin.version.replace(/{{certbot-version}}/g, CERTBOT_VERSION_REPLACEMENT);
5+
plugin.dependencies = plugin.dependencies.replace(/{{certbot-version}}/g, CERTBOT_VERSION_REPLACEMENT);
266

7+
- const cmd = '. /opt/certbot/bin/activate && pip install --no-cache-dir ' + plugin.dependencies + ' ' + plugin.package_name + plugin.version + ' ' + ' && deactivate';
8+
+ const cmd = 'pip install --no-cache-dir ' + plugin.dependencies + ' ' + plugin.package_name + plugin.version;
9+
return utils.exec(cmd)
10+
.then((result) => {
11+
logger.complete(`Installed ${pluginKey}`);

src/nginx-proxy-manager/powerdns-fix.patch

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)