From 4643e48f60cac89e6e11d85b209803c3e991aff2 Mon Sep 17 00:00:00 2001 From: Mateusz Mandera Date: Mon, 4 May 2020 14:15:33 +0200 Subject: [PATCH] retention: Add a daily cron job. This will run archive_messages management command at 6am every day, 1 hour after soft_deactivate_users (which runs at 5am). --- puppet/zulip/files/cron.d/archive-messages | 7 +++++++ puppet/zulip/manifests/app_frontend_once.pp | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 puppet/zulip/files/cron.d/archive-messages diff --git a/puppet/zulip/files/cron.d/archive-messages b/puppet/zulip/files/cron.d/archive-messages new file mode 100644 index 0000000000..59e17f08a9 --- /dev/null +++ b/puppet/zulip/files/cron.d/archive-messages @@ -0,0 +1,7 @@ +SHELL=/bin/bash +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +USER=zulip + +# Daily cron job for retention policy - archives existing messages based on the policy +# and cleans expired entries from the archive. +0 6 * * * zulip /home/zulip/deployments/current/manage.py archive_messages >/dev/null diff --git a/puppet/zulip/manifests/app_frontend_once.pp b/puppet/zulip/manifests/app_frontend_once.pp index c853a6cc75..fca77e3f63 100644 --- a/puppet/zulip/manifests/app_frontend_once.pp +++ b/puppet/zulip/manifests/app_frontend_once.pp @@ -34,6 +34,14 @@ class zulip::app_frontend_once { source => 'puppet:///modules/zulip/cron.d/soft-deactivate-users', } + file { '/etc/cron.d/archive-messages': + ensure => file, + owner => 'root', + group => 'root', + mode => '0644', + source => 'puppet:///modules/zulip/cron.d/archive-messages', + } + file { '/etc/cron.d/calculate-first-visible-message-id': ensure => absent, }