Сельдерей в контейнере docker сначала работает некоторое время, а затем начинает отключаться по тайм-ауту
Развертывание проекта, все работает. Через неопределенное время celery перестает отвечать. Получаю ошибку gunicorn: sys.exit(1)
Пробовал запустить task.deploy() внутри контейнера django и ничего не происходит в контейнере celery. В логах нет ошибок ни в контейнере django, ни в контейнере celery.
- django
- celery
- celerybeat
Контейнеры докера:
django settings celery settings:
CELERY_BROKER_URL = REDIS_URL
CELERY_RESULT_BACKEND = 'db+sqlite:///results.sqlite'
CELERY_ACCEPT_CONTENT = ['json']
CELERY_TASK_SERIALIZER = 'json'
CELERY_RESULT_SERIALIZER = 'json'
celery.py в проекте django:
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'YoungAI.settings')
app = celery.Celery('YoungAI')
# Using a string here means the worker don't have to serialize
# the configuration object to child processes.
# - namespace='CELERY' means all celery-related configuration keys
# should have a `CELERY_` prefix.
app.config_from_object('django.conf:settings', namespace='CELERY')
# Load task modules from all registered Django app configs.
app.autodiscover_tasks()
docker-compose.yml:
version: '3'
services:
redis:
container_name: redis
image: redis:4.0.2
restart: always
networks:
- youngai
youngai-nginx:
container_name: youngai-nginx
image: youngai-nginx
build: conf/nginx/
restart: always
networks:
- youngai
- third_party_backend
youngai-backend:
container_name: youngai-backend
image: $CONTAINER_BUILD_IMAGE
restart: always
env_file:
/opt/.env-youngai
build: .
command: ./docker-entrypoint.sh
volumes:
networks:
- youngai
- third_party_backend
youngai-celery:
container_name: youngai-celery
image: $CONTAINER_BUILD_IMAGE
restart: always
env_file:
/opt/.env-youngai
build: .
command: celery --app=YoungAI worker --purge --loglevel=info
networks:
- youngai
- third_party_backend
depends_on:
- redis
youngai-celerybeat:
container_name: youngai-celerybeat
image: $CONTAINER_BUILD_IMAGE
restart: always
env_file:
/opt/.env-youngai
build: .
command: celery -A YoungAI beat
networks:
- youngai
- third_party_backend
depends_on:
- redis
youngai-nginx-clinic:
container_name: youngai-nginx-clinic
image: youngai-nginx-clinic
build: conf/nginx_clinic/
restart: always
env_file:
/opt/.env-clinic
networks:
- youngai
- third_party_backend
youngai-nginx-coach:
container_name: youngai-nginx-coach
image: youngai-nginx-coach
build: conf/nginx_coach/
restart: always
env_file:
/opt/.env-coach
networks:
- youngai
- third_party_backend
youngai-nginx-generali:
container_name: youngai-nginx-generali
image: youngai-nginx-generali
build: conf/nginx_generali/
restart: always
env_file:
/opt/.env-generali
networks:
- youngai
- third_party_backend
youngai-nodejs:
container_name: youngai-nodejs
image: youngai-nodejs
restart: always
env_file:
/opt/.env-clinic
build: conf/nodejs-server
command: npm run start
networks:
- youngai
- third_party_backend
networks:
youngai:
third_party_backend:
external: true
requirements.txt:
Django==3.2.10
djangorestframework==3.13.1
django-rest-auth==0.9.5
djangorestframework-jwt==1.11.0
django-allauth==0.47.0
django-modeltranslation==0.17.3
django-multiselectfield==0.1.12
django-ordered-model==3.4.3
django-render-block==0.8.1
markdown==3.3.6
django-filter==21.1
django-countries==7.2.1
Pillow==8.4.0
django-cors-headers==3.10.1
celery==5.2.3
django_celery_results==2.2.0
redis==4.0.2
sentry-sdk==1.5.1
fabric==2.6.0
gunicorn==20.1.0
django-templated-email==3.0.0
requests==2.26.0
fitbit==0.3.1
django-storages==1.12.3
mock==4.0.3
django-import-export==2.7.1
python-dateutil==2.8.2
future==0.18.2
oauthlib==3.1.1
django-prometheus==2.2.0
celery-prometheus-exporter==1.7.0
locust==2.5.1
model_bakery==1.3.3
moviepy==1.0.3
fcm-django==1.0.6
drf_writable_nested==0.6.3
drf-serializer-cache==0.3.4
django_redis==5.2.0
drf-spectacular==0.21.1
django-health-check==3.16.5
pytest-django==4.4.0
jsonschema==4.3.2
pandas==1.0.4
scipy==1.4.1
scikit-learn==0.22.2.post1
boto3==1.14.56
sqlalchemy==1.4.19
psycopg2-binary==2.8.6
numpy==1.18.2
python-logstash==0.4.6