From b84e76b20117d367a6f8a658112690b8989bcc60 Mon Sep 17 00:00:00 2001 From: Miguel Serrano Date: Mon, 1 Apr 2024 10:43:31 +0200 Subject: [PATCH] Merge pull request #17627 from overleaf/msm-sp-hotfix-5_0_1 [CE/SP] Hotfix 5.0.1 GitOrigin-RevId: ce193b9c7ad7988547289bddb4e8e63d4c718371 --- server-ce/hotfix/5.0.1/Dockerfile | 17 ++++ server-ce/hotfix/5.0.1/env.sh | 14 +++ server-ce/hotfix/5.0.1/pr_17601-1.patch | 31 +++++++ server-ce/hotfix/5.0.1/pr_17601-2.patch | 63 +++++++++++++ server-ce/hotfix/5.0.1/pr_17601-3.patch | 46 +++++++++ server-ce/hotfix/5.0.1/pr_17601-4.patch | 118 ++++++++++++++++++++++++ server-ce/hotfix/5.0.1/pr_17625.patch | 23 +++++ 7 files changed, 312 insertions(+) create mode 100644 server-ce/hotfix/5.0.1/Dockerfile create mode 100644 server-ce/hotfix/5.0.1/env.sh create mode 100644 server-ce/hotfix/5.0.1/pr_17601-1.patch create mode 100644 server-ce/hotfix/5.0.1/pr_17601-2.patch create mode 100644 server-ce/hotfix/5.0.1/pr_17601-3.patch create mode 100644 server-ce/hotfix/5.0.1/pr_17601-4.patch create mode 100644 server-ce/hotfix/5.0.1/pr_17625.patch diff --git a/server-ce/hotfix/5.0.1/Dockerfile b/server-ce/hotfix/5.0.1/Dockerfile new file mode 100644 index 0000000000..32ba317038 --- /dev/null +++ b/server-ce/hotfix/5.0.1/Dockerfile @@ -0,0 +1,17 @@ +FROM sharelatex/sharelatex:5.0.0-RC4 + +# Bugfix: Grammarly ad shouldn't be displayed in Overleaf CE +COPY pr_17625.patch . +RUN patch -p0 < pr_17625.patch + +# Patch: force services to use ipv4 in server-ce container +ADD env.sh /etc/overleaf/env.sh +COPY pr_17601-1.patch /etc/overleaf/ +RUN cd /etc/overleaf && patch -p0 < pr_17601-1.patch && rm pr_17601-1.patch +COPY pr_17601-2.patch /overleaf/cron/ +RUN cd /overleaf/cron && patch -p0 < pr_17601-2.patch && rm pr_17601-2.patch +COPY pr_17601-3.patch /etc/nginx/sites-enabled/ +RUN cd /etc/nginx/sites-enabled && patch -p0 < pr_17601-3.patch && rm pr_17601-3.patch +COPY pr_17601-4.patch /etc/service/ +RUN cd /etc/service && patch -p0 < pr_17601-4.patch && rm pr_17601-4.patch + diff --git a/server-ce/hotfix/5.0.1/env.sh b/server-ce/hotfix/5.0.1/env.sh new file mode 100644 index 0000000000..2dee36a151 --- /dev/null +++ b/server-ce/hotfix/5.0.1/env.sh @@ -0,0 +1,14 @@ +export CHAT_HOST=127.0.0.1 +export CLSI_HOST=127.0.0.1 +export CONTACTS_HOST=127.0.0.1 +export DOCSTORE_HOST=127.0.0.1 +export DOCUMENT_UPDATER_HOST=127.0.0.1 +export DOCUPDATER_HOST=127.0.0.1 +export FILESTORE_HOST=127.0.0.1 +export HISTORY_V1_HOST=127.0.0.1 +export NOTIFICATIONS_HOST=127.0.0.1 +export PROJECT_HISTORY_HOST=127.0.0.1 +export REALTIME_HOST=127.0.0.1 +export SPELLING_HOST=127.0.0.1 +export WEB_HOST=127.0.0.1 +export WEB_API_HOST=127.0.0.1 diff --git a/server-ce/hotfix/5.0.1/pr_17601-1.patch b/server-ce/hotfix/5.0.1/pr_17601-1.patch new file mode 100644 index 0000000000..3f8c136df8 --- /dev/null +++ b/server-ce/hotfix/5.0.1/pr_17601-1.patch @@ -0,0 +1,31 @@ +--- settings.js ++++ settings.js +@@ -256,16 +256,16 @@ const settings = { + + apis: { + web: { +- url: 'http://localhost:3000', ++ url: 'http://127.0.0.1:3000', + user: httpAuthUser, + pass: httpAuthPass, + }, + project_history: { + sendProjectStructureOps: true, +- url: 'http://localhost:3054', ++ url: 'http://127.0.0.1:3054', + }, + v1_history: { +- url: process.env.V1_HISTORY_URL || 'http://localhost:3100/api', ++ url: process.env.V1_HISTORY_URL || 'http://127.0.0.1:3100/api', + user: 'staging', + pass: process.env.STAGING_PASSWORD, + requestTimeout: parseInt( +@@ -409,7 +409,7 @@ if ( + + if (parse(process.env.OVERLEAF_IS_SERVER_PRO) === true) { + settings.bypassPercentageRollouts = true +- settings.apis.references = { url: 'http://localhost:3040' } ++ settings.apis.references = { url: 'http://127.0.0.1:3040' } + } + + // Compiler diff --git a/server-ce/hotfix/5.0.1/pr_17601-2.patch b/server-ce/hotfix/5.0.1/pr_17601-2.patch new file mode 100644 index 0000000000..2322ad9afc --- /dev/null +++ b/server-ce/hotfix/5.0.1/pr_17601-2.patch @@ -0,0 +1,63 @@ +--- deactivate-projects.sh ++++ deactivate-projects.sh +@@ -14,7 +14,7 @@ if [[ "${ENABLE_CRON_RESOURCE_DELETION:-null}" != "true" ]]; then + exit 0 + fi + +-WEB_URL='http://localhost:3000' ++WEB_URL='http://127.0.0.1:3000' + + USER=$(cat /etc/container_environment/WEB_API_USER) + PASS=$(cat /etc/container_environment/WEB_API_PASSWORD) +--- delete-projects.sh ++++ delete-projects.sh +@@ -14,7 +14,7 @@ if [[ "${ENABLE_CRON_RESOURCE_DELETION:-null}" != "true" ]]; then + exit 0 + fi + +-WEB_URL='http://localhost:3000' ++WEB_URL='http://127.0.0.1:3000' + + USER=$(cat /etc/container_environment/WEB_API_USER) + PASS=$(cat /etc/container_environment/WEB_API_PASSWORD) +--- delete-users.sh ++++ delete-users.sh +@@ -14,7 +14,7 @@ if [[ "${ENABLE_CRON_RESOURCE_DELETION:-null}" != "true" ]]; then + exit 0 + fi + +-WEB_URL='http://localhost:3000' ++WEB_URL='http://127.0.0.1:3000' + + USER=$(cat /etc/container_environment/WEB_API_USER) + PASS=$(cat /etc/container_environment/WEB_API_PASSWORD) +--- project-history-periodic-flush.sh ++++ project-history-periodic-flush.sh +@@ -7,6 +7,6 @@ echo "Flush project-history queue" + echo "--------------------------" + date + +-PROJECT_HISTORY_URL='http://localhost:3054' ++PROJECT_HISTORY_URL='http://127.0.0.1:3054' + + curl -X POST "${PROJECT_HISTORY_URL}/flush/old?timeout=3600000&limit=5000&background=1" +--- project-history-retry-hard.sh ++++ project-history-retry-hard.sh +@@ -7,6 +7,6 @@ echo "Retry project-history errors (hard)" + echo "-----------------------------------" + date + +-PROJECT_HISTORY_URL='http://localhost:3054' ++PROJECT_HISTORY_URL='http://127.0.0.1:3054' + + curl -X POST "${PROJECT_HISTORY_URL}/retry/failures?failureType=hard&timeout=3600000&limit=10000" +--- project-history-retry-soft.sh ++++ project-history-retry-soft.sh +@@ -6,6 +6,6 @@ echo "-----------------------------------" + echo "Retry project-history errors (soft)" + echo "-----------------------------------" + +-PROJECT_HISTORY_URL='http://localhost:3054' ++PROJECT_HISTORY_URL='http://127.0.0.1:3054' + + curl -X POST "${PROJECT_HISTORY_URL}/retry/failures?failureType=soft&timeout=3600000&limit=10000" diff --git a/server-ce/hotfix/5.0.1/pr_17601-3.patch b/server-ce/hotfix/5.0.1/pr_17601-3.patch new file mode 100644 index 0000000000..fa138d62a9 --- /dev/null +++ b/server-ce/hotfix/5.0.1/pr_17601-3.patch @@ -0,0 +1,46 @@ +--- overleaf.conf ++++ overleaf.conf +@@ -10,7 +10,7 @@ server { + } + + location / { +- proxy_pass http://localhost:4000; ++ proxy_pass http://127.0.0.1:4000; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; +@@ -22,7 +22,7 @@ server { + } + + location /socket.io { +- proxy_pass http://localhost:3026; ++ proxy_pass http://127.0.0.1:3026; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; +@@ -48,22 +48,22 @@ server { + + # handle output files for specific users + location ~ ^/project/([0-9a-f]+)/user/([0-9a-f]+)/build/([0-9a-f-]+)/output/output\.([a-z]+)$ { +- proxy_pass http://localhost:8080; # clsi-nginx.conf ++ proxy_pass http://127.0.0.1:8080; # clsi-nginx.conf + proxy_http_version 1.1; + } + # handle output files for anonymous users + location ~ ^/project/([0-9a-f]+)/build/([0-9a-f-]+)/output/output\.([a-z]+)$ { +- proxy_pass http://localhost:8080; # clsi-nginx.conf ++ proxy_pass http://127.0.0.1:8080; # clsi-nginx.conf + proxy_http_version 1.1; + } + # PDF range for specific users + location ~ ^/project/([0-9a-f]+)/user/([0-9a-f]+)/content/([0-9a-f-]+/[0-9a-f]+)$ { +- proxy_pass http://localhost:8080; # clsi-nginx.conf ++ proxy_pass http://127.0.0.1:8080; # clsi-nginx.conf + proxy_http_version 1.1; + } + # PDF range for anonymous users + location ~ ^/project/([0-9a-f]+)/content/([0-9a-f-]+/[0-9a-f]+)$ { +- proxy_pass http://localhost:8080; # clsi-nginx.conf ++ proxy_pass http://127.0.0.1:8080; # clsi-nginx.conf + proxy_http_version 1.1; + } diff --git a/server-ce/hotfix/5.0.1/pr_17601-4.patch b/server-ce/hotfix/5.0.1/pr_17601-4.patch new file mode 100644 index 0000000000..9b1fed6f27 --- /dev/null +++ b/server-ce/hotfix/5.0.1/pr_17601-4.patch @@ -0,0 +1,118 @@ +--- chat-overleaf/run ++++ chat-overleaf/run +@@ -6,4 +6,7 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:30100" + fi + ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/chat/app.js >> /var/log/overleaf/chat.log 2>&1 +--- clsi-overleaf/run ++++ clsi-overleaf/run +@@ -15,4 +15,7 @@ if [ -e '/var/run/docker.sock' ]; then + usermod -aG dockeronhost www-data + fi + ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/clsi/app.js >> /var/log/overleaf/clsi.log 2>&1 +--- contacts-overleaf/run ++++ contacts-overleaf/run +@@ -6,4 +6,7 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:30360" + fi + ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/contacts/app.js >> /var/log/overleaf/contacts.log 2>&1 +--- docstore-overleaf/run ++++ docstore-overleaf/run +@@ -6,4 +6,7 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:30160" + fi + ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/docstore/app.js >> /var/log/overleaf/docstore.log 2>&1 +--- document-updater-overleaf/run ++++ document-updater-overleaf/run +@@ -6,4 +6,7 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:30030" + fi + ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/document-updater/app.js >> /var/log/overleaf/document-updater.log 2>&1 +--- filestore-overleaf/run ++++ filestore-overleaf/run +@@ -1,2 +1,6 @@ + #!/bin/bash ++ ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node /overleaf/services/filestore/app.js >> /var/log/overleaf/filestore.log 2>&1 +--- notifications-overleaf/run ++++ notifications-overleaf/run +@@ -6,4 +6,7 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:30420" + fi + ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/notifications/app.js >> /var/log/overleaf/notifications.log 2>&1 +--- project-history-overleaf/run ++++ project-history-overleaf/run +@@ -6,4 +6,7 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:30540" + fi + ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/project-history/app.js >> /var/log/overleaf/project-history.log 2>&1 +--- real-time-overleaf/run ++++ real-time-overleaf/run +@@ -1,2 +1,6 @@ + #!/bin/bash ++ ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node /overleaf/services/real-time/app.js >> /var/log/overleaf/real-time.log 2>&1 +--- spelling-overleaf/run ++++ spelling-overleaf/run +@@ -6,4 +6,7 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:30050" + fi + ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 ++ + exec /sbin/setuser www-data /usr/bin/node $NODE_PARAMS /overleaf/services/spelling/app.js >> /var/log/overleaf/spelling.log 2>&1 +--- web-api-overleaf/run ++++ web-api-overleaf/run +@@ -6,6 +6,7 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:30000" + fi + ++source /etc/overleaf/env.sh + export LISTEN_ADDRESS=0.0.0.0 + export ENABLED_SERVICES="api" + export METRICS_APP_NAME="web-api" +--- web-overleaf/run ++++ web-overleaf/run +@@ -6,6 +6,8 @@ if [ "$DEBUG_NODE" == "true" ]; then + NODE_PARAMS="--inspect=0.0.0.0:40000" + fi + ++source /etc/overleaf/env.sh ++export LISTEN_ADDRESS=127.0.0.1 + export ENABLED_SERVICES="web" + export WEB_PORT="4000" diff --git a/server-ce/hotfix/5.0.1/pr_17625.patch b/server-ce/hotfix/5.0.1/pr_17625.patch new file mode 100644 index 0000000000..0241c11553 --- /dev/null +++ b/server-ce/hotfix/5.0.1/pr_17625.patch @@ -0,0 +1,23 @@ +--- services/web/frontend/js/features/source-editor/components/grammarly-advert.tsx ++++ services/web/frontend/js/features/source-editor/components/grammarly-advert.tsx +@@ -6,8 +6,12 @@ import useRemindMeLater from '@/shared/hooks/use-remind-me-later' + import GrammarlyLogo from '@/shared/svgs/grammarly-logo' + import * as eventTracking from '../../../infrastructure/event-tracking' + import useWaitForGrammarlyCheck from '@/shared/hooks/use-wait-for-grammarly-check' ++import getMeta from '@/utils/meta' ++import { ExposedSettings } from '../../../../../types/exposed-settings' + + export default function GrammarlyAdvert() { ++ const { isOverleaf } = getMeta('ol-ExposedSettings') as ExposedSettings ++ + const [show, setShow] = useState(false) + const { t } = useTranslation() + +@@ -57,7 +61,7 @@ export default function GrammarlyAdvert() { + remindThemLater() + }, [remindThemLater]) + +- if (!show) { ++ if (!isOverleaf || !show) { + return null + }