; Supervisor config file.
; on Debian squeeze, place me in /etc/supervisor/conf.d/zulip.conf
;
; For more information on the config file, please see:
; http://supervisord.org/configuration.html
;
; Note: shell expansion ("~" or "$HOME") is not supported.  Environment
; variables can be expanded using this syntax: "%(ENV_HOME)s".

[fcgi-program:zulip-django]
command=python /home/zulip/deployments/current/manage.py runfcgi daemonize=False maxchildren=20 ; the program (relative uses PATH, can take args)
;process_name=%(program_name)s ; process_name expr (default %(program_name)s)
;numprocs=1                    ; number of processes copies to start (def 1)
;directory=/tmp                ; directory to cwd to before exec (def no cwd)
;umask=022                     ; umask for process (default None)
priority=100                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
;startsecs=1                   ; number of secs prog must stay running (def. 1)
;startretries=3                ; max # of serial start failures (default 3)
;exitcodes=0,2                 ; 'expected' exit codes for process (default 0,2)
stopsignal=HUP                 ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
;stopasgroup=false             ; send stop signal to the UNIX process group (default false)
;killasgroup=false             ; SIGKILL the UNIX process group (def false)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/django.log        ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
;stdout_capture_maxbytes=1MB   ; number of bytes in 'capturemode' (default 0)
;stdout_events_enabled=false   ; emit events on stdout writes (default false)
;stderr_logfile=/var/log/zulip/app.err        ; stderr log path, NONE for none; default AUTO
;stderr_logfile_maxbytes=1MB   ; max # logfile bytes b4 rotation (default 50MB)
;stderr_logfile_backups=10     ; # of stderr logfile backups (default 10)
;stderr_capture_maxbytes=1MB   ; number of bytes in 'capturemode' (default 0)
;stderr_events_enabled=false   ; emit events on stderr writes (default false)
;environment=A=1,B=2           ; process environment additions (def no adds)
;serverurl=AUTO                ; override serverurl computation (childutils)
directory=/home/zulip/deployments/current/
socket=unix:///home/zulip/deployments/fastcgi-socket
socket_owner=zulip:zulip
socket_mode=0700

[program:zulip-tornado]
command=python -u /home/zulip/deployments/current/manage.py runtornado 127.0.0.1:9993
priority=200                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                 ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/tornado.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-user-activity]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=user_activity
priority=300                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                 ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-user-activity.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-user-activity-interval]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=user_activity_interval
priority=300                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                 ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-user-activity-interval.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-user-presence]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=user_presence
priority=300                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                 ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-user-presence.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-signups]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=signups
priority=400                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-signups.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-confirmation-emails]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=invites
priority=500                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-confirmation-emails.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-missedmessage_reminders]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=missedmessage_emails
priority=600                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-missedmessage_reminders.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-missedmessage_mobile_notifications]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=missedmessage_mobile_notifications
priority=600                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-missedmessage_mobile_notifications.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-slowqueries]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=slow_queries
priority=600                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-slow_queries.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-message_sender]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=message_sender --worker_num=%(process_num)s
process_name=%(program_name)s-%(process_num)s
priority=350                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-message_sender.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/
numprocs=5

[program:zulip-events-feedback_messages]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=feedback_messages
priority=600                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-feedback_messages.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-error_reports]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=error_reports
priority=600                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-error_reports.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-digest_emails]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=digest_emails
priority=600                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-digest_emails.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-events-email_mirror]
command=python /home/zulip/deployments/current/manage.py process_queue --queue_name=email_mirror
priority=600                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-email_mirror.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

[program:zulip-deliver-enqueued-emails]
command=python /home/zulip/deployments/current/manage.py deliver_email
priority=600                   ; the relative start priority (default 999)
autostart=true                 ; start at supervisord start (default: true)
autorestart=true               ; whether/when to restart (default: unexpected)
stopsignal=TERM                ; signal used to kill process (default TERM)
stopwaitsecs=30                ; max num secs to wait b4 SIGKILL (default 10)
user=zulip                    ; setuid to this UNIX account to run the program
redirect_stderr=true           ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/zulip/events-deliver_enqueued_emails.log         ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=1GB   ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=10     ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/


; The below sample group section shows all possible group values,
; create one or more 'real' group: sections to create "heterogeneous"
; process groups.

[group:zulip-workers]
; each refers to 'x' in [program:x] definitions
programs=zulip-events-user-activity,zulip-events-user-activity-interval,zulip-events-user-presence,zulip-events-signups,zulip-events-confirmation-emails,zulip-events-missedmessage_reminders,zulip-events-slowqueries,zulip-events-feedback_messages,zulip-events-digest_emails,zulip-events-error_reports,zulip-deliver-enqueued-emails,zulip-events-missedmessage_mobile_notifications,zulip-events-email_mirror

[group:zulip-senders]
programs=zulip-events-message_sender

; 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 = relative/directory/*.ini

;enable server restarts without requiring superuser access. This assumes that this is the only service being controlled by supervisord on this machine.
[unix_http_server]
chown=zulip:zulip
