Azure容器中Supervisord管理Celery任务时镜像重启故障排查求助
Azure容器中Supervisord管理Celery任务时镜像重启故障排查求助
各位大佬求助!我想在Azure的一个容器里运行4个Celery任务,但我的镜像总是重启。我用supervisord来在单个容器里管理多个worker,Dockerfile里也配置了相关内容,但通过Github Actions构建的镜像部署到Azure容器后总是出问题,有没有人能帮我看看哪里不对?
我的Dockerfile配置:
FROM python:3.11-slim # Install system dependencies RUN apt-get update && \ apt-get install -y --no-install-recommends \ supervisor \ build-essential \ && rm -rf /var/lib/apt/lists/* # Create non-root user RUN useradd -m -u 1001 appuser # Set working directory WORKDIR /app # Copy requirements first for caching COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy application files COPY . . # Configure supervisord COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf RUN chown appuser:appuser /etc/supervisor/conf.d/supervisord.conf # Set permissions RUN chown -R appuser:appuser /app USER appuser # Application port EXPOSE 80 # Start command CMD ["/usr/bin/supervisord", "-n", "-c", "/etc/supervisor/conf.d/supervisord.conf"]
我的supervisord.conf配置:
[supervisord] nodaemon=true logfile=/var/log/supervisord.log logfile_maxbytes=50MB loglevel=info [program:web] command=gunicorn main:app --workers 2 --worker-class uvicorn.workers.UvicornWorker --bind 0.0.0.0:80 autostart=true autorestart=unexpected startretries=3 user=appuser stdout_logfile=/dev/stdout stderr_logfile=/dev/stderr [program:users_worker] command=celery -A app.tasks worker -Q users_tasks -n users_worker@%%h --loglevel=info --without-heartbeat --prefetch-multiplier=1 autostart=true autorestart=true user=appuser stdout_logfile=/dev/stdout stderr_logfile=/dev/stderr [program:feed_worker] command=celery -A app.tasks worker -Q feed_tasks -n feed_worker@%%h --loglevel=info --without-heartbeat --prefetch-multiplier=1 autostart=true autorestart=true user=appuser stdout_logfile=/dev/stdout stderr_logfile=/dev/stderr [program:providers_worker] command=celery -A app.tasks worker -Q service_providers_tasks -n providers_worker@%%h --loglevel=info --without-heartbeat --prefetch-multiplier=1 autostart=true autorestart=true user=appuser stdout_logfile=/dev/stdout stderr_logfile=/dev/stderr [program:celery_beat] command=celery -A app.tasks beat --loglevel=info --scheduler redbeat.RedBeatScheduler autostart=true autorestart=true user=appuser stdout_logfile=/dev/stdout stderr_logfile=/dev/stderr
备注:内容来源于stack exchange,提问作者Sean STC Churu
相关产品推荐
相关产品推荐

