Celery 데몬화

Reading time ~1 minute

Celery 데몬으로 관리하기

Celery 설정파일 작성하기

# vi /srv/celery/celery.conf

CELERYD_NODES="worker1"

CELERY_BIN="/home/ubuntu/.pyenv/versions/<pyenv_name>/bin/celery"

CELERY_APP="config"

CELERYD_MULTI="multi"

CELERYD_OPTS="--time-limit=300 --concurrency=2"

CELERYD_PID_FILE="/srv/celery/celery-%n.pid"
CELERYD_LOG_FILE="/srv/celery/celery-%n%I.log"
CELERYD_LOG_LEVEL="INFO"

service로 만들기

# vi /etc/systemd/system/celery.service

[Unit]
Description=Celery Service
After=network.target

[Service]
Type=forking

EnvironmentFile=/srv/celery/celery.conf

WorkingDirectory=/home/ubuntu/<project_directory>

ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} \
  -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} \
  --pidfile=${CELERYD_PID_FILE}'
ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} \
  -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} \
  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
StandardError=syslog

[Install]
WantedBy=multi-user.target

EC2 배포 설정

local 설정$ sudo vi /etc/default/localevi 명령을 통해 접근 후 아래 처럼 적습니다.LC_CTYPE="en_US.UTF-8"LC_ALL="en_US.UTF-8"LANG="en_US.UTF-8"기본 설정$ sudo ap...… Continue reading

EC2 배포 설정

Published on April 11, 2019