Docker에서 uWSGI로 장고 응용 프로그램을 제공하려고합니다. Dockerfile이 끝날 때 supervisord를 사용하여 프로세스를 시작합니다. 이미지를 실행하면 uWSGI 프로세스가 시작되고 성공하지만, 표시 할 것으로 생각되는 URL에서 응용 프로그램을 볼 수 없습니다. 아마도 내가 올바르게 설정/구성하지 않았습니까?uWSGI에서 제공하는 응용 프로그램 (Docker의 Supervisord 포함)
현재 Amazon S3를 통해 정적 파일을 제공하고 있으므로 먼저 wsgi를 실행하고 실행하는 데 집중하고 싶기 때문에 지금은 감독자가 nginx를 시작하지 않습니다.
로컬로 uwsgi --init uwsgi.ini:local
을 실행하여 uwsgi를 사용하여 응용 프로그램을 성공적으로 실행했지만 문제가 발생했습니다.
은 여기 내 Dockerfile
FROM ubuntu:14.04
# Get most recent apt-get
RUN apt-get -y update
# Install python and other tools
RUN apt-get install -y tar git curl nano wget dialog net-tools build-essential
RUN apt-get install -y python3 python3-dev python-distribute
RUN apt-get install -y nginx supervisor
# Get Python3 version of pip
RUN apt-get -y install python3-setuptools
RUN easy_install3 pip
RUN pip install uwsgi
RUN apt-get install -y python-software-properties
# Install GEOS
RUN apt-get -y install binutils libproj-dev gdal-bin
# Install node.js
RUN apt-get install -y nodejs npm
# Install postgresql dependencies
RUN apt-get update && \
apt-get install -y postgresql libpq-dev && \
rm -rf /var/lib/apt/lists
ADD . /home/docker/code
# Setup config files
RUN echo "daemon off;" >> /etc/nginx/nginx.conf
RUN rm /etc/nginx/sites-enabled/default
RUN ln -s /home/docker/code/nginx-app.conf /etc/nginx/sites-enabled/
RUN ln -s /home/docker/code/supervisor-app.conf /etc/supervisor/conf.d/
RUN pip install -r /home/docker/code/app/requirements.txt
EXPOSE 8080
CMD ["supervisord", "-c", "/home/docker/code/supervisor-app.conf", "-n"]
입니다 그리고 여기 내 uwsgi.ini
[uwsgi]
# this config will be loaded if nothing specific is specified
# load base config from below
ini = :base
# %d is the dir this configuration file is in
socket = %dmy_app.sock
master = true
processes = 4
[dev]
ini = :base
# socket (uwsgi) is not the same as http, nor http-socket
socket = :8001
[local]
ini = :base
http = :8000
# set the virtual env to use
home=/Users/my_user/.virtualenvs/my_env
[base]
# chdir to the folder of this config file, plus app/website
chdir = %dmy_app/
# load the module from wsgi.py, it is a python path from
# the directory above.
module=my_app.wsgi:application
# allow anyone to connect to the socket. This is very permissive
chmod-socket=666
http = :8080
그리고 여기는 사용하여 MAC에서 내 수퍼바이저 app.conf 파일
[program:app-uwsgi]
command = /usr/local/bin/uwsgi --ini /home/docker/code/uwsgi.ini
입니다 boot2docker, $ (boot2docker ip)에서 응용 프로그램에 액세스하려고합니다 : 8080
궁극적으로 AWS Elastic Beanstalk에이 컨테이너를 업로드하려고합니다. uWSGI 프로세스가 실행 중이지만 셀러리 작업자도 실행 중입니다.
컨테이너를 실행할 때 관리자와 uwsgi가 모두 성공적으로 시작한다는 것을 로그에서 볼 수 있습니다. 내 로컬 컴퓨터에서 uwsgi를 사용하고 상사를 통해 uwsgi를 사용하여 물건을 작동시킬 수 있었지만, 내가 어디에서나 찾을 수없는 것을 컨테이너로 만들 때 어떤 이유로. 내가 어떻게 당신이 고정 표시기 컨테이너를 시작하는 고정 표시기 컨테이너
2014-12-25 15:08:03,950 CRIT Supervisor running as root (no user in config file)
2014-12-25 15:08:03,953 INFO supervisord started with pid 1
2014-12-25 15:08:04,957 INFO spawned: 'uwsgi' with pid 9
2014-12-25 15:08:05,970 INFO success: uwsgi entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
글쎄 나는 슈퍼 바이어가 컨테이너에서 셀러리 프로세스를 실행하는 데 필요할 것이라고 생각했다. 궁극적으로 AWS Elastic Beanstalk에이 컨테이너를 업로드 할 계획이므로 EB는 하나의 컨테이너에서 모든 프로세스를 실행해야합니다. EB는 컨테이너를 연결할 수있는 방법이 없습니다 (아는 한). 또한, 나는이 컨테이너에서 Postgres 서버 나 Node 애플리케이션을 실행하지 않고있다. 그들은 내 django 애플리케이션의 의존성 일 뿐이다. – rfj001
확인.supervisord를 실행하는 데있어 좋은 문서가 있습니다. http://docs.docker.com/articles/using_supervisord/. CMD 또는 도커 실행에서 관리자를 명시 적으로 시작해야한다는 것을 기억하십시오. –
Dockerfile 맨 아래에 CMD가 있으며 프로세스가 시작되었음을 알 수 있습니다. 내 원본 게시물 하단에 로그를 추가했습니다. 그러나 여전히 웹 브라우저에서 응용 프로그램에 액세스 할 수 없습니다. – rfj001