[CE/SP] Add init script to check for missing secrets (#34345)

* [CE/SP] Add init script to check missing secrets

* Added OVERLEAF_INVITE_TOKEN_SECRET to CE compose files

GitOrigin-RevId: 1bc15763edfc43782038bdfd173067230477ce94
This commit is contained in:
Miguel Serrano
2026-06-08 08:06:36 +00:00
committed by Copybot
parent 1a7b5e66f5
commit 63ed42ca3d
3 changed files with 63 additions and 0 deletions
+59
View File
@@ -0,0 +1,59 @@
#!/bin/bash
set -e
REQUIRED_SECRETS="
OVERLEAF_INVITE_TOKEN_SECRET
"
MISSING_ITEMS=""
for name in ${REQUIRED_SECRETS}; do
if [[ -z "${!name}" ]]; then
MISSING_ITEMS="$MISSING_ITEMS $name"
fi
done
if [[ "$MISSING_ITEMS" == "" ]]; then
exit 0
fi
MISSING_ITEMS=$(echo "$MISSING_ITEMS" | xargs -n1 | sed 's/^/ - /')
N=$(echo "$MISSING_ITEMS" | wc -l)
cat <<EOF
------------------------------------------------------------------------
Missing required secrets
------------------------
Your configuration is missing $N required secret(s):
$MISSING_ITEMS
These secrets must be set to persistent random values and kept
stable across container restarts and upgrades. Regenerating them
will invalidate previously issued tokens stored in the database.
Generate a value with, for example:
openssl rand -base64 32
Overleaf toolkit setups:
Add the missing variable(s) to config/variables.env and restart:
github.com/overleaf/toolkit$ bin/up
docker compose setups:
Add the missing variable(s) to the sharelatex service environment
in docker-compose.yml (or your override file) and restart.
Refusing to startup, exiting in 10s.
------------------------------------------------------------------------
EOF
sleep 10
exit 101