kopia lustrzana https://github.com/jedie/PyInventory
Run gunicorn as "django" user and not as root
rodzic
38899ff08b
commit
c1a70043fa
|
@ -14,6 +14,9 @@ RUN apt-get update \
|
|||
&& python3 -m pip install -U pip \
|
||||
&& pip install -U psycopg2-binary
|
||||
|
||||
RUN addgroup --system django \
|
||||
&& adduser --system --no-create-home --disabled-password --ingroup django --shell /bin/bash django
|
||||
|
||||
WORKDIR /django
|
||||
|
||||
RUN pip install "pyinventory>=0.6.0"
|
||||
|
|
|
@ -29,20 +29,23 @@ else
|
|||
pip3 install -U "${PYTHON_PACKAGE_NAME}"
|
||||
)
|
||||
fi
|
||||
|
||||
GUNICORN_CMD_ARGS=<<'EOF'
|
||||
--config /django/gunicorn.conf.py
|
||||
--bind "$(hostname):8000"
|
||||
--pid="/tmp/gunicorn.pid"
|
||||
--access-logfile="-"
|
||||
--error-logfile="-"
|
||||
--log-level=info
|
||||
EOF
|
||||
|
||||
(
|
||||
set -x
|
||||
|
||||
./manage.py collectstatic --noinput
|
||||
./manage.py migrate
|
||||
|
||||
/usr/local/bin/gunicorn \
|
||||
--config /django/gunicorn.conf.py \
|
||||
--bind "$(hostname):8000" \
|
||||
--pid="/tmp/gunicorn.pid" \
|
||||
--access-logfile="-" \
|
||||
--error-logfile="-" \
|
||||
--log-level=info \
|
||||
wsgi
|
||||
su django -c "/usr/local/bin/gunicorn wsgi"
|
||||
|
||||
echo "gunicorn terminated with exit code: $?"
|
||||
sleep 3
|
||||
|
|
|
@ -2,5 +2,3 @@ import multiprocessing
|
|||
|
||||
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
access_logfile = '-' # log to stdout
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue