Skip to content

Commit

Permalink
chore: celery worker 및 flower 컨테이너 통합
Browse files Browse the repository at this point in the history
  • Loading branch information
GiHwan2 committed Jul 27, 2024
1 parent 16459e3 commit 0f5f3f0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 60 deletions.
2 changes: 1 addition & 1 deletion MVStudio-Backend
40 changes: 12 additions & 28 deletions docker-compose-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,25 @@ services:
networks:
- mvs

celery-worker-1:
celery:
build:
context: ./MVStudio-Backend
command: celery -A config worker --loglevel=info --concurrency=6 -Q celery,music_queue,video_queue,final_queue
depends_on:
- rabbitmq
- redis
networks:
- mvs

celery-worker-2:
build:
context: ./MVStudio-Backend
command: celery -A config worker --loglevel=info --concurrency=6 -Q celery,music_queue,video_queue,final_queue
ports:
- '5555:5555'
depends_on:
- rabbitmq
- redis
networks:
- mvs
command: >
sh -c "
celery -A config worker --loglevel=info --concurrency=2 -n worker_1_@%h &
celery -A config worker --loglevel=info --concurrency=2 -Q music_queue -n worker_2_@%h &
celery -A config worker --loglevel=info --concurrency=10 -Q video_queue -n worker_3_@%h &
celery -A config worker --loglevel=info --concurrency=2 -Q final_queue -n worker_4_@%h &
celery -A config flower --port=5555 --broker=$CELERY_BROKER_URL --broker-api=http://guest:guest@rabbitmq:15672/api/"
environment:
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672/

celery-beat:
build:
Expand All @@ -54,22 +54,6 @@ services:
networks:
- mvs

flower:
image: mher/flower:0.9.7
build:
context: ./MVStudio-Backend
working_dir: /MVStudio-Backend
command: celery flower --port=5555 --broker=$CELERY_BROKER_URL --broker-api=http://guest:guest@rabbitmq:15672/api/
ports:
- '5555:5555'
depends_on:
rabbitmq:
condition: service_healthy
environment:
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672/
networks:
- mvs

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1
environment:
Expand Down
40 changes: 12 additions & 28 deletions docker-compose-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ services:
networks:
- mvs

celery-worker-1:
celery:
build:
context: ./MVStudio-Backend
command: celery -A config worker --loglevel=info --concurrency=2 -Q celery,music_queue,video_queue,final_queue
depends_on:
- rabbitmq
- redis
networks:
- mvs

celery-worker-2:
build:
context: ./MVStudio-Backend
command: celery -A config worker --loglevel=info --concurrency=2 -Q celery,music_queue,video_queue,final_queue
ports:
- '5555:5555'
depends_on:
- rabbitmq
- redis
networks:
- mvs
command: >
sh -c "
celery -A config worker --loglevel=info --concurrency=2 -n worker_1_@%h &
celery -A config worker --loglevel=info --concurrency=2 -Q music_queue -n worker_2_@%h &
celery -A config worker --loglevel=info --concurrency=10 -Q video_queue -n worker_3_@%h &
celery -A config worker --loglevel=info --concurrency=2 -Q final_queue -n worker_4_@%h &
celery -A config flower --port=5555 --broker=$CELERY_BROKER_URL --broker-api=http://guest:guest@rabbitmq:15672/api/"
environment:
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672/

celery-beat:
build:
Expand All @@ -70,22 +70,6 @@ services:
networks:
- mvs

flower:
image: mher/flower:0.9.7
build:
context: ./MVStudio-Backend
working_dir: /MVStudio-Backend
command: celery flower --port=5555 --broker=$CELERY_BROKER_URL --broker-api=http://guest:guest@rabbitmq:15672/api/
ports:
- '5555:5555'
depends_on:
rabbitmq:
condition: service_healthy
environment:
- CELERY_BROKER_URL=amqp://guest:guest@rabbitmq:5672/
networks:
- mvs

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.10.1
environment:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ services:
networks:
- mvs

celery-worker:
celery:
build:
context: ./MVStudio-Backend
ports:
Expand All @@ -53,7 +53,7 @@ services:
- mvs
command: >
sh -c "
celery -A config worker --loglevel=info --concurrency=2 -Q celery -n worker_1_@%h &
celery -A config worker --loglevel=info --concurrency=2 -n worker_1_@%h &
celery -A config worker --loglevel=info --concurrency=2 -Q music_queue -n worker_2_@%h &
celery -A config worker --loglevel=info --concurrency=10 -Q video_queue -n worker_3_@%h &
celery -A config worker --loglevel=info --concurrency=2 -Q final_queue -n worker_4_@%h &
Expand Down
2 changes: 1 addition & 1 deletion prometheus/prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ scrape_configs:
- targets: [ 'nginx-exporter:9113' ] #<서비스_이름>:<포트>
- job_name: 'celery-data' #job 이름
static_configs:
- targets: [ 'celery-worker:5555' ] #<서비스_이름>:<포트>
- targets: [ 'celery:5555' ] #<서비스_이름>:<포트>
- job_name: 'rabbitmq-data' #job 이름
static_configs:
- targets: [ 'rabbitmq:15692' ] #<서비스_이름>:<포트>
Expand Down

0 comments on commit 0f5f3f0

Please sign in to comment.