From 1d8ed4bb231865555d00fd9925b39db7841af54d Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Thu, 14 Jan 2021 10:33:37 +0000 Subject: [PATCH] [hotfix] produce version 2.5.1 with fixes for log rotation --- server-ce/hotfix/2.5.1/Dockerfile | 13 +++++++++++++ server-ce/hotfix/2.5.1/contacts-run.patch | 8 ++++++++ server-ce/hotfix/2.5.1/delete-old-logs.patch | 10 ++++++++++ 3 files changed, 31 insertions(+) create mode 100644 server-ce/hotfix/2.5.1/Dockerfile create mode 100644 server-ce/hotfix/2.5.1/contacts-run.patch create mode 100644 server-ce/hotfix/2.5.1/delete-old-logs.patch diff --git a/server-ce/hotfix/2.5.1/Dockerfile b/server-ce/hotfix/2.5.1/Dockerfile new file mode 100644 index 0000000000..d22f9123d1 --- /dev/null +++ b/server-ce/hotfix/2.5.1/Dockerfile @@ -0,0 +1,13 @@ +FROM sharelatex/sharelatex:2.5.0 + +# Patch #826: Fixes log path for contacts service to be picked up by logrotate +COPY contacts-run.patch /etc/service/contacts-sharelatex +RUN cd /etc/service/contacts-sharelatex && patch < contacts-run.patch + +# Patch #826: delete old logs for the contacts service +COPY delete-old-logs.patch /etc/my_init.d +RUN cd /etc/my_init.d && patch < delete-old-logs.patch \ +&& chmod +x /etc/my_init.d/10_delete_old_logs.sh + +# Patch #827: fix logrotate file permissions +RUN chmod 644 /etc/logrotate.d/sharelatex diff --git a/server-ce/hotfix/2.5.1/contacts-run.patch b/server-ce/hotfix/2.5.1/contacts-run.patch new file mode 100644 index 0000000000..81ef36ecb0 --- /dev/null +++ b/server-ce/hotfix/2.5.1/contacts-run.patch @@ -0,0 +1,8 @@ +--- a/run ++++ b/run +@@ -7,4 +7,4 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:30360" + fi + +-exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/contacts/app.js >> /var/log/sharelatex/contacts 2>&1 ++exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /var/www/sharelatex/contacts/app.js >> /var/log/sharelatex/contacts.log 2>&1 diff --git a/server-ce/hotfix/2.5.1/delete-old-logs.patch b/server-ce/hotfix/2.5.1/delete-old-logs.patch new file mode 100644 index 0000000000..bc2be14adf --- /dev/null +++ b/server-ce/hotfix/2.5.1/delete-old-logs.patch @@ -0,0 +1,10 @@ +--- /dev/null ++++ b/10_delete_old_logs.sh +@@ -0,0 +1,7 @@ ++#!/bin/sh ++set -e ++ ++# Up to version 2.5.0 the logs of the contacts service were written into a ++# file that was not picked up by logrotate. ++# The service is stable and we can safely discard any logs. ++rm -vf /var/log/sharelatex/contacts