Merge pull request #16919 from overleaf/jpa-check-env-vars

[server-ce] add script for checking on old ShareLaTeX env vars

GitOrigin-RevId: a60d6f7648d65c336054795affe91a349aa629cf
This commit is contained in:
Jakob Ackermann 2024-02-09 15:17:30 +00:00 committed by Copybot
parent 288e8ab86c
commit 12befda220
10 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,18 @@
#!/bin/bash
set -euo pipefail
FILE=${1:-docker-compose.yml}
if [[ ! -f "$FILE" ]]; then
echo "Expected to find $FILE, are you in the wrong directory?"
exit 2
fi
BACKUP_FILE="$FILE.$(date '+%Y.%m.%d-%H.%M.%S')"
echo "Creating backup file $BACKUP_FILE"
cp "$FILE" "$BACKUP_FILE"
echo "Replacing 'SHARELATEX_' with 'OVERLEAF_' in $FILE"
sed -i "s/SHARELATEX_/OVERLEAF_/g" "$FILE"
echo "Done."

View file

@ -0,0 +1,54 @@
#!/bin/bash
set -e
OLD_ITEMS=$(env | cut -d '=' -f1 | grep SHARELATEX | sed 's/^/ - /')
if [[ "$OLD_ITEMS" == "" ]]; then
exit 0
fi
N=$(echo "$OLD_ITEMS" | wc -l)
cat <<EOF
------------------------------------------------------------------------
ShareLaTeX to Overleaf rebranding
---------------------------------
Starting with version 5.0, ShareLaTeX branded variables are no
longer supported as we are migrating to the Overleaf brand.
Your configuration still uses $N ShareLaTeX environment variables:
$OLD_ITEMS
Please either replace them with the "OVERLEAF_" prefix,
e.g. SHARELATEX_MONGO_URL -> OVERLEAF_MONGO_URL, or
remove old entries from your configuration.
You can use the following script for migrating your config.
Overleaf toolkit setups:
github.com/overleaf/toolkit$ bin/upgrade
github.com/overleaf/toolkit$ bin/rename-env-vars-5-0.sh
Legacy docker compose setups/Horizontal scaling setups:
github.com/overleaf/overleaf$ git pull
github.com/overleaf/overleaf$ server-ce/bin/rename-env-vars-5-0.sh
# When using a docker-compose.override.yml file (or other file name):
github.com/overleaf/overleaf$ server-ce/bin/rename-env-vars-5-0.sh docker-compose.override.yml
Other deployment methods:
Try using the docker compose script or get in touch with support.
Refusing to startup, existing in 10s.
------------------------------------------------------------------------
EOF
sleep 10
exit 101