1
0
Fork 0
mirror of https://github.com/overleaf/toolkit.git synced 2025-04-19 07:18:06 +02:00

Avoid printing warning messages twice -- bin/up does not print itself

This commit is contained in:
Jakob Ackermann 2024-08-30 17:26:37 +01:00
parent 0d20898a9a
commit 8074eaafd5
No known key found for this signature in database
GPG key ID: 30C56800FCA3828A
3 changed files with 22 additions and 14 deletions

View file

@ -32,11 +32,13 @@ function build_environment() {
if [[ $SERVER_PRO == "true" ]]; then if [[ $SERVER_PRO == "true" ]]; then
set_sibling_containers_vars set_sibling_containers_vars
else else
echo "WARNING: SIBLING_CONTAINERS_ENABLED=true is not supported in Overleaf Community Edition." >&2 if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then
echo " Sibling containers are not available in Community Edition, which is intended for use in environments where all users are trusted. Community Edition is not appropriate for scenarios where isolation of users is required." >&2 echo "WARNING: SIBLING_CONTAINERS_ENABLED=true is not supported in Overleaf Community Edition." >&2
echo " When not using Sibling containers, users have full read and write access to the 'sharelatex' container resources (filesystem, network, environment variables) when running LaTeX compiles." >&2 echo " Sibling containers are not available in Community Edition, which is intended for use in environments where all users are trusted. Community Edition is not appropriate for scenarios where isolation of users is required." >&2
echo " Sibling containers are offered as part of our Server Pro offering and you can read more about the differences at https://www.overleaf.com/for/enterprises/features." >&2 echo " When not using Sibling containers, users have full read and write access to the 'sharelatex' container resources (filesystem, network, environment variables) when running LaTeX compiles." >&2
echo " Falling back using insecure in-container compiles. Set SIBLING_CONTAINERS_ENABLED=false in config/overleaf.rc to silence this warning." >&2 echo " Sibling containers are offered as part of our Server Pro offering and you can read more about the differences at https://www.overleaf.com/for/enterprises/features." >&2
echo " Falling back using insecure in-container compiles. Set SIBLING_CONTAINERS_ENABLED=false in config/overleaf.rc to silence this warning." >&2
fi
fi fi
fi fi
if [[ $NGINX_ENABLED == "true" ]]; then if [[ $NGINX_ENABLED == "true" ]]; then
@ -80,7 +82,9 @@ function set_base_vars() {
if [[ ${OVERLEAF_LISTEN_IP:-null} == "null" ]]; if [[ ${OVERLEAF_LISTEN_IP:-null} == "null" ]];
then then
echo "WARNING: the value of OVERLEAF_LISTEN_IP is not set in config/overleaf.rc. This value must be set to the public IP address for direct container access. Defaulting to 0.0.0.0" >&2 if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then
echo "WARNING: the value of OVERLEAF_LISTEN_IP is not set in config/overleaf.rc. This value must be set to the public IP address for direct container access. Defaulting to 0.0.0.0" >&2
fi
OVERLEAF_LISTEN_IP="0.0.0.0" OVERLEAF_LISTEN_IP="0.0.0.0"
fi fi
export OVERLEAF_LISTEN_IP export OVERLEAF_LISTEN_IP
@ -119,8 +123,10 @@ function set_redis_vars() {
export REDIS_DATA_PATH export REDIS_DATA_PATH
if [[ -z "${REDIS_AOF_PERSISTENCE:-}" ]]; then if [[ -z "${REDIS_AOF_PERSISTENCE:-}" ]]; then
echo "WARNING: the value of REDIS_AOF_PERSISTENCE is not set in config/overleaf.rc" if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then
echo " See https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#redis-aof-persistence-enabled-by-default" echo "WARNING: the value of REDIS_AOF_PERSISTENCE is not set in config/overleaf.rc"
echo " See https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#redis-aof-persistence-enabled-by-default"
fi
REDIS_COMMAND="redis-server" REDIS_COMMAND="redis-server"
elif [[ $REDIS_AOF_PERSISTENCE == "true" ]]; then elif [[ $REDIS_AOF_PERSISTENCE == "true" ]]; then
REDIS_COMMAND="redis-server --appendonly yes" REDIS_COMMAND="redis-server --appendonly yes"
@ -219,7 +225,9 @@ function docker_compose() {
exec docker compose "${flags[@]}" exec docker compose "${flags[@]}"
elif command -v docker-compose >/dev/null; then elif command -v docker-compose >/dev/null; then
# Fall back to docker-compose v1 # Fall back to docker-compose v1
echo "WARNING: docker-compose v1 has reached its End Of Life in July 2023 (https://docs.docker.com/compose/migrate/). Support for docker-compose v1 in the Overleaf Toolkit will be dropped with the release of Server Pro 5.2. We recommend upgrading to Docker Compose v2 before then." >&2 if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then
echo "WARNING: docker-compose v1 has reached its End Of Life in July 2023 (https://docs.docker.com/compose/migrate/). Support for docker-compose v1 in the Overleaf Toolkit will be dropped with the release of Server Pro 5.2. We recommend upgrading to Docker Compose v2 before then." >&2
fi
exec docker-compose "${flags[@]}" exec docker-compose "${flags[@]}"
else else
echo "ERROR: Could not find Docker Compose." >&2 echo "ERROR: Could not find Docker Compose." >&2

8
bin/up
View file

@ -37,8 +37,8 @@ function check_config() {
function initiate_mongo_replica_set() { function initiate_mongo_replica_set() {
echo "Initiating Mongo replica set..." echo "Initiating Mongo replica set..."
SKIP_WARNINGS=true "$TOOLKIT_ROOT/bin/docker-compose" up -d mongo env SKIP_WARNINGS=true "$TOOLKIT_ROOT/bin/docker-compose" up -d mongo
SKIP_WARNINGS=true "$TOOLKIT_ROOT/bin/docker-compose" exec -T mongo sh -c ' env SKIP_WARNINGS=true "$TOOLKIT_ROOT/bin/docker-compose" exec -T mongo sh -c '
while ! '$MONGOSH' --eval "db.version()" > /dev/null; do while ! '$MONGOSH' --eval "db.version()" > /dev/null; do
echo "Waiting for Mongo..." echo "Waiting for Mongo..."
sleep 1 sleep 1
@ -76,7 +76,7 @@ function __main__() {
fi fi
read_image_version read_image_version
read_mongo_version SKIP_WARNINGS=true read_mongo_version
check_config check_config
read_config read_config
@ -88,7 +88,7 @@ function __main__() {
pull_sandboxed_compiles pull_sandboxed_compiles
fi fi
exec env SKIP_WARNINGS=true "$TOOLKIT_ROOT/bin/docker-compose" up "$@" exec "$TOOLKIT_ROOT/bin/docker-compose" up "$@"
} }
__main__ "$@" __main__ "$@"

View file

@ -26,7 +26,7 @@ function read_mongo_version() {
if [[ "$mongo_image" =~ ^mongo:([0-9]+)\.(.*)$ ]]; then if [[ "$mongo_image" =~ ^mongo:([0-9]+)\.(.*)$ ]]; then
# when running a chain of commands (example: bin/up -> bin/docker-compose) we're passing # when running a chain of commands (example: bin/up -> bin/docker-compose) we're passing
# SKIP_WARNINGS=true to prevent the warning message to be printed several times # SKIP_WARNINGS=true to prevent the warning message to be printed several times
if [[ -z ${SKIP_WARNINGS:-} ]]; then if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then
echo "------------------- WARNING ----------------------" echo "------------------- WARNING ----------------------"
echo " Deprecation warning: the mongo image is now split between MONGO_IMAGE" echo " Deprecation warning: the mongo image is now split between MONGO_IMAGE"
echo " and MONGO_VERSION configurations. Please update your config/overleaf.rc as" echo " and MONGO_VERSION configurations. Please update your config/overleaf.rc as"