Когда я пытаюсь запустить uWSGI, он продолжает цикл, систематически показывая это:
website_1 | *** Starting uWSGI 2.0.18-debian (64bit) on [Wed Jun 3 16:05:07 2020] ***
website_1 | compiled with version: 8.2.0 on 10 February 2019 02:42:46
website_1 | os: Linux-4.19.76-linuxkit #1 SMP Tue May 26 11:42:35 UTC 2020
website_1 | nodename: 9902ea866013
website_1 | machine: x86_64
website_1 | clock source: unix
website_1 | pcre jit disabled
website_1 | detected number of CPU cores: 4
website_1 | current working directory: /usr/website
website_1 | detected binary path: /usr/bin/uwsgi-core
website_1 | uWSGI running as root, you can use --uid/--gid/--chroot options
website_1 | *** WARNING: you are running uWSGI as root !!! (use the --uid flag) ***
website_1 | *** WARNING: you are running uWSGI without its master process manager ***
website_1 | your memory page size is 4096 bytes
website_1 | detected max file descriptor number: 1048576
website_1 | *** starting uWSGI Emperor ***
website_1 | *** has_emperor mode detected (fd: 5) ***
website_1 | [uWSGI] getting INI configuration from /etc/uwsgi/django-uwsgi.ini
То есть эти сообщения просто повторяются. uWSGI просто не запускается, а nginx возвращает 502 Bad Gateway. Мои конфигурации следуют.
website/Dockerfile
FROM python:2.7
COPY src /usr/website
COPY config/start.sh /usr/start.sh
COPY config/django-uwsgi.ini /etc/uwsgi/django-uwsgi.ini
WORKDIR /usr/website
RUN apt-get update
RUN apt-get upgrade -y
RUN apt-get install -y build-essential
RUN apt-get install -y python-dev
RUN apt-get install -y nodejs
RUN apt-get install -y uwsgi
RUN curl https://www.npmjs.com/install.sh | sh
RUN npm install
RUN npm install node-sass
RUN npm audit fix
RUN npm update caniuse-lite browserslist
RUN ./node_modules/.bin/webpack --config webpack.config.js
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
RUN pip install mysqlclient
RUN npm install webpack webpack-cli --save-dev
RUN adduser --no-create-home --disabled-login --group --system django
RUN chown -R django:django /usr/website
RUN chmod 700 /usr/start.sh
CMD [ "/usr/start.sh" ]
website/config/django-uwsgi.ini
#####
# uWSGI configuration
#
# Change settings however you see fit. See following link for more in depth
# explanation of settings:
# - https://uwsgi-docs.readthedocs.io/en/latest/Configuration.html
# - https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/uwsgi/
#####
[uwsgi]
uid = django
gid = django
master = True
lazy-apps = True
# Number of worker processes for handling requests
# %k = cpu count
processes = %(%k * 2)
# Number of threads for handling requests
threads = %(%k * 2)
# Respawn processes that take more than ... seconds
harakiri = 20
# Respawn processes after serving ... requests
max-requests = 5000
# Clear environment on exit
vacuum = True
# the base directory (full path)
chdir = /usr/website
# Django's wsgi file (path starting from chdir/)
# module = $(DJANGO_PROJECT_NAME).wsgi:application
module = website.wsgi:application
# location of settings
env = DJANGO_SETTINGS_MODULE=website.settings
# the socket
http = 0.0.0.0:8000
# touch to reload uwsgi, usage: touch /etc/uwsgi/reload-uwsgi.ini
touch-reload=/etc/uwsgi/reload-uwsgi.ini
website/config/start.sh
#!/bin/bash
set -e
uwsgi --emperor /etc/uwsgi/django-uwsgi.ini
docker-compose.yml
version: '3'
services:
website:
build:
context: website
env_file: website/config/production.env