Skip to content

Commit 3d2406a

Browse files
authored
Merge pull request NginxProxyManager#2905 from NginxProxyManager/develop
v2.10.3
2 parents 86ddd9c + 0127dc7 commit 3d2406a

File tree

17 files changed

+101
-52
lines changed

17 files changed

+101
-52
lines changed

.version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.10.2
1+
2.10.3

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<p align="center">
22
<img src="https://nginxproxymanager.com/github.png">
33
<br><br>
4-
<img src="https://img.shields.io/badge/version-2.10.2-green.svg?style=for-the-badge">
4+
<img src="https://img.shields.io/badge/version-2.10.3-green.svg?style=for-the-badge">
55
<a href="https://hub.docker.com/repository/docker/jc21/nginx-proxy-manager">
66
<img src="https://img.shields.io/docker/stars/jc21/nginx-proxy-manager.svg?style=for-the-badge">
77
</a>

docker/Dockerfile

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ ARG BUILD_VERSION
1010
ARG BUILD_COMMIT
1111
ARG BUILD_DATE
1212

13+
# See: https://github.com/just-containers/s6-overlay/blob/master/README.md
1314
ENV SUPPRESS_NO_CONFIG_WARNING=1 \
14-
S6_FIX_ATTRS_HIDDEN=1 \
1515
S6_BEHAVIOUR_IF_STAGE2_FAILS=1 \
16+
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
17+
S6_FIX_ATTRS_HIDDEN=1 \
18+
S6_KILL_FINISH_MAXTIME=10000 \
19+
S6_VERBOSITY=1 \
1620
NODE_ENV=production \
1721
NPM_BUILD_VERSION="${BUILD_VERSION}" \
1822
NPM_BUILD_COMMIT="${BUILD_COMMIT}" \

docker/dev/Dockerfile

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
FROM jc21/nginx-full:certbot-node
22
LABEL maintainer="Jamie Curnow <jc@jc21.com>"
33

4-
ENV S6_LOGGING=0 \
5-
SUPPRESS_NO_CONFIG_WARNING=1 \
6-
S6_FIX_ATTRS_HIDDEN=1
4+
# See: https://github.com/just-containers/s6-overlay/blob/master/README.md
5+
ENV SUPPRESS_NO_CONFIG_WARNING=1 \
6+
S6_BEHAVIOUR_IF_STAGE2_FAILS=1 \
7+
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
8+
S6_FIX_ATTRS_HIDDEN=1 \
9+
S6_KILL_FINISH_MAXTIME=10000 \
10+
S6_VERBOSITY=2
711

812
RUN echo "fs.file-max = 65535" > /etc/sysctl.conf \
913
&& apt-get update \

docker/docker-compose.ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ services:
3535
DB_SQLITE_FILE: '/data/mydb.sqlite'
3636
PUID: 1000
3737
PGID: 1000
38+
DISABLE_IPV6: 'true'
3839
volumes:
3940
- npm_data:/data
4041
expose:

docker/rootfs/bin/common.sh

+12
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ export CYAN BLUE YELLOW RED RESET
1212
PUID=${PUID:-0}
1313
PGID=${PGID:-0}
1414

15+
NPMUSER=npm
16+
NPMGROUP=npm
17+
NPMHOME=/tmp/npmuserhome
18+
export NPMUSER NPMGROUP NPMHOME
19+
1520
if [[ "$PUID" -ne '0' ]] && [ "$PGID" = '0' ]; then
1621
# set group id to same as user id,
1722
# the user probably forgot to specify the group id and
@@ -40,3 +45,10 @@ log_fatal () {
4045
/run/s6/basedir/bin/halt
4146
exit 1
4247
}
48+
49+
# param $1: group_name
50+
get_group_id () {
51+
if [ "${1:-}" != '' ]; then
52+
getent group "$1" | cut -d: -f3
53+
fi
54+
}

docker/rootfs/etc/nginx/nginx.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# run nginx in foreground
22
daemon off;
33
pid /run/nginx/nginx.pid;
4-
user npmuser;
4+
user npm;
55

66
# Set number of worker processes automatically based on number of CPU cores.
77
worker_processes auto;

docker/rootfs/etc/s6-overlay/s6-rc.d/backend/run

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ cd /app || exit 1
1010
log_info 'Starting backend ...'
1111

1212
if [ "${DEVELOPMENT:-}" = 'true' ]; then
13-
s6-setuidgid npmuser yarn install
14-
exec s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js'
13+
s6-setuidgid "$PUID:$PGID" yarn install
14+
exec s6-setuidgid "$PUID:$PGID" bash -c "export HOME=$NPMHOME;node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js"
1515
else
1616
while :
1717
do
18-
s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --abort_on_uncaught_exception --max_old_space_size=250 index.js'
18+
s6-setuidgid "$PUID:$PGID" bash -c "export HOME=$NPMHOME;node --abort_on_uncaught_exception --max_old_space_size=250 index.js"
1919
sleep 1
2020
done
2121
fi

docker/rootfs/etc/s6-overlay/s6-rc.d/frontend/run

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ set -e
88
if [ "$DEVELOPMENT" = 'true' ]; then
99
. /bin/common.sh
1010
cd /app/frontend || exit 1
11-
HOME=/tmp/npmuserhome
11+
HOME=$NPMHOME
1212
export HOME
1313
mkdir -p /app/frontend/dist
1414
chown -R "$PUID:$PGID" /app/frontend/dist
1515

1616
log_info 'Starting frontend ...'
17-
s6-setuidgid npmuser yarn install
18-
exec s6-setuidgid npmuser yarn watch
17+
s6-setuidgid "$PUID:$PGID" yarn install
18+
exec s6-setuidgid "$PUID:$PGID" yarn watch
1919
else
2020
exit 0
2121
fi

docker/rootfs/etc/s6-overlay/s6-rc.d/nginx/run

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ set -e
66
. /bin/common.sh
77

88
log_info 'Starting nginx ...'
9-
exec s6-setuidgid npmuser nginx
9+
exec s6-setuidgid "$PUID:$PGID" nginx

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/00-all.sh

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,11 @@ if [ "$(id -u)" != "0" ]; then
99
log_fatal "This docker container must be run as root, do not specify a user.\nYou can specify PUID and PGID env vars to run processes as that user and group after initialization."
1010
fi
1111

12-
. /etc/s6-overlay/s6-rc.d/prepare/10-npmuser.sh
12+
if [ "$DEBUG" = "true" ]; then
13+
set -x
14+
fi
15+
16+
. /etc/s6-overlay/s6-rc.d/prepare/10-usergroup.sh
1317
. /etc/s6-overlay/s6-rc.d/prepare/20-paths.sh
1418
. /etc/s6-overlay/s6-rc.d/prepare/30-ownership.sh
1519
. /etc/s6-overlay/s6-rc.d/prepare/40-dynamic.sh

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/10-npmuser.sh

-20
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/command/with-contenv bash
2+
# shellcheck shell=bash
3+
4+
set -e
5+
6+
log_info "Configuring $NPMUSER user ..."
7+
8+
if id -u "$NPMUSER" 2>/dev/null; then
9+
# user already exists
10+
usermod -u "$PUID" "$NPMUSER"
11+
else
12+
# Add user
13+
useradd -o -u "$PUID" -U -d "$NPMHOME" -s /bin/false "$NPMUSER"
14+
fi
15+
16+
log_info "Configuring $NPMGROUP group ..."
17+
if [ "$(get_group_id "$NPMGROUP")" = '' ]; then
18+
# Add group. This will not set the id properly if it's already taken
19+
groupadd -f -g "$PGID" "$NPMGROUP"
20+
else
21+
groupmod -o -g "$PGID" "$NPMGROUP"
22+
fi
23+
24+
# Set the group ID and check it
25+
groupmod -o -g "$PGID" "$NPMGROUP"
26+
if [ "$(get_group_id "$NPMGROUP")" != "$PGID" ]; then
27+
echo "ERROR: Unable to set group id properly"
28+
exit 1
29+
fi
30+
31+
# Set the group against the user and check it
32+
usermod -G "$PGID" "$NPMGROUP"
33+
if [ "$(id -g "$NPMUSER")" != "$PGID" ] ; then
34+
echo "ERROR: Unable to set group against the user properly"
35+
exit 1
36+
fi
37+
38+
# Home for user
39+
mkdir -p "$NPMHOME"
40+
chown -R "$PUID:$PGID" "$NPMHOME"

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/30-ownership.sh

+12-12
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ log_info 'Setting ownership ...'
88
# root
99
chown root /tmp/nginx
1010

11-
# npmuser
12-
chown -R "$PUID:$PGID" /data \
13-
/etc/letsencrypt \
14-
/run/nginx \
15-
/tmp/nginx \
16-
/var/cache/nginx \
17-
/var/lib/logrotate \
18-
/var/lib/nginx \
19-
/var/log/nginx
11+
# npm user and group
12+
chown -R "$PUID:$PGID" /data
13+
chown -R "$PUID:$PGID" /etc/letsencrypt
14+
chown -R "$PUID:$PGID" /run/nginx
15+
chown -R "$PUID:$PGID" /tmp/nginx
16+
chown -R "$PUID:$PGID" /var/cache/nginx
17+
chown -R "$PUID:$PGID" /var/lib/logrotate
18+
chown -R "$PUID:$PGID" /var/lib/nginx
19+
chown -R "$PUID:$PGID" /var/log/nginx
2020

2121
# Don't chown entire /etc/nginx folder as this causes crashes on some systems
22-
chown -R "$PUID:$PGID" /etc/nginx/nginx \
23-
/etc/nginx/nginx.conf \
24-
/etc/nginx/conf.d
22+
chown -R "$PUID:$PGID" /etc/nginx/nginx
23+
chown -R "$PUID:$PGID" /etc/nginx/nginx.conf
24+
chown -R "$PUID:$PGID" /etc/nginx/conf.d

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/50-ipv6.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
#!/bin/bash
1+
#!/command/with-contenv bash
2+
# shellcheck shell=bash
23

34
# This command reads the `DISABLE_IPV6` env var and will either enable
45
# or disable ipv6 in all nginx configs based on this setting.
56

7+
set -e
8+
69
log_info 'IPv6 ...'
710

811
# Lowercase
@@ -28,7 +31,7 @@ process_folder () {
2831
sed -E -i "$SED_REGEX" "$FILE"
2932
done
3033

31-
# ensure the files are still owned by the npmuser
34+
# ensure the files are still owned by the npm user
3235
chown -R "$PUID:$PGID" "$1"
3336
}
3437

docker/rootfs/etc/s6-overlay/s6-rc.d/prepare/90-banner.sh

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# shellcheck shell=bash
33

44
set -e
5+
set +x
56

67
echo "
78
-------------------------------------
@@ -11,7 +12,7 @@ echo "
1112
| |\ | __/| | | |
1213
|_| \_|_| |_| |_|
1314
-------------------------------------
14-
User ID: $PUID
15-
Group ID: $PGID
15+
User: $NPMUSER PUID:$PUID ID:$(id -u "$NPMUSER") GROUP:$(id -g "$NPMUSER")
16+
Group: $NPMGROUP PGID:$PGID ID:$(get_group_id "$NPMGROUP")
1617
-------------------------------------
1718
"

docker/scripts/install-s6

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ BLUE='\E[1;34m'
88
GREEN='\E[1;32m'
99
RESET='\E[0m'
1010

11-
S6_OVERLAY_VERSION=3.1.4.1
11+
S6_OVERLAY_VERSION=3.1.5.0
1212
TARGETPLATFORM=${1:unspecified}
1313

1414
# Determine the correct binary file for the architecture given

0 commit comments

Comments
 (0)