django-supervisor connection refused

754 Views Asked by At

I am using supervisor to run celery with a django 1.8.8. setup. also using django-supervisor==0.3.4 supervisor==3.2.0

but when i restart all proecsses, i get

unix:///tmp/supervisor.sock refused connection

not able to restart any processes,

python manage.py supervisor --config-file=setting/staging_supervisor.conf --settings=setting.staging_settings restart all

supervisor config file

[supervisord]
    logfile_maxbytes=10MB                                                       ; maximum size of logfile before rotation
    logfile_backups=3                                                           ; number of backed up logfiles
    loglevel=warn                                                               ; info, debug, warn, trace
    nodaemon=false                                                              ; run supervisord as a daemon
    minfds=1024                                                                 ; number of startup file descriptors
    minprocs=200                                                                ; number of process descriptors
    childlogdir=/logs/                    ; where child log files will live

    [program:celeryd_staging]
    environment=PATH="{{ PROJECT_DIR }}/../../bin"
    command={{ PYTHON }} {{ PROJECT_DIR }}/manage.py celeryd -l info -c 1 --logfile=/logs/staging-celeryd.log --settings=setting.staging_celery_settings
    redirect_stderr=false

    [program:celerybeat_staging]
    environment=PATH="{{ PROJECT_DIR }}/../../bin"
    command=/{{ PYTHON }} {{ PROJECT_DIR }}/manage.py celerybeat --loglevel=INFO --logfile=/logs/staging-celerybeat.log --settings=setting.staging_celery_settings
    redirect_stderr=false

    [group:tasks]
    environment=PATH="{{ PROJECT_DIR}}/../../bin"
    programs=celeryd_staging,celerybeat_staging

    [program:autoreload]
    exclude=true

    [program:runserver]
    exclude=true
2

There are 2 best solutions below

14
On

make sure there isn't already another /tmp/supervisor.sock owned by some user other than you (like root or something).

if not a permissions problem, add this to your supervisord configuration:

[unix_http_server]
file = /tmp/supervisor.sock ;
chmod=0700 ;

[rpcinterface:supervisor]
supervisor.rpcinterface_factory =
supervisor.rpcinterface:make_main_rpcinterface

this might be helpful to you as well: https://github.com/Supervisor/supervisor/issues/480#issuecomment-145193475

0
On

Got the solution. The supervisor process was not reloaded as supervisord was in my virtual enve as i ma using django-supervisor package.

once i reloaded the supervisor process, the refused connection error went away.