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"