redis사용 - docker-compose.yml

hyuckhoon.ko·2023년 1월 10일
0

redis 환경키 수정

변경 전

CELERY_BROKER_URL=redis://127.0.0.1:6379
CELERY_RESULT_BACKEND=redis://127.0.0.1:6379

변경 후

CELERY_BROKER_URL=redis://redis:6379
CELERY_RESULT_BACKEND=redis://redis:6379

최종

version: "3.9"

services:
  reverse-proxy:
    build:
      context: ./deploy/nginx/
    container_name: nginx
    depends_on:
      - web
    ports:
      - 80:80
    restart: always

  web:
    image: python-base
    build:
      context: .
    container_name: web
    restart: always
    env_file:
      - 환경키 경로
    ports:
      - 8000:8000
    command: >
      sh -c "gunicorn --workers 5 --bind 0.0.0.0:8000 plab.wsgi:application --timeout 120"

  worker:
    image: python-base
    command: celery -A plab worker --loglevel=info -E
    restart: always
    container_name: worker
    env_file:
      - 환경키 경로
    depends_on:
      - web

  beat:
    image: python-base
    command: celery -A plab beat -l info --pidfile= --scheduler django_celery_beat.schedulers:DatabaseScheduler
    restart: always
    container_name: beat
    env_file:
      - 환경키 경로
    depends_on:
      - worker

  redis:
    image: redis:alpine
    restart: always

0개의 댓글