puppet: Only run deliver_scheduled_messages and _emails on one server.

`deliver_scheduled_emails` and `deliver_scheduled_messages` use the
`ScheduledEmail` and `ScheduledMessage` tables as a queue,
effectively, pulling values off of them.  As noted in their comments,
this is not safe to run on multiple hosts at once.  As such, split out
the supervisor files for them.
This commit is contained in:
Alex Vandiver 2021-05-17 15:14:56 -07:00 committed by Tim Abbott
parent 79c087471c
commit ef6d0ec5ca
3 changed files with 46 additions and 30 deletions

View File

@ -2,6 +2,23 @@
# in a cluster. # in a cluster.
class zulip::app_frontend_once { class zulip::app_frontend_once {
$proxy_host = zulipconf('http_proxy', 'host', '')
$proxy_port = zulipconf('http_proxy', 'port', '')
if $proxy_host != '' and $proxy_port != '' {
$proxy = "http://${proxy_host}:${proxy_port}"
} else {
$proxy = ''
}
file { "${zulip::common::supervisor_conf_dir}/zulip-once.conf":
ensure => file,
require => [Package[supervisor], Exec['stage_updated_sharding']],
owner => 'root',
group => 'root',
mode => '0644',
content => template('zulip/supervisor/zulip-once.conf.template.erb'),
notify => Service[$zulip::common::supervisor_service],
}
file { '/etc/cron.d/send-digest-emails': file { '/etc/cron.d/send-digest-emails':
ensure => file, ensure => file,
owner => 'root', owner => 'root',

View File

@ -0,0 +1,29 @@
[program:zulip_deliver_scheduled_emails]
command=nice -n15 /home/zulip/deployments/current/manage.py deliver_scheduled_emails
environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
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)
topwaitsecs=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_scheduled_emails.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=20MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=3 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/
[program:zulip_deliver_scheduled_messages]
command=nice -n15 /home/zulip/deployments/current/manage.py deliver_scheduled_messages
environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
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)
topwaitsecs=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_scheduled_message_deliverer.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=20MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=3 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/

View File

@ -94,36 +94,6 @@ stopasgroup=true ; Without this, we leak processes every restart
killasgroup=true ; Without this, we leak processes every restart killasgroup=true ; Without this, we leak processes every restart
<% end %> <% end %>
[program:zulip_deliver_scheduled_emails]
command=nice -n15 /home/zulip/deployments/current/manage.py deliver_scheduled_emails
environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
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)
topwaitsecs=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_scheduled_emails.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=20MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=3 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/
[program:zulip_deliver_scheduled_messages]
command=nice -n15 /home/zulip/deployments/current/manage.py deliver_scheduled_messages
environment=HTTP_proxy="<%= @proxy %>",HTTPS_proxy="<%= @proxy %>"
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)
topwaitsecs=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_scheduled_message_deliverer.log ; stdout log path, NONE for none; default AUTO
stdout_logfile_maxbytes=20MB ; max # logfile bytes b4 rotation (default 50MB)
stdout_logfile_backups=3 ; # of stdout logfile backups (default 10)
directory=/home/zulip/deployments/current/
; The below sample group section shows all possible group values, ; The below sample group section shows all possible group values,
; create one or more 'real' group: sections to create "heterogeneous" ; create one or more 'real' group: sections to create "heterogeneous"
; process groups. ; process groups.