Просмотр исходного кода

Merge pull request #11448 from overleaf/msm-sp-cron

[CE/SP] `cron` jobs for Full Project History

GitOrigin-RevId: 1f52bd4baaed5856193cd3babfe2c95865b25cf8
Miguel Serrano 3 лет назад
Родитель
Сommit
28c9c32e1b

+ 5 - 0
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
 # --------------------------------------------------

+ 3 - 0
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

+ 12 - 0
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"

+ 12 - 0
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"

+ 11 - 0
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"