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

246 lines
8.3 KiB
Text
Raw Permalink Normal View History

2020-06-02 14:20:23 +01:00
#! /usr/bin/env bash
# shellcheck source-path=..
2020-06-02 14:20:23 +01:00
set -euo pipefail
#### Detect Toolkit Project Root ####
# if realpath is not available, create a semi-equivalent function
command -v realpath >/dev/null 2>&1 || realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")"
SCRIPT_DIR="$(dirname "$SCRIPT_PATH")"
TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")"
if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then
echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')"
exit 1
fi
source "$TOOLKIT_ROOT/lib/shared-functions.sh"
function build_environment() {
canonicalize_data_paths
set_base_vars
2020-06-02 14:20:23 +01:00
if [[ $REDIS_ENABLED == "true" ]]; then
set_redis_vars
2020-06-02 14:20:23 +01:00
fi
if [[ $MONGO_ENABLED == "true" ]]; then
set_mongo_vars
2020-06-02 14:20:23 +01:00
fi
if [[ "$SIBLING_CONTAINERS_ENABLED" == "true" ]]; then
if [[ $SERVER_PRO == "true" ]]; then
set_sibling_containers_vars
else
if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then
echo "WARNING: SIBLING_CONTAINERS_ENABLED=true is not supported in Overleaf Community Edition." >&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 " 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 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
2020-06-02 14:20:23 +01:00
fi
if [[ "${OVERLEAF_LOG_PATH:-null}" != "null" ]]; then
set_logging_vars
fi
if [[ $NGINX_ENABLED == "true" ]]; then
set_nginx_vars
2021-04-08 11:56:10 +01:00
fi
if [[ $GIT_BRIDGE_ENABLED == "true" ]]; then
set_git_bridge_vars
fi
2020-06-02 14:20:23 +01:00
# Include docker-compose.override.yml if it is present
if [[ -f "$TOOLKIT_ROOT/config/docker-compose.override.yml" ]]; then
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/config/docker-compose.override.yml")
2020-06-02 14:20:23 +01:00
fi
}
2020-06-02 14:20:23 +01:00
function canonicalize_data_paths() {
Scripts to update config/overleaf.rc and config-seed rebrand (#217) * Add scripts to rebrand variables.env and overleaf.rc * Update bin/upgrade to prompt for config file rebrand * Update bin/up to check for correct variable prefix Ensures SHARELATEX_ is in place for version <= 4.x, and OVERLEAF_ for version >= 5.x * Rebrand variables for bin/docker-compose Updates docker-compose.base.yml and sibling containers base file with the changes in the script * Update bin/doctor to support OVERLEAF_ prefix * Update documentation with the OVERLEAF_ prefix * Rebrand variables.env and overleaf.rc in config-seed * Prepare config/version and CHANGELOG for release (WIP) * Fix script documentation Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Fix doctor logs Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove unnecessary fallbacks to SHARELATEX_ vars * SEt OVERLEAF_DATA_PATH to data/overleaf * Remove duplicated environment entries * Moved prefix brand checs from bin/up to bin/docker-compose * Move set +o pipefail into subshell commands * Use separate legacy compose files for required SHARELATEX_ vars * Handle overleaf.rc rebranding before version upgrade * Group output from rebranding process * Move prompt for rebranding into helper function * Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs * Print expected prefix when checking variables.env * Print number of mismatching variables in overleaf.rc * Check on variable rebranding from bin/doctor * Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc * Update filesystem paths in bin/logs and docs * Flag old TEXMFVAR entry in config/variables.env REF: 1829e7ee2aa2c523a44cb1ea1f9639fcbd53caa1 * Update config-seed version to 5.0.1 and changelog --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00
OVERLEAF_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$OVERLEAF_DATA_PATH")
if [[ "${OVERLEAF_LOG_PATH:-null}" != "null" ]]; then
OVERLEAF_LOG_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$OVERLEAF_LOG_PATH")
fi
2020-06-02 14:20:23 +01:00
MONGO_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$MONGO_DATA_PATH")
REDIS_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$REDIS_DATA_PATH")
GIT_BRIDGE_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$GIT_BRIDGE_DATA_PATH")
}
# Set environment variables for docker-compose.base.yml
function set_base_vars() {
DOCKER_COMPOSE_FLAGS=(-f "$TOOLKIT_ROOT/lib/docker-compose.base.yml")
Scripts to update config/overleaf.rc and config-seed rebrand (#217) * Add scripts to rebrand variables.env and overleaf.rc * Update bin/upgrade to prompt for config file rebrand * Update bin/up to check for correct variable prefix Ensures SHARELATEX_ is in place for version <= 4.x, and OVERLEAF_ for version >= 5.x * Rebrand variables for bin/docker-compose Updates docker-compose.base.yml and sibling containers base file with the changes in the script * Update bin/doctor to support OVERLEAF_ prefix * Update documentation with the OVERLEAF_ prefix * Rebrand variables.env and overleaf.rc in config-seed * Prepare config/version and CHANGELOG for release (WIP) * Fix script documentation Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Fix doctor logs Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove unnecessary fallbacks to SHARELATEX_ vars * SEt OVERLEAF_DATA_PATH to data/overleaf * Remove duplicated environment entries * Moved prefix brand checs from bin/up to bin/docker-compose * Move set +o pipefail into subshell commands * Use separate legacy compose files for required SHARELATEX_ vars * Handle overleaf.rc rebranding before version upgrade * Group output from rebranding process * Move prompt for rebranding into helper function * Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs * Print expected prefix when checking variables.env * Print number of mismatching variables in overleaf.rc * Check on variable rebranding from bin/doctor * Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc * Update filesystem paths in bin/logs and docs * Flag old TEXMFVAR entry in config/variables.env REF: 1829e7ee2aa2c523a44cb1ea1f9639fcbd53caa1 * Update config-seed version to 5.0.1 and changelog --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00
if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.vars-legacy.yml")
else
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.vars.yml")
fi
set_server_pro_image_name "$IMAGE_VERSION"
2021-07-07 12:51:05 +02:00
Scripts to update config/overleaf.rc and config-seed rebrand (#217) * Add scripts to rebrand variables.env and overleaf.rc * Update bin/upgrade to prompt for config file rebrand * Update bin/up to check for correct variable prefix Ensures SHARELATEX_ is in place for version <= 4.x, and OVERLEAF_ for version >= 5.x * Rebrand variables for bin/docker-compose Updates docker-compose.base.yml and sibling containers base file with the changes in the script * Update bin/doctor to support OVERLEAF_ prefix * Update documentation with the OVERLEAF_ prefix * Rebrand variables.env and overleaf.rc in config-seed * Prepare config/version and CHANGELOG for release (WIP) * Fix script documentation Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Fix doctor logs Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove unnecessary fallbacks to SHARELATEX_ vars * SEt OVERLEAF_DATA_PATH to data/overleaf * Remove duplicated environment entries * Moved prefix brand checs from bin/up to bin/docker-compose * Move set +o pipefail into subshell commands * Use separate legacy compose files for required SHARELATEX_ vars * Handle overleaf.rc rebranding before version upgrade * Group output from rebranding process * Move prompt for rebranding into helper function * Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs * Print expected prefix when checking variables.env * Print number of mismatching variables in overleaf.rc * Check on variable rebranding from bin/doctor * Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc * Update filesystem paths in bin/logs and docs * Flag old TEXMFVAR entry in config/variables.env REF: 1829e7ee2aa2c523a44cb1ea1f9639fcbd53caa1 * Update config-seed version to 5.0.1 and changelog --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00
if [[ ${OVERLEAF_LISTEN_IP:-null} == "null" ]];
then
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
Scripts to update config/overleaf.rc and config-seed rebrand (#217) * Add scripts to rebrand variables.env and overleaf.rc * Update bin/upgrade to prompt for config file rebrand * Update bin/up to check for correct variable prefix Ensures SHARELATEX_ is in place for version <= 4.x, and OVERLEAF_ for version >= 5.x * Rebrand variables for bin/docker-compose Updates docker-compose.base.yml and sibling containers base file with the changes in the script * Update bin/doctor to support OVERLEAF_ prefix * Update documentation with the OVERLEAF_ prefix * Rebrand variables.env and overleaf.rc in config-seed * Prepare config/version and CHANGELOG for release (WIP) * Fix script documentation Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Fix doctor logs Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove unnecessary fallbacks to SHARELATEX_ vars * SEt OVERLEAF_DATA_PATH to data/overleaf * Remove duplicated environment entries * Moved prefix brand checs from bin/up to bin/docker-compose * Move set +o pipefail into subshell commands * Use separate legacy compose files for required SHARELATEX_ vars * Handle overleaf.rc rebranding before version upgrade * Group output from rebranding process * Move prompt for rebranding into helper function * Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs * Print expected prefix when checking variables.env * Print number of mismatching variables in overleaf.rc * Check on variable rebranding from bin/doctor * Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc * Update filesystem paths in bin/logs and docs * Flag old TEXMFVAR entry in config/variables.env REF: 1829e7ee2aa2c523a44cb1ea1f9639fcbd53caa1 * Update config-seed version to 5.0.1 and changelog --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00
OVERLEAF_LISTEN_IP="0.0.0.0"
fi
Scripts to update config/overleaf.rc and config-seed rebrand (#217) * Add scripts to rebrand variables.env and overleaf.rc * Update bin/upgrade to prompt for config file rebrand * Update bin/up to check for correct variable prefix Ensures SHARELATEX_ is in place for version <= 4.x, and OVERLEAF_ for version >= 5.x * Rebrand variables for bin/docker-compose Updates docker-compose.base.yml and sibling containers base file with the changes in the script * Update bin/doctor to support OVERLEAF_ prefix * Update documentation with the OVERLEAF_ prefix * Rebrand variables.env and overleaf.rc in config-seed * Prepare config/version and CHANGELOG for release (WIP) * Fix script documentation Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Fix doctor logs Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove unnecessary fallbacks to SHARELATEX_ vars * SEt OVERLEAF_DATA_PATH to data/overleaf * Remove duplicated environment entries * Moved prefix brand checs from bin/up to bin/docker-compose * Move set +o pipefail into subshell commands * Use separate legacy compose files for required SHARELATEX_ vars * Handle overleaf.rc rebranding before version upgrade * Group output from rebranding process * Move prompt for rebranding into helper function * Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs * Print expected prefix when checking variables.env * Print number of mismatching variables in overleaf.rc * Check on variable rebranding from bin/doctor * Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc * Update filesystem paths in bin/logs and docs * Flag old TEXMFVAR entry in config/variables.env REF: 1829e7ee2aa2c523a44cb1ea1f9639fcbd53caa1 * Update config-seed version to 5.0.1 and changelog --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00
export OVERLEAF_LISTEN_IP
HAS_WEB_API=false
if [[ $IMAGE_VERSION_MAJOR -gt 4 ]]; then
HAS_WEB_API=true
elif [[ $IMAGE_VERSION_MAJOR == 4 && $IMAGE_VERSION_MINOR -ge 2 ]]; then
HAS_WEB_API=true
fi
Scripts to update config/overleaf.rc and config-seed rebrand (#217) * Add scripts to rebrand variables.env and overleaf.rc * Update bin/upgrade to prompt for config file rebrand * Update bin/up to check for correct variable prefix Ensures SHARELATEX_ is in place for version <= 4.x, and OVERLEAF_ for version >= 5.x * Rebrand variables for bin/docker-compose Updates docker-compose.base.yml and sibling containers base file with the changes in the script * Update bin/doctor to support OVERLEAF_ prefix * Update documentation with the OVERLEAF_ prefix * Rebrand variables.env and overleaf.rc in config-seed * Prepare config/version and CHANGELOG for release (WIP) * Fix script documentation Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Fix doctor logs Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove unnecessary fallbacks to SHARELATEX_ vars * SEt OVERLEAF_DATA_PATH to data/overleaf * Remove duplicated environment entries * Moved prefix brand checs from bin/up to bin/docker-compose * Move set +o pipefail into subshell commands * Use separate legacy compose files for required SHARELATEX_ vars * Handle overleaf.rc rebranding before version upgrade * Group output from rebranding process * Move prompt for rebranding into helper function * Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs * Print expected prefix when checking variables.env * Print number of mismatching variables in overleaf.rc * Check on variable rebranding from bin/doctor * Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc * Update filesystem paths in bin/logs and docs * Flag old TEXMFVAR entry in config/variables.env REF: 1829e7ee2aa2c523a44cb1ea1f9639fcbd53caa1 * Update config-seed version to 5.0.1 and changelog --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00
OVERLEAF_IN_CONTAINER_DATA_PATH=/var/lib/overleaf
if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then
OVERLEAF_IN_CONTAINER_DATA_PATH=/var/lib/sharelatex
fi
export GIT_BRIDGE_ENABLED
export MONGO_URL
export REDIS_HOST
export REDIS_PORT
Scripts to update config/overleaf.rc and config-seed rebrand (#217) * Add scripts to rebrand variables.env and overleaf.rc * Update bin/upgrade to prompt for config file rebrand * Update bin/up to check for correct variable prefix Ensures SHARELATEX_ is in place for version <= 4.x, and OVERLEAF_ for version >= 5.x * Rebrand variables for bin/docker-compose Updates docker-compose.base.yml and sibling containers base file with the changes in the script * Update bin/doctor to support OVERLEAF_ prefix * Update documentation with the OVERLEAF_ prefix * Rebrand variables.env and overleaf.rc in config-seed * Prepare config/version and CHANGELOG for release (WIP) * Fix script documentation Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Fix doctor logs Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove unnecessary fallbacks to SHARELATEX_ vars * SEt OVERLEAF_DATA_PATH to data/overleaf * Remove duplicated environment entries * Moved prefix brand checs from bin/up to bin/docker-compose * Move set +o pipefail into subshell commands * Use separate legacy compose files for required SHARELATEX_ vars * Handle overleaf.rc rebranding before version upgrade * Group output from rebranding process * Move prompt for rebranding into helper function * Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs * Print expected prefix when checking variables.env * Print number of mismatching variables in overleaf.rc * Check on variable rebranding from bin/doctor * Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc * Update filesystem paths in bin/logs and docs * Flag old TEXMFVAR entry in config/variables.env REF: 1829e7ee2aa2c523a44cb1ea1f9639fcbd53caa1 * Update config-seed version to 5.0.1 and changelog --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00
export OVERLEAF_DATA_PATH
export OVERLEAF_PORT
export OVERLEAF_IN_CONTAINER_DATA_PATH
}
# Set environment variables for docker-compose.redis.yml
function set_redis_vars() {
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.redis.yml")
export REDIS_IMAGE
export REDIS_DATA_PATH
if [[ -z "${REDIS_AOF_PERSISTENCE:-}" ]]; then
if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then
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"
elif [[ $REDIS_AOF_PERSISTENCE == "true" ]]; then
REDIS_COMMAND="redis-server --appendonly yes"
else
REDIS_COMMAND="redis-server"
fi
export REDIS_COMMAND
}
# Set environment variables for docker-compose.mongo.yml
function set_mongo_vars() {
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.mongo.yml")
if [[ $MONGO_ENABLED == "true" && $IMAGE_VERSION_MAJOR -ge 4 ]]; then
MONGO_ARGS="--replSet overleaf"
else
MONGO_ARGS=""
fi
export MONGO_ARGS
2020-06-02 14:20:23 +01:00
export MONGO_DATA_PATH
2024-07-16 15:50:42 +02:00
export MONGO_DOCKER_IMAGE
export MONGOSH
}
# Set environment variables for docker-compose.sibling-containers.yml
function set_sibling_containers_vars() {
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.sibling-containers.yml")
export DOCKER_SOCKET_PATH
Scripts to update config/overleaf.rc and config-seed rebrand (#217) * Add scripts to rebrand variables.env and overleaf.rc * Update bin/upgrade to prompt for config file rebrand * Update bin/up to check for correct variable prefix Ensures SHARELATEX_ is in place for version <= 4.x, and OVERLEAF_ for version >= 5.x * Rebrand variables for bin/docker-compose Updates docker-compose.base.yml and sibling containers base file with the changes in the script * Update bin/doctor to support OVERLEAF_ prefix * Update documentation with the OVERLEAF_ prefix * Rebrand variables.env and overleaf.rc in config-seed * Prepare config/version and CHANGELOG for release (WIP) * Fix script documentation Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Fix doctor logs Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove unnecessary fallbacks to SHARELATEX_ vars * SEt OVERLEAF_DATA_PATH to data/overleaf * Remove duplicated environment entries * Moved prefix brand checs from bin/up to bin/docker-compose * Move set +o pipefail into subshell commands * Use separate legacy compose files for required SHARELATEX_ vars * Handle overleaf.rc rebranding before version upgrade * Group output from rebranding process * Move prompt for rebranding into helper function * Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs * Print expected prefix when checking variables.env * Print number of mismatching variables in overleaf.rc * Check on variable rebranding from bin/doctor * Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc * Update filesystem paths in bin/logs and docs * Flag old TEXMFVAR entry in config/variables.env REF: 1829e7ee2aa2c523a44cb1ea1f9639fcbd53caa1 * Update config-seed version to 5.0.1 and changelog --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00
export OVERLEAF_DATA_PATH
}
# Set environment variables for docker-compose.logging.yml
function set_logging_vars() {
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.logging.yml")
if [[ $IMAGE_VERSION_MAJOR -ge 5 ]]; then
OVERLEAF_IN_CONTAINER_LOG_PATH="/var/log/overleaf"
else
OVERLEAF_IN_CONTAINER_LOG_PATH="/var/log/sharelatex"
fi
export OVERLEAF_IN_CONTAINER_LOG_PATH
export OVERLEAF_LOG_PATH
}
# Set environment variables for docker-compose.nginx.yml
function set_nginx_vars() {
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.nginx.yml")
if [[ -n ${TLS_PRIVATE_KEY_PATH-} ]]; then
TLS_PRIVATE_KEY_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$TLS_PRIVATE_KEY_PATH")
fi
if [[ -n ${TLS_CERTIFICATE_PATH-} ]]; then
TLS_CERTIFICATE_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$TLS_CERTIFICATE_PATH")
fi
if [[ -n ${NGINX_CONFIG_PATH-} ]]; then
NGINX_CONFIG_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$NGINX_CONFIG_PATH")
fi
2021-04-26 09:15:34 +01:00
export NGINX_CONFIG_PATH
export NGINX_IMAGE
export NGINX_HTTP_PORT
export NGINX_HTTP_LISTEN_IP
export NGINX_TLS_LISTEN_IP
2021-04-22 09:35:40 +01:00
export TLS_CERTIFICATE_PATH
export TLS_PORT
2021-04-26 09:15:34 +01:00
export TLS_PRIVATE_KEY_PATH
}
# Set environment variables for docker-compose.git-bridge.yml
function set_git_bridge_vars() {
set_git_bridge_image_name "$IMAGE_VERSION"
GIT_BRIDGE_API_BASE_URL="http://sharelatex/api/v0/"
if [[ $HAS_WEB_API == "true" ]]; then
GIT_BRIDGE_API_BASE_URL="http://sharelatex:3000/api/v0/"
fi
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.git-bridge.yml")
export GIT_BRIDGE_API_BASE_URL
export GIT_BRIDGE_DATA_PATH
export GIT_BRIDGE_LOG_LEVEL
}
function print_debug_info() {
if [[ ${RC_DEBUG:-null} != "null" ]]; then
echo ">>>>>>VARS>>>>>>"
echo "$(set -o posix; set)" # print all vars
echo "IMAGE_VERSION=$IMAGE_VERSION"
echo "<<<<<<<<<<<<<<<<"
echo ">>>>COMPOSE-ARGS>>>>"
echo "-p $PROJECT_NAME"
echo "${DOCKER_COMPOSE_FLAGS[@]}"
echo "$@"
echo "<<<<<<<<<<<<<<<<<<<<"
fi
}
2020-06-02 14:20:23 +01:00
function docker_compose() {
local flags=(-p "$PROJECT_NAME" "${DOCKER_COMPOSE_FLAGS[@]}" "$@")
if docker compose version >/dev/null 2>&1; then
# Docker compose v2 is available
exec docker compose "${flags[@]}"
elif command -v docker-compose >/dev/null; then
# Fall back to docker-compose v1
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[@]}"
else
echo "ERROR: Could not find Docker Compose." >&2
exit 1
fi
}
read_image_version
2024-07-16 15:50:42 +02:00
read_mongo_version
read_config
2024-04-18 08:50:29 +01:00
check_retracted_version
Scripts to update config/overleaf.rc and config-seed rebrand (#217) * Add scripts to rebrand variables.env and overleaf.rc * Update bin/upgrade to prompt for config file rebrand * Update bin/up to check for correct variable prefix Ensures SHARELATEX_ is in place for version <= 4.x, and OVERLEAF_ for version >= 5.x * Rebrand variables for bin/docker-compose Updates docker-compose.base.yml and sibling containers base file with the changes in the script * Update bin/doctor to support OVERLEAF_ prefix * Update documentation with the OVERLEAF_ prefix * Rebrand variables.env and overleaf.rc in config-seed * Prepare config/version and CHANGELOG for release (WIP) * Fix script documentation Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Fix doctor logs Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com> * Remove unnecessary fallbacks to SHARELATEX_ vars * SEt OVERLEAF_DATA_PATH to data/overleaf * Remove duplicated environment entries * Moved prefix brand checs from bin/up to bin/docker-compose * Move set +o pipefail into subshell commands * Use separate legacy compose files for required SHARELATEX_ vars * Handle overleaf.rc rebranding before version upgrade * Group output from rebranding process * Move prompt for rebranding into helper function * Refuse to start with mismatching ShareLaTeX vs Overleaf branded configs * Print expected prefix when checking variables.env * Print number of mismatching variables in overleaf.rc * Check on variable rebranding from bin/doctor * Cleanup bin/doctor lookup for ShareLaTeX branded overleaf.rc * Update filesystem paths in bin/logs and docs * Flag old TEXMFVAR entry in config/variables.env REF: 1829e7ee2aa2c523a44cb1ea1f9639fcbd53caa1 * Update config-seed version to 5.0.1 and changelog --------- Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
2024-04-02 16:43:08 +02:00
check_sharelatex_env_vars
build_environment
print_debug_info "$@"
docker_compose "$@"