I installed Supervisor on a shared Debian server. When I run:
supervisord -c supervisord.conf
I get this error continuously untill I kill it:Unlinking stale socket /tmp/supervisor.sock
When I run supervisorctl status I get:
unix:///tmp/supervisor.sock no such file
My supervisord.conf file like this (I didn`t change anything):
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; socket file mode (default 0700)
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
pidfile=/tmp/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
nodaemon=false ; (start in foreground if true;default false)
minfds=1024 ; (min. avail startup file descriptors;default 1024)
minprocs=200 ; (min. avail process descriptors;default 200)
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///tmp/supervisor.sock ; use a unix:// URL for a unix socket
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/app/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
;user=
numprocs=8
redirect_stderr=true
stdout_logfile= /path/to/app/worker.log
When I cd to /tmp to look for the socket file, the socket looks like this:
supervisor.sock.824804. The six-digit number gets somehow generated randomly by the server after I run the supervisord -c supervisord.confcommand. Do I have to consider this six-digit in the supervisord.config file? And how to I do this, since it gets generated randomly? I have already installed and run Supervisor on a macOS Mojave too and there were no problemes and the socket file just locked like supervisor.sock. Thank for any help and suggestion in advance!
I set nodaemon = true in supervisord.conf and that fixed my problem.
unlink /tmp/supervisor.sock
then I fixed it "Unlinking stale socket /tmp/supervisord.sock".
Related
I have a supervisor conf file that need a lot of environment variables::
$ cat /etc/supervisor/conf.d/aaa_staging.conf
[program:aaa_staging]
environment=
API_HOST="https://aaa-api-staging.zettauser.com/api/",
CLOUD_INSTANCE_NAME=media-server-xx-xx-xx-xx,
CLOUD_APPLICATION=media-server,
CLOUD_APP_COMPONENT=none,
CLOUD_ZONE=a,
CLOUD_REGION=b,
CLOUD_PRIVATE_IP=none,
CLOUD_PUBLIC_IP=xx.xx.xx.xx,
CLOUD_PUBLIC_IPV6=xx.xx.xx.xx.xx.xx,
CLOUD_PROVIDER=c
command=/opt/aaa-staging/bin/gunicorn 'aaa.app:app' --workers 4 --bind 0.0.0.0:5046 --timeout 1200
user=user
autostart=true
autorestart=true
redirect_stderr=true
directory=/opt/aaa-staging/lib64/python3.7/site-packages/aaa/
stdout_logfile=/var/log/aaa-staging_app
$
Variables originaly live in a conf file::
$ cat /etc/aaa.conf
API_HOST="https://aaa-api-staging.zettauser.com/api/"
CLOUD_INSTANCE_NAME=media-server-xx-xx-xx-xx
CLOUD_APPLICATION=media-server
CLOUD_APP_COMPONENT=none
CLOUD_ZONE=a
CLOUD_REGION=b
CLOUD_PRIVATE_IP=none
CLOUD_PUBLIC_IP=xx.xx.xx.xx
CLOUD_PUBLIC_IPV6=xx.xx.xx.xx.xx.xx
CLOUD_PROVIDER=c
$
Is there a way to inform supervisor about the fact it has to source
Variables from /etc/aaa.conf ?
I a have been trying to setup horizon to run inside an elastic beanstalk instance, and it looks like it works.
supervisorctl status
gets me the following output
horizon RUNNING pid 3435, uptime 0:06:31
but the log prints a successful start then loops an error message and the queue is not working
Horizon started successfully.
sh: line 0: exec: : not found
sh: line 0: exec: : not found <------ This prints like an infinite loop
the horizon queue does work if I start it manually from the ssh shell.
here are my configuration files for EBS
001-cron.config
files:
"/etc/cron.d/mycron":
mode: "000644"
owner: root
group: root
content: |
* * * * * root php /var/app/current/artisan schedule:run
002-horizon.config
container_commands:
01-copy_systemd_file:
command: "easy_install supervisor"
02-enable_systemd:
command: "mkdir -p /etc/supervisor/conf.d"
03-copy_horizon_config:
command: "cp .ebextensions/horizon.conf /etc/supervisor/conf.d/horizon.conf"
cwd: "/var/app/ondeck"
04-copy_supervidor_config:
command: "cp .ebextensions/supervisord.conf /etc/supervisord.conf"
cwd: "/var/app/ondeck"
05-touch_log:
command: "mkdir -p /var/log/supervisor/ && touch /var/log/supervisor/supervisord.log"
06-run_supervisor:
command: "/usr/local/bin/supervisord -c /etc/supervisord.conf || true"
07-run_process:
command: "/usr/local/bin/supervisorctl restart horizon:*"
08-get_status:
command: "/usr/local/bin/supervisorctl status"
horizon.conf
[program:horizon]
process_name=%(program_name)s
command=php /var/app/current/artisan horizon
autostart=true
autorestart=true
user=ec2-user
redirect_stderr=true
stdout_logfile=/var/log/horizon.log
supervisord.conf
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
In your horizon.conf file, try specifying the full path to php:
/usr/bin/php
Like so:
[program:horizon]
process_name=%(program_name)s
command=/usr/bin/php /var/app/current/artisan horizon
autostart=true
autorestart=true
user=root
redirect_stderr=true
stdout_logfile=/var/log/horizon.log
Also note that I am using user=root.
I have two different Laravel queues in the same server. In my Supervisord.d folder I have two ini files for those queues. The job names are different in the queues. But, every time I run a job and expect the result from one queue, other queue also interferes. Here is the sample of the ini files:
[program:queue_runner]
command = php /path_to_prod/artisan queue:work --daemon --queue=default,smsInt,smsIntLow --tries=1 --timeout=30
stdout_logfile = /path_to_prod/storage/logs/supervisor.log
redirect_stderr = true
numprocs = 5
process_name = %(program_name)s%(process_num)s
[program:queue_runner_test]
command = php /path_to_test/artisan queue:work --daemon --queue=default,smsIntTest,smsIntTestLow --tries=1 --timeout=30
stdout_logfile = /path_to_test/storage/logs/supervisor.log
redirect_stderr = true
numprocs = 50
process_name = %(program_name)s%(process_num)s
Could you please help me to solve it.
Found the solution of my problem. Though the jobs were despatching from the test site on the smsIntTest and from the other site on the smsInt queues from the beginning. But, they were getting picked up by wrong queues every time.
As the following post suggested, Why is Laravel or Beanstalkd skipping jobs?
I've assigned 'queue' => 'smsInt' in the 'connections' array of the app/config/queue.php file for one site, and 'queue' => 'smsIntTest' for the other one. This solution solved the problem.
I have an issue when using environment variable defined in .bash_profile. When I run this command :
sudo supervisord -c /etc/supervisord.conf.
It always return :
format string '%(ENV_Jas_name)s' for 'program:laravel-process-user-data-queue.user' contains names ('ENV_Jas_name') which cannot be expanded. .
I am trying to set the user and absolute path of command from the environment variables. Config files :
1. supervisord.conf file:
[unix_http_server]
file=/tmp/supervisor.sock ; the path to the socket file
[supervisord]
enviroment=Jas_root3=%(ENV_nnsms3_root)s,Jas_name=%(ENV_Jas_name$)
logfile=/tmp/supervisord.log ; main log file; default $CWD/supervisord.log
logfile_maxbytes=50MB ; max main logfile bytes b4 rotation; default 50MB
logfile_backups=10 ; # of main logfile backups; 0 means none, default 10
loglevel=info ; log level; default info; others: debug,warn,trace
pidfile=/tmp/supervisord.pid ; supervisord pidfile; default supervisord.pid
nodaemon=false ; start in foreground if true; default false
minfds=1024 ; min. avail startup file descriptors; default 1024
minprocs=200 ; min. avail process descriptors;default 200
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[program:laravel-process-user-data-queue]
process_name=%(program_name)s_%(process_num)02d
command=sudo php %(ENV_Jas_root)s/app/artisan queue:listen --tries=3 --queue=high,default,low
autostart=true
autorestart=true
user=%(ENV_Jas_name)s
numprocs=1
redirect_stderr=true
stderr_logfile=%(ENV_Jas_root)s/app/storage/logs/supervisor/processuserdata.err.log
stdout_logfile=%(ENV_Jas_root)s/app/storage/logs/supervisor/processuserdata.out.log
2. .Bash_profile :
source ~/.profile
export PATH=/Applications/MAMP/bin/php/php7.0.19/bin:$PATH
export PATH="/usr/local/sbin:$PATH"
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
export Jas_root="/Users/JasemAl-sadi/Desktop/SMS/Local websites/Jas_main"
export Jas_user="Sony"
I am running in macOS High Sierra with Mamp pro with PHP 7.1 with supervisor 3.3.3
**I saw most of the related issues, but nothing work :( **
I've been working on a Laravel (5.3) project in which I have to crawl data from multiple websites.
So, for that I set up queue jobs and configured a supervisor for them.
Everything works fine until I configure the supervisor to run only 1 process.
In file
/etc/supervisor/conf.d/laravel-worker.conf
numprocs=1
When I assign the numprocs value to more than 1, it behaves weird that supervisor executes the jobs for 2 times or 3 times.
Followings are my versions:
Ubuntu 14.04.2 LTS
Laravel 5.3
supervisord 3.0b2
Followings are my configurations:
Configurations for following file are
/etc/supervisor/supervisor.conf
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; ('AUTO' child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
Configurations for following file are
/etc/supervisor/conf.d/laravel-worker.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/myapp/artisan queue:work database --sleep=3 --tries=3
autostart=true
autorestart=true
user=hmabuzar
numprocs=25
redirect_stderr=true
stderr_events_enabled=true
stderr_logfile=/var/www/myapp/storage/logs/worker.error.log
stdout_logfile=/var/www/myapp/storage/logs/worker.log