the proper way to run django rq in docker microser

2019-08-08 14:35发布

I have somehow bad setup of my docker containers I guess. Because each time I run task from django I see in docker container output of ps aux that there is new process created of python mange.py rqworker mail instead of using the existing one. See the screencast: https://imgur.com/a/HxUjzJ5

the process executed from command in my docker compose for rq worker container looks like this.

#!/bin/sh -e

wait-for-it

for KEY in $(redis-cli -h $REDIS_HOST -n 2 KEYS "rq:worker*"); do
    redis-cli -h $REDIS_HOST -n 2  DEL $KEY
done

if [ "$ENVIRONMENT" = "development" ]; then
    python manage.py rqworkers --worker-class rq.SimpleWorker --autoreload;
else
    python manage.py rqworkers --worker-class rq.SimpleWorker --workers 4;
fi

I am new to docker and wondering a bit that this is started like this without deamonization... but is it a dockerish way of doing thing, right?

0条回答
登录 后发表回答