mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
Different approach, always create npmuser
even if the user id is zero, and then we'll always use it
This commit is contained in:
parent
dad8561ea1
commit
4a86bb42cc
@ -1,6 +1,7 @@
|
|||||||
# run nginx in foreground
|
# run nginx in foreground
|
||||||
daemon off;
|
daemon off;
|
||||||
pid /run/nginx/nginx.pid;
|
pid /run/nginx/nginx.pid;
|
||||||
|
user npmuser;
|
||||||
|
|
||||||
# Set number of worker processes automatically based on number of CPU cores.
|
# Set number of worker processes automatically based on number of CPU cores.
|
||||||
worker_processes auto;
|
worker_processes auto;
|
||||||
|
@ -7,26 +7,15 @@ set -e
|
|||||||
|
|
||||||
cd /app || exit 1
|
cd /app || exit 1
|
||||||
|
|
||||||
if [ "${DEVELOPMENT:-}" = "true" ]; then
|
log_info 'Starting backend ...'
|
||||||
if [ "$PUID" = '0' ]; then
|
|
||||||
log_info 'Starting backend development ...'
|
if [ "${DEVELOPMENT:-}" = 'true' ]; then
|
||||||
yarn install
|
s6-setuidgid npmuser yarn install
|
||||||
node --max_old_space_size=250 --abort_on_uncaught_exception node_modules/nodemon/bin/nodemon.js
|
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'
|
||||||
else
|
|
||||||
log_info "Starting backend development as npmuser ($PUID) ..."
|
|
||||||
s6-setuidgid npmuser yarn install
|
|
||||||
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'
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
while :
|
while :
|
||||||
do
|
do
|
||||||
if [ "$PUID" = '0' ]; then
|
s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --abort_on_uncaught_exception --max_old_space_size=250 index.js'
|
||||||
log_info 'Starting backend ...'
|
|
||||||
node --abort_on_uncaught_exception --max_old_space_size=250 index.js
|
|
||||||
else
|
|
||||||
log_info "Starting backend as npmuser ($PUID) ..."
|
|
||||||
s6-setuidgid npmuser bash -c 'export HOME=/tmp/npmuserhome;node --abort_on_uncaught_exception --max_old_space_size=250 index.js'
|
|
||||||
fi
|
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
@ -5,7 +5,7 @@ set -e
|
|||||||
|
|
||||||
# This service is DEVELOPMENT only.
|
# This service is DEVELOPMENT only.
|
||||||
|
|
||||||
if [ "$DEVELOPMENT" == "true" ]; then
|
if [ "$DEVELOPMENT" = 'true' ]; then
|
||||||
. /bin/common.sh
|
. /bin/common.sh
|
||||||
cd /app/frontend || exit 1
|
cd /app/frontend || exit 1
|
||||||
HOME=/tmp/npmuserhome
|
HOME=/tmp/npmuserhome
|
||||||
@ -13,15 +13,9 @@ if [ "$DEVELOPMENT" == "true" ]; then
|
|||||||
mkdir -p /app/frontend/dist
|
mkdir -p /app/frontend/dist
|
||||||
chown -R "$PUID:$PGID" /app/frontend/dist
|
chown -R "$PUID:$PGID" /app/frontend/dist
|
||||||
|
|
||||||
if [ "$PUID" = '0' ]; then
|
log_info 'Starting frontend ...'
|
||||||
log_info 'Starting frontend ...'
|
s6-setuidgid npmuser yarn install
|
||||||
yarn install
|
exec s6-setuidgid npmuser yarn watch
|
||||||
exec yarn watch
|
|
||||||
else
|
|
||||||
log_info "Starting frontend as npmuser ($PUID) ..."
|
|
||||||
s6-setuidgid npmuser yarn install
|
|
||||||
exec s6-setuidgid npmuser yarn watch
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
@ -5,10 +5,5 @@ set -e
|
|||||||
|
|
||||||
. /bin/common.sh
|
. /bin/common.sh
|
||||||
|
|
||||||
if [ "$PUID" = '0' ]; then
|
log_info 'Starting nginx ...'
|
||||||
log_info 'Starting nginx ...'
|
exec s6-setuidgid npmuser nginx
|
||||||
exec nginx
|
|
||||||
else
|
|
||||||
log_info "Starting nginx as npmuser ($PUID) ..."
|
|
||||||
exec s6-setuidgid npmuser nginx
|
|
||||||
fi
|
|
||||||
|
@ -3,23 +3,18 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [ "$PUID" = '0' ]; then
|
log_info 'Configuring npmuser ...'
|
||||||
log_info 'Skipping npmuser configuration'
|
|
||||||
|
if id -u npmuser; then
|
||||||
|
# user already exists
|
||||||
|
usermod -u "$PUID" npmuser || exit 1
|
||||||
else
|
else
|
||||||
log_info 'Configuring npmuser ...'
|
# Add npmuser user
|
||||||
groupmod -g 1000 users || exit 1
|
useradd -o -u "$PUID" -U -d /tmp/npmuserhome -s /bin/false npmuser || exit 1
|
||||||
|
|
||||||
if id -u npmuser; then
|
|
||||||
# user already exists
|
|
||||||
usermod -u "$PUID" npmuser || exit 1
|
|
||||||
else
|
|
||||||
# Add npmuser user
|
|
||||||
useradd -u "$PUID" -U -d /tmp/npmuserhome -s /bin/false npmuser || exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
usermod -G users npmuser || exit 1
|
|
||||||
groupmod -o -g "$PGID" npmuser || exit 1
|
|
||||||
# Home for npmuser
|
|
||||||
mkdir -p /tmp/npmuserhome
|
|
||||||
chown -R "$PUID:$PGID" /tmp/npmuserhome
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
usermod -G "$PGID" npmuser || exit 1
|
||||||
|
groupmod -o -g "$PGID" npmuser || exit 1
|
||||||
|
# Home for npmuser
|
||||||
|
mkdir -p /tmp/npmuserhome
|
||||||
|
chown -R "$PUID:$PGID" /tmp/npmuserhome
|
||||||
|
@ -3,17 +3,15 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
echo
|
echo "
|
||||||
echo "-------------------------------------
|
-------------------------------------
|
||||||
_ _ ____ __ __
|
_ _ ____ __ __
|
||||||
| \ | | _ \| \/ |
|
| \ | | _ \| \/ |
|
||||||
| \| | |_) | |\/| |
|
| \| | |_) | |\/| |
|
||||||
| |\ | __/| | | |
|
| |\ | __/| | | |
|
||||||
|_| \_|_| |_| |_|
|
|_| \_|_| |_| |_|
|
||||||
-------------------------------------"
|
-------------------------------------
|
||||||
if [[ "$PUID" -ne '0' ]]; then
|
User ID: $PUID
|
||||||
echo "User UID: $(id -u npmuser)"
|
Group ID: $PGID
|
||||||
echo "User GID: $(id -g npmuser)"
|
-------------------------------------
|
||||||
echo "-------------------------------------"
|
"
|
||||||
fi
|
|
||||||
echo
|
|
||||||
|
Loading…
Reference in New Issue
Block a user