분당 업데이트 작업이 있습니다.Docker Compose에서`celeryd`와`celerybeat`을 어떻게 설정합니까?
이것은 장고 응용 프로그램의 Dockerfile입니다.
FROM python:3-onbuild
COPY .//
EXPOSE 8000
RUN pip3 install -r requirements.txt
RUN python3 manage.py collectstatic --noinput
ENTRYPOINT ["python3", "manage.py", "celeryd"]
ENTRYPOINT ["python3", "manage.py", "celerybeat"]
ENTRYPOINT ["/app/start.sh"]
이것은 내 도커 - compose.yml입니다.
version: "3"
services:
nginx:
image: nginx:latest
container_name: nginx_airport
ports:
- "8080:8080"
volumes:
- ./:/app
- ./nginx:/etc/nginx/conf.d
- ./static:/app/static
depends_on:
- web
rabbit:
hostname: rabbit_airport
image: rabbitmq:latest
environment:
- RABBITMQ_DEFAULT_USER=admin
- RABBITMQ_DEFAULT_PASS=asdasdasd
ports:
- "5673:5672"
web:
build: ./
container_name: django_airport
volumes:
- ./:/app
- ./static:/app/static
expose:
- "8080"
links:
- rabbit
depends_on:
- rabbit
이것은 현재 실행중인 컨테이너의 맨 앞에있는 로그입니다.
rabbit_1 | =INFO REPORT==== 29-Sep-2017::11:45:30 ===
rabbit_1 | Starting RabbitMQ 3.6.12 on Erlang 19.2.1
rabbit_1 | Copyright (C) 2007-2017 Pivotal Software, Inc.
rabbit_1 | Licensed under the MPL. See http://www.rabbitmq.com/
rabbit_1 |
rabbit_1 | RabbitMQ 3.6.12. Copyright (C) 2007-2017 Pivotal Software, Inc.
rabbit_1 | ## ## Licensed under the MPL. See http://www.rabbitmq.com/
rabbit_1 | ## ##
rabbit_1 | ########## Logs: tty
rabbit_1 | ###### ## tty
rabbit_1 | ##########
rabbit_1 | Starting broker...
rabbit_1 |
rabbit_1 | =INFO REPORT==== 29-Sep-2017::11:45:30 ===
rabbit_1 | node : [email protected]_airport
rabbit_1 | home dir : /var/lib/rabbitmq
rabbit_1 | config file(s) : /etc/rabbitmq/rabbitmq.config
rabbit_1 | cookie hash : grcK4ii6UVUYiLRYxWUffw==
rabbit_1 | log : tty
rabbit_1 | sasl log : tty
rabbit_1 | database dir : /var/lib/rabbitmq/mnesia/[email protected]_airport
rabbit_1 |
rabbit_1 | =INFO REPORT==== 29-Sep-2017::11:45:31 ===
rabbit_1 | Memory high watermark set to 3145 MiB (3298503884 bytes) of 7864 MiB (8246259712 bytes) total
rabbit_1 |
rabbit_1 | =INFO REPORT==== 29-Sep-2017::11:45:31 ===
rabbit_1 | Enabling free disk space monitoring
rabbit_1 |
rabbit_1 | =INFO REPORT==== 29-Sep-2017::11:45:31 ===
rabbit_1 | Disk free limit set to 50MB
rabbit_1 |
rabbit_1 | =INFO REPORT==== 29-Sep-2017::11:45:31 ===
rabbit_1 | Limiting to approx 1048476 file handles (943626 sockets)
셀러리 작업이 실행되고 있지 않은 것을 제외하면 모두 괜찮습니다.
편집 :
#!/bin/bash
# PENDING: From the source here,
# http://tutos.readthedocs.io/en/latest/source/ndg.html it says that it is a
# common practice to have a specific user to handle the webserver.
SCRIPT=$(readlink -f "$0")
DJANGO_SETTINGS_MODULE=airport.settings
DJANGO_WSGI_MODULE=airport.wsgi
NAME="airport"
NUM_WORKERS=3
if [ "$BASEDIR" = "/" ]
then
BASEDIR=""
else
BASEDIR=$(dirname "$SCRIPT")
fi
if [ "$BASEDIR" = "/" ]
then
VENV_BIN="venv/bin"
SOCKFILE="run/gunicorn.sock"
else
VENV_BIN=${BASEDIR}"/venv/bin"
SOCKFILE=${BASEDIR}"/run/gunicorn.sock"
fi
SOCKFILEDIR="$(dirname "$SOCKFILE")"
VENV_ACTIVATE=${VENV_BIN}"/activate"
VENV_GUNICORN=${VENV_BIN}"/gunicorn"
# Activate the virtual environment.
# Only set this for virtual environment.
#cd $BASEDIR
#source $VENV_ACTIVATE
# Set environment variables.
export DJANGO_SETTINGS_MODULE=$DJANGO_SETTINGS_MODULE
export PYTHONPATH=$PYTHONPATH:$BASEDIR
# Create run directory if they does not exists.
#test -d $SOCKFILEDIR || mkdir -p $SOCKFILEDIR
# Start Gunicorn!
# Programs meant to be run under supervisor should not daemonize themselves
# (do not use --daemon).
#
# Set this for virtual environment.
#exec ${VENV_GUNICORN} ${DJANGO_WSGI_MODULE}:application \
# --bind=unix:$SOCKFILE \
# --name $NAME \
# --workers $NUM_WORKERS
# For non-virtual environment.
exec gunicorn ${DJANGO_WSGI_MODULE}:application \
--bind=unix:$SOCKFILE \
--name $NAME \
--workers $NUM_WORKERS
DetailsDetailsDetailsDetailsDetails DetailsDetailsDetailsDetailsDetails DetailsDetailsDetailsDetailsDetails DetailsDetailsDetailsDetailsDetails DetailsDetailsDetailsDetailsDetails DetailsDetailsDetailsDetailsDetails
은 /app/start.sh에 무엇입니까? – Sergiu
내 게시물을 편집했습니다. – notalentgeek