Skip to content

Commit 0c09a42

Browse files
committed
Merge branch 'master' of https://github.com/jlesage/docker-nginx-proxy-manager into crowdsec_rework
2 parents 1851836 + 5750dd4 commit 0c09a42

File tree

8 files changed

+95
-28
lines changed

8 files changed

+95
-28
lines changed

DOCKERHUB.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@ Nginx or Letsencrypt.
2323

2424
## Quick Start
2525

26-
**NOTE**: The Docker command provided in this quick start is given as an example
27-
and parameters should be adjusted to your need.
26+
**NOTE**:
27+
The Docker command provided in this quick start is given as an example
28+
and parameters should be adjusted to your need.
2829

2930
Launch the Nginx Proxy Manager docker container with the following command:
3031
```shell
@@ -38,6 +39,7 @@ docker run -d \
3839
```
3940

4041
Where:
42+
4143
- `/docker/appdata/nginx-proxy-manager`: This is where the application stores its configuration, states, log and any files needing persistency.
4244

4345
Browse to `http://your-host-ip:8181` to access the Nginx Proxy Manager web interface.

Dockerfile

Lines changed: 1 addition & 1 deletion
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.21.4.1
1212
ARG CROWDSEC_OPENRESTY_BOUNCER_VERSION=1.0.0
13-
ARG NGINX_PROXY_MANAGER_VERSION=2.9.22
13+
ARG NGINX_PROXY_MANAGER_VERSION=2.10.4
1414
ARG NGINX_HTTP_GEOIP2_MODULE_VERSION=3.3
1515
ARG LIBMAXMINDDB_VERSION=1.5.0
1616
ARG BCRYPT_TOOL_VERSION=1.1.2

README.md

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ Nginx or Letsencrypt.
4545

4646
## Quick Start
4747

48-
**NOTE**: The Docker command provided in this quick start is given as an example
49-
and parameters should be adjusted to your need.
48+
**NOTE**:
49+
The Docker command provided in this quick start is given as an example
50+
and parameters should be adjusted to your need.
5051

5152
Launch the Nginx Proxy Manager docker container with the following command:
5253
```shell
@@ -60,6 +61,7 @@ docker run -d \
6061
```
6162

6263
Where:
64+
6365
- `/docker/appdata/nginx-proxy-manager`: This is where the application stores its configuration, states, log and any files needing persistency.
6466

6567
Browse to `http://your-host-ip:8181` to access the Nginx Proxy Manager web interface.
@@ -116,7 +118,7 @@ While this can be useful for the user to adjust the value of environment
116118
variables to fit its needs, it can also be confusing and dangerous to keep all
117119
of them.
118120
119-
A good pratice is to set/keep only the variables that are needed for the
121+
A good practice is to set/keep only the variables that are needed for the
120122
container to behave as desired in a specific setup. If the value of variable is
121123
kept to its default value, it means that it can be removed. Keep in mind that
122124
all variables are optional, meaning that none of them is required for the
@@ -137,7 +139,7 @@ Removing environment variables that are not needed provides some advantages:
137139
on Synology, where an environment variable without value might not be
138140
allowed. This behavior is wrong: it's absolutely fine to have a variable
139141
without value. In fact, this container does have variables without value by
140-
default. Thus, removing uneeded variables is a good way to prevent
142+
default. Thus, removing unneeded variables is a good way to prevent
141143
deployment issue on these devices.
142144
143145
### Data Volumes
@@ -179,20 +181,23 @@ parameter(s) of an existing container. The general idea is to destroy and
179181
re-create the container:
180182
181183
1. Stop the container (if it is running):
182-
```
184+
```shell
183185
docker stop nginx-proxy-manager
184186
```
187+
185188
2. Remove the container:
186-
```
189+
```shell
187190
docker rm nginx-proxy-manager
188191
```
192+
189193
3. Create/start the container using the `docker run` command, by adjusting
190194
parameters as needed.
191195
192-
**NOTE**: Since all application's data is saved under the `/config` container
193-
folder, destroying and re-creating a container is not a problem: nothing is lost
194-
and the application comes back with the same state (as long as the mapping of
195-
the `/config` folder remains the same).
196+
**NOTE**:
197+
Since all application's data is saved under the `/config` container
198+
folder, destroying and re-creating a container is not a problem: nothing is
199+
lost and the application comes back with the same state (as long as the
200+
mapping of the `/config` folder remains the same).
196201
197202
## Docker Compose File
198203
@@ -245,17 +250,20 @@ Watchtower will seamlessly perform the necessary steps to update the container.
245250
Finally, the Docker image can be manually updated with these steps:
246251
247252
1. Fetch the latest image:
248-
```
253+
```shell
249254
docker pull jlesage/nginx-proxy-manager
250255
```
256+
251257
2. Stop the container:
252-
```
258+
```shell
253259
docker stop nginx-proxy-manager
254260
```
261+
255262
3. Remove the container:
256-
```
263+
```shell
257264
docker rm nginx-proxy-manager
258265
```
266+
259267
4. Create and start the container using the `docker run` command, with the
260268
the same parameters that were used when it was deployed initially.
261269
@@ -306,7 +314,7 @@ user owning the data volume on the host:
306314
id <username>
307315
308316
Which gives an output like this one:
309-
```
317+
```text
310318
uid=1000(myuser) gid=1000(myuser) groups=1000(myuser),4(adm),24(cdrom),27(sudo),46(plugdev),113(lpadmin)
311319
```
312320
@@ -318,7 +326,7 @@ be given the container.
318326
Assuming that container's ports are mapped to the same host's ports, the
319327
interface of the application can be accessed with a web browser at:
320328
321-
```
329+
```text
322330
http://<HOST IP ADDR>:8181
323331
```
324332

appdefs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ app:
9797
- `CONTAINER_NAME` is the name of the running container.
9898
- `USER_EMAIL` is the email of the address to reset the password.
9999
changelog:
100+
- version: 23.08.1
101+
date: 2023-08-04
102+
changes:
103+
- 'Updated Nginx Proxy Manager to version 2.10.4.'
100104
- version: 23.04.1
101105
date: 2023-04-07
102106
changes:
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# This command reads the `DISABLE_IPV6` env var and will either enable
4+
# or disable ipv6 in all nginx configs based on this setting.
5+
6+
# Lowercase
7+
DISABLE_IPV6=$(echo "${DISABLE_IPV6:-}" | tr '[:upper:]' '[:lower:]')
8+
9+
FOLDER=$1
10+
if [ "$FOLDER" == "" ]; then
11+
echo "$0 requires a absolute folder path as the first argument!"
12+
exit 1
13+
fi
14+
15+
FILES=$(find "$FOLDER" -type f -name "*.conf")
16+
SED_REGEX=
17+
18+
if [ "$DISABLE_IPV6" == "true" ] || [ "$DISABLE_IPV6" == "on" ] || [ "$DISABLE_IPV6" == "1" ] || [ "$DISABLE_IPV6" == "yes" ]; then
19+
# IPV6 is disabled
20+
echo "Disabling IPV6 in hosts in: $1"
21+
SED_REGEX='s/^([^#]*)listen \[::\]/\1#listen [::]/g'
22+
else
23+
# IPV6 is enabled
24+
echo "Enabling IPV6 in hosts in: $1"
25+
SED_REGEX='s/^(\s*)#listen \[::\]/\1listen [::]/g'
26+
fi
27+
28+
for FILE in $FILES
29+
do
30+
echo "- ${FILE}"
31+
echo "$(sed -E "$SED_REGEX" "$FILE")" > $FILE
32+
done

src/nginx-proxy-manager/build.sh

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ sed -i "s/\"version\": \"0.0.0\",/\"version\": \"${NGINX_PROXY_MANAGER_VERSION}\
7575

7676
log "Patching Nginx Proxy Manager backend..."
7777
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
7879

7980
cp -r /tmp/nginx-proxy-manager /app
8081

@@ -122,7 +123,6 @@ cp -rv /app/frontend/dist $ROOTFS/opt/nginx-proxy-manager/frontend
122123
cp -rv /app/global $ROOTFS/opt/nginx-proxy-manager/global
123124

124125
mkdir $ROOTFS/opt/nginx-proxy-manager/bin
125-
cp -rv /tmp/nginx-proxy-manager/docker/rootfs/bin/handle-ipv6-setting $ROOTFS/opt/nginx-proxy-manager/bin/
126126
cp -rv /tmp/nginx-proxy-manager/docker/rootfs/etc/nginx $ROOTFS/etc/
127127
cp -rv /tmp/nginx-proxy-manager/docker/rootfs/var/www $ROOTFS/var/
128128
cp -rv /tmp/nginx-proxy-manager/docker/rootfs/etc/letsencrypt.ini $ROOTFS/etc/
@@ -157,7 +157,7 @@ sed -i 's|:443;|:4443;|' $ROOTFS/opt/nginx-proxy-manager/templates/_listen.conf
157157
sed -i 's|-g "error_log off;"||' $ROOTFS/opt/nginx-proxy-manager/internal/nginx.js
158158

159159
# Remove the `user` directive, since we want nginx to run as non-root.
160-
sed -i 's|user root;|#user root;|' $ROOTFS/etc/nginx/nginx.conf
160+
sed -i 's|user npm;|#user npm;|' $ROOTFS/etc/nginx/nginx.conf
161161

162162
# Change client_body_temp_path.
163163
sed -i 's|/tmp/nginx/body|/var/tmp/nginx/body|' $ROOTFS/etc/nginx/nginx.conf
@@ -190,10 +190,6 @@ ln -s /config/production.json $ROOTFS/opt/nginx-proxy-manager/config/production.
190190
# Make sure letsencrypt certificates are stored in persistent volume.
191191
ln -s /config/letsencrypt $ROOTFS/etc/letsencrypt
192192

193-
# Make sure some default certbot directories are stored in persistent volume.
194-
ln -s /config/letsencrypt-workdir $ROOTFS/var/lib/letsencrypt
195-
ln -s /config/log/letsencrypt $ROOTFS/var/log/letsencrypt
196-
197193
# Cleanup.
198194
find $ROOTFS/opt/nginx-proxy-manager -name "*.h" -delete
199195
find $ROOTFS/opt/nginx-proxy-manager -name "*.cc" -delete

src/nginx-proxy-manager/pip-install.patch

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ index da104a2..730d826 100644
66
const escapedCredentials = certificate.meta.dns_provider_credentials.replaceAll('\'', '\\\'').replaceAll('\\', '\\\\');
77
const credentialsCmd = 'mkdir -p /etc/letsencrypt/credentials 2> /dev/null; echo \'' + escapedCredentials + '\' > \'' + credentialsLocation + '\' && chmod 600 \'' + credentialsLocation + '\'';
88
// we call `. /opt/certbot/bin/activate` (`.` is alternative to `source` in dash) to access certbot venv
9-
- let prepareCmd = '. /opt/certbot/bin/activate && pip install ' + dns_plugin.package_name + (dns_plugin.version_requirement || '') + ' ' + dns_plugin.dependencies + ' && deactivate';
10-
+ let prepareCmd = 'pip install ' + dns_plugin.package_name + (dns_plugin.version_requirement || '') + ' ' + dns_plugin.dependencies;
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;
1111

1212
// Whether the plugin has a --<name>-credentials argument
1313
const hasConfigArg = certificate.meta.dns_provider !== 'route53';
@@ -19,8 +19,8 @@ index a4b51c9..6d3d3e3 100644
1919
});
2020

2121
if (plugins.length) {
22-
- const install_cmd = '. /opt/certbot/bin/activate && pip install ' + plugins.join(' ') + ' && deactivate';
23-
+ const install_cmd = 'pip install ' + plugins.join(' ');
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(' ');
2424
promises.push(utils.exec(install_cmd));
2525
}
2626

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Because of the Oracle Cloud Infrastructure DNS plugin dependencies, installing
2+
it causes certbot to be downgraded, which then break any execution of certbot.
3+
--- a/global/certbot-dns-plugins.js
4+
+++ b/global/certbot-dns-plugins.js
5+
@@ -437,20 +437,6 @@ dns_netcup_api_password = abcdef0123456789abcdef01234567abcdef0123`,
6+
full_plugin_name: 'dns-nsone',
7+
},
8+
//####################################################//
9+
- oci: {
10+
- display_name: 'Oracle Cloud Infrastructure DNS',
11+
- package_name: 'certbot-dns-oci',
12+
- package_version: '0.3.6',
13+
- dependencies: 'oci',
14+
- credentials: `[DEFAULT]
15+
-user = ocid1.user.oc1...
16+
-fingerprint = xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
17+
-tenancy = ocid1.tenancy.oc1...
18+
-region = us-ashburn-1
19+
-key_file = ~/.oci/oci_api_key.pem`,
20+
- full_plugin_name: 'dns-oci',
21+
- },
22+
- //####################################################//
23+
online: {
24+
display_name: 'Online',
25+
package_name: 'certbot-dns-online',

0 commit comments

Comments
 (0)