My Supervisor configuration for OroCRM

websocket
supervisor
(Dmitry Fedyuk) #1

1. /etc/supervisor/supervisord.conf

[include]
files = programs/*.ini

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

[supervisorctl]
# 2017-05-19
# It suppresses the «Server 'unix_http_server' running without any HTTP authentication checking»
# Supervisor log message: https://oplatform.club/t/52
password = dummy
serverurl = unix:///var/run/supervisor.sock
# 2017-05-19
# It suppresses the «Server 'unix_http_server' running without any HTTP authentication checking»
# Supervisor log message: https://oplatform.club/t/52
username = dummy

[supervisord]
# 2017-05-18
# For the children logs like «crm.mage2.pro$message_consumer-stdout---supervisor-Oy3Eye.log'».
# 2017-05-19
# I have removed «childlogdir = /var/log/_my/supervisor» because I now use
# «stderr_logfile» and «stdout_logfile» options for the programs.
logfile = /var/log/_my/supervisor.log
loglevel = trace
pidfile = /var/run/supervisord.pid
user = root

[unix_http_server]
chmod = 0777
chown = www-data:www-data
file = /var/run/supervisor.sock
# 2017-05-19
# It suppresses the «Server 'unix_http_server' running without any HTTP authentication checking»
# Supervisor log message: https://oplatform.club/t/52
password = dummy
# 2017-05-19
# It suppresses the «Server 'unix_http_server' running without any HTTP authentication checking»
# Supervisor log message: https://oplatform.club/t/52
username = dummy

2. /etc/supervisor/programs/websocket.ini

; 2017-05-18
; «The name must not include a colon character or a bracket character.»
; http://supervisord.org/configuration.html#program-x-section-settings
[program:crm.mage2.pro@websocket]
; 2017-05-18
; «autostart = true» is omitted, because «true» is the default value for «autostart».
; «If true, this program will start automatically when supervisord is started.»
; https://github.com/orocrm/crm-application/blob/2.1.2/README.md#installation
command = /var/www/crm/app/console clank:server --env=prod
; 2017-05-18
; Note #1
; «numprocs = 1» is omitted, because «1» is the default value for «numprocs».
; «Supervisor will start as many instances of this program as named by numprocs.
; Note that if numprocs > 1, the process_name expression must include %(process_num)s
; (or any other valid Python string expression that includes process_num) within it.»
; Note #2
; The OroCRM documentation uses «numprocs = 5»:
; https://github.com/orocrm/crm-application/blob/2.1.2/README.md#installation
; I do not understand, why. I think, 1 is enough.
; https://www.orocommerce.com/forums/topic/lots-of-process-for-message-queue-...#post-4220
;
; 2017-05-18
; «process_name = %(program_name)s» is omitted,
; because «%(program_name)s» is the default value for «process_name».
;
; 2017-05-18
; «If true, cause the process’ stderr output to be sent back to supervisord on its stdout file descriptor
; (in UNIX shell terms, this is the equivalent of executing /the/program 2>&1).»
; https://github.com/orocrm/crm-application/blob/2.1.2/README.md#installation
redirect_stderr = true
; 2017-05-18
; «The total number of seconds which the program needs to stay running
; after a startup to consider the start successful
; (moving the process from the STARTING state to the RUNNING state).
; Set to 0 to indicate that the program needn’t stay running for any particular amount of time.
; Default: 1»
; https://github.com/orocrm/crm-application/blob/2.1.2/README.md#installation
startsecs = 0
stderr_logfile = /var/log/_my/supervisor-websocket.err.log
stdout_logfile = /var/log/_my/supervisor-websocket.out.log
user = www-data

3. /etc/supervisor/programs/message_consumer.ini

; 2017-05-18
; «The name must not include a colon character or a bracket character.»
; http://supervisord.org/configuration.html#program-x-section-settings
[program:crm.mage2.pro@message_consumer]
; 2017-05-18
; «Specifies if supervisord should automatically restart a process
; if it exits when it is in the RUNNING state.
; May be one of false, unexpected, or true. If false, the process will not be autorestarted.
; If unexpected, the process will be restarted when the program exits with an exit code
; that is not one of the exit codes associated with this process’ configuration (see exitcodes).
; If true, the process will be unconditionally restarted when it exits, without regard to its exit code.
; Default: unexpected»
autorestart = true
; 2017-05-18
; «autostart = true» is omitted, because «true» is the default value for «autostart».
; «If true, this program will start automatically when supervisord is started.»
; https://github.com/orocrm/crm-application/blob/2.1.2/README.md#installation
command = /var/www/crm/app/console oro:message-queue:consume --env=prod
numprocs = 1
process_name=%(program_name)s_%(process_num)02d
; 2017-05-18
; «If true, cause the process’ stderr output to be sent back to supervisord on its stdout file descriptor
; (in UNIX shell terms, this is the equivalent of executing /the/program 2>&1).»
; https://github.com/orocrm/crm-application/blob/2.1.2/README.md#installation
redirect_stderr = true
; 2017-05-18
; «The total number of seconds which the program needs to stay running
; after a startup to consider the start successful
; (moving the process from the STARTING state to the RUNNING state).
; Set to 0 to indicate that the program needn’t stay running for any particular amount of time.
; Default: 1»
; https://github.com/orocrm/crm-application/blob/2.1.2/README.md#installation
startsecs = 0
stderr_logfile = /var/log/_my/supervisor-message-consumer.err.log
stdout_logfile = /var/log/_my/supervisor-message-consumer.out.log
user = www-data
1 Like

How to install Supervisor on Debian
(Dmitry Fedyuk) #2

See also:

1 Like