From 28c9c32e1bca3e1d86a1b5a8d830f022ea41c68f Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Thu, 26 Jan 2023 12:34:52 +0100 Subject: [PATCH] Merge pull request #11448 from overleaf/msm-sp-cron [CE/SP] `cron` jobs for Full Project History GitOrigin-RevId: 1f52bd4baaed5856193cd3babfe2c95865b25cf8 --- server-ce/Dockerfile | 5 +++++ server-ce/config/crontab-history | 3 +++ server-ce/cron/project-history-periodic-flush.sh | 12 ++++++++++++ server-ce/cron/project-history-retry-hard.sh | 12 ++++++++++++ server-ce/cron/project-history-retry-soft.sh | 11 +++++++++++ 5 files changed, 43 insertions(+) create mode 100644 server-ce/config/crontab-history create mode 100755 server-ce/cron/project-history-periodic-flush.sh create mode 100755 server-ce/cron/project-history-retry-hard.sh create mode 100755 server-ce/cron/project-history-retry-soft.sh diff --git a/server-ce/Dockerfile b/server-ce/Dockerfile index ac09bb8215..29f3194974 100644 --- a/server-ce/Dockerfile +++ b/server-ce/Dockerfile @@ -46,6 +46,11 @@ ADD server-ce/nginx/clsi-nginx.conf /etc/nginx/sites-enabled/clsi-nginx.conf ADD server-ce/logrotate/sharelatex /etc/logrotate.d/sharelatex RUN chmod 644 /etc/logrotate.d/sharelatex +# Configure cron tasks +# ---------------------- +ADD server-ce/cron /overleaf/cron +ADD server-ce/config/crontab* /etc/cron.d + # Copy Phusion Image startup scripts to its location # -------------------------------------------------- diff --git a/server-ce/config/crontab-history b/server-ce/config/crontab-history new file mode 100644 index 0000000000..e0035e2d1b --- /dev/null +++ b/server-ce/config/crontab-history @@ -0,0 +1,3 @@ +*/20 * * * * root /overleaf/cron/project-history-periodic-flush.sh >> /var/log/sharelatex/cron-project-history-periodic-flush.log 2>&1 +30 * * * * root /overleaf/cron/project-history-retry-soft.sh >> /var/log/sharelatex/project-history-retry-soft.log 2>&1 +45 * * * * root /overleaf/cron/project-history-retry-hard.sh >> /var/log/sharelatex/project-history-retry-hard.log 2>&1 diff --git a/server-ce/cron/project-history-periodic-flush.sh b/server-ce/cron/project-history-periodic-flush.sh new file mode 100755 index 0000000000..48d8cff8d7 --- /dev/null +++ b/server-ce/cron/project-history-periodic-flush.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -eux + +echo "--------------------------" +echo "Flush project-history queue" +echo "--------------------------" +date + +PROJECT_HISTORY_URL='http://localhost:3054' + +curl -X POST "${PROJECT_HISTORY_URL}/flush/old?timeout=3600000&limit=5000&background=1" diff --git a/server-ce/cron/project-history-retry-hard.sh b/server-ce/cron/project-history-retry-hard.sh new file mode 100755 index 0000000000..2abcd4f3d4 --- /dev/null +++ b/server-ce/cron/project-history-retry-hard.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -eux + +echo "-----------------------------------" +echo "Retry project-history errors (hard)" +echo "-----------------------------------" +date + +PROJECT_HISTORY_URL='http://localhost:3054' + +curl -X POST "${PROJECT_HISTORY_URL}/retry/failures?failureType=hard&timeout=3600000&limit=10000" diff --git a/server-ce/cron/project-history-retry-soft.sh b/server-ce/cron/project-history-retry-soft.sh new file mode 100755 index 0000000000..3568648085 --- /dev/null +++ b/server-ce/cron/project-history-retry-soft.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +set -eux + +echo "-----------------------------------" +echo "Retry project-history errors (soft)" +echo "-----------------------------------" + +PROJECT_HISTORY_URL='http://localhost:3054' + +curl -X POST "${PROJECT_HISTORY_URL}/retry/failures?failureType=hard&timeout=3600000&limit=10000"