1
0
Fork 0
mirror of https://github.com/overleaf/toolkit.git synced 2025-04-18 14:58:21 +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: 1829e7ee2a

* Update config-seed version to 5.0.1 and changelog

---------

Co-authored-by: Jakob Ackermann <jakob.ackermann@overleaf.com>
This commit is contained in:
Miguel Serrano 2024-04-02 16:43:08 +02:00 committed by GitHub
parent a9db501268
commit e2b99f150f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 397 additions and 168 deletions

View file

@ -1,5 +1,14 @@
# Changelog
## 2024-04-02
### Added
- Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.0.1`.
:warning: This is a major release. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#server-pro-501) for details.
- Rebranded 'SHARELATEX_' variables to 'OVERLEAF_'
## 2024-02-27
### Fixed

View file

@ -45,7 +45,7 @@ function build_environment() {
}
function canonicalize_data_paths() {
SHARELATEX_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$SHARELATEX_DATA_PATH")
OVERLEAF_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$OVERLEAF_DATA_PATH")
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")
@ -54,10 +54,15 @@ function canonicalize_data_paths() {
# Set environment variables for docker-compose.base.yml
function set_base_vars() {
DOCKER_COMPOSE_FLAGS=(-f "$TOOLKIT_ROOT/lib/docker-compose.base.yml")
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
local image_name
if [[ -n ${SHARELATEX_IMAGE_NAME:-} ]]; then
image_name="$SHARELATEX_IMAGE_NAME"
if [[ -n ${OVERLEAF_IMAGE_NAME:-} ]]; then
image_name="$OVERLEAF_IMAGE_NAME"
elif [[ $SERVER_PRO == "true" ]]; then
image_name="quay.io/sharelatex/sharelatex-pro"
else
@ -65,12 +70,12 @@ function set_base_vars() {
fi
export IMAGE="$image_name:$IMAGE_VERSION"
if [[ ${SHARELATEX_LISTEN_IP:-null} == "null" ]];
if [[ ${OVERLEAF_LISTEN_IP:-null} == "null" ]];
then
echo "WARNING: the value of SHARELATEX_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
SHARELATEX_LISTEN_IP="0.0.0.0"
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
OVERLEAF_LISTEN_IP="0.0.0.0"
fi
export SHARELATEX_LISTEN_IP
export OVERLEAF_LISTEN_IP
if [[ $SERVER_PRO != "true" || $IMAGE_VERSION_MAJOR -lt 4 ]]; then
# Force git bridge to be disabled if not ServerPro >= 4
@ -84,12 +89,19 @@ function set_base_vars() {
HAS_WEB_API=true
fi
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
export SHARELATEX_DATA_PATH
export SHARELATEX_PORT
export OVERLEAF_DATA_PATH
export OVERLEAF_PORT
export OVERLEAF_IN_CONTAINER_DATA_PATH
}
# Set environment variables for docker-compose.redis.yml
@ -118,7 +130,7 @@ function set_mongo_vars() {
function set_sibling_containers_vars() {
DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.sibling-containers.yml")
export DOCKER_SOCKET_PATH
export SHARELATEX_DATA_PATH
export OVERLEAF_DATA_PATH
}
# Set environment variables for docker-compose.nginx.yml
@ -196,6 +208,7 @@ function docker_compose() {
read_image_version
read_config
check_sharelatex_env_vars
build_environment
print_debug_info "$@"
docker_compose "$@"

View file

@ -15,6 +15,8 @@ if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then
exit 1
fi
source "$TOOLKIT_ROOT/lib/shared-functions.sh"
SPACES_PER_INDENT=4
WARNINGS_FILE="$(mktemp)"
@ -185,11 +187,11 @@ function check_config_files() {
source "$TOOLKIT_ROOT/$config_file"
# Check some vars from the RC file
if [[ "${SHARELATEX_DATA_PATH:-null}" != "null" ]]; then
print_point 2 "SHARELATEX_DATA_PATH: $SHARELATEX_DATA_PATH"
if [[ "${OVERLEAF_DATA_PATH:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_DATA_PATH: $OVERLEAF_DATA_PATH"
else
print_point 2 "SHARELATEX_DATA_PATH: MISSING !"
add_warning "rc file, SHARELATEX_DATA_PATH not set"
print_point 2 "OVERLEAF_DATA_PATH: MISSING !"
add_warning "rc file, OVERLEAF_DATA_PATH not set"
fi
print_point 2 "SERVER_PRO: $SERVER_PRO"
@ -209,11 +211,11 @@ function check_config_files() {
fi
print_point 2 "SIBLING_CONTAINERS_ENABLED: $SIBLING_CONTAINERS_ENABLED"
fi
if [[ "${SHARELATEX_LISTEN_IP:-null}" != "null" ]]; then
print_point 2 "SHARELATEX_LISTEN_IP: ${SHARELATEX_LISTEN_IP}"
if [[ "${OVERLEAF_LISTEN_IP:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_LISTEN_IP: ${OVERLEAF_LISTEN_IP}"
fi
if [[ "${SHARELATEX_PORT:-null}" != "null" ]]; then
print_point 2 "SHARELATEX_PORT: ${SHARELATEX_PORT}"
if [[ "${OVERLEAF_PORT:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_PORT: ${OVERLEAF_PORT}"
fi
print_point 2 "MONGO_ENABLED: $MONGO_ENABLED"
@ -353,6 +355,87 @@ function check_config_files() {
else
print_point 2 "SHARELATEX_HISTORY_BACKEND: fs"
fi
if [[ "${OVERLEAF_FILESTORE_BACKEND:-fs}" == "s3" ]]; then
print_point 2 "OVERLEAF_FILESTORE_BACKEND: s3"
if [[ "${OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME: $OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME"
else
add_warning "OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME is unset"
fi
if [[ "${OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME: $OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME"
else
add_warning "OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME is unset"
fi
if [[ "${OVERLEAF_FILESTORE_S3_ENDPOINT:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_FILESTORE_S3_ENDPOINT: [set here]"
else
print_point 2 "OVERLEAF_FILESTORE_S3_ENDPOINT: Using AWS S3"
fi
if [[ "${OVERLEAF_FILESTORE_S3_PATH_STYLE:-null}" == "true" ]]; then
print_point 2 "OVERLEAF_FILESTORE_S3_PATH_STYLE: true"
else
print_point 2 "OVERLEAF_FILESTORE_S3_PATH_STYLE: false"
fi
if [[ "${OVERLEAF_FILESTORE_S3_REGION:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_FILESTORE_S3_REGION: $OVERLEAF_FILESTORE_S3_REGION"
else
print_point 2 "OVERLEAF_FILESTORE_S3_REGION: <unset>"
fi
if [[ "${OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID: [set here]"
else
add_warning "OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID is missing"
fi
if [[ "${OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY: [set here]"
else
add_warning "OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY is missing"
fi
else
print_point 2 "OVERLEAF_FILESTORE_BACKEND: fs"
fi
if [[ "${OVERLEAF_HISTORY_BACKEND:-fs}" == "s3" ]]; then
print_point 2 "OVERLEAF_HISTORY_BACKEND: s3"
if [[ "${OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET: $OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET"
else
add_warning "OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET is unset"
fi
if [[ "${OVERLEAF_HISTORY_CHUNKS_BUCKET:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_HISTORY_CHUNKS_BUCKET: $OVERLEAF_HISTORY_CHUNKS_BUCKET"
else
add_warning "OVERLEAF_HISTORY_CHUNKS_BUCKET is unset"
fi
if [[ "${OVERLEAF_HISTORY_S3_ENDPOINT:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_HISTORY_S3_ENDPOINT: [set here]"
else
print_point 2 "OVERLEAF_HISTORY_S3_ENDPOINT: Using AWS S3"
fi
if [[ "${OVERLEAF_HISTORY_S3_PATH_STYLE:-null}" == "true" ]]; then
print_point 2 "OVERLEAF_HISTORY_S3_PATH_STYLE: true"
else
print_point 2 "OVERLEAF_HISTORY_S3_PATH_STYLE: false"
fi
if [[ "${OVERLEAF_HISTORY_S3_REGION:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_HISTORY_S3_REGION: $OVERLEAF_HISTORY_S3_REGION"
else
print_point 2 "OVERLEAF_HISTORY_S3_REGION: <unset>"
fi
if [[ "${OVERLEAF_HISTORY_S3_ACCESS_KEY_ID:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_HISTORY_S3_ACCESS_KEY_ID: [set here]"
else
add_warning "OVERLEAF_HISTORY_S3_ACCESS_KEY_ID is missing"
fi
if [[ "${OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY:-null}" != "null" ]]; then
print_point 2 "OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY: [set here]"
else
add_warning "OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY is missing"
fi
else
print_point 2 "OVERLEAF_HISTORY_BACKEND: fs"
fi
fi
fi
done
@ -363,7 +446,9 @@ function cleanup() {
}
function __main__() {
read_image_version
print_section_separator "Overleaf Doctor"
check_sharelatex_env_vars
check_host_information
check_dependencies
check_docker_daemon

View file

@ -15,6 +15,8 @@ if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then
exit 1
fi
source "$TOOLKIT_ROOT/lib/shared-functions.sh"
DEFAULT_TAIL_LINES=20
ALL_SERVICES=(chat clsi contacts docstore document-updater filestore git-bridge \
mongo notifications real-time redis spelling tags track-changes web \
@ -127,8 +129,13 @@ function show_compose_logs() {
}
function show_sharelatex_logs() {
local base_path=/var/log/overleaf
if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then
base_path=/var/log/sharelatex
fi
local service="$1"
local log_path="/var/log/sharelatex/$service.log"
local log_path="${base_path}/$service.log"
local flags=()
if [[ $FOLLOW == "true" ]]; then
@ -152,4 +159,5 @@ function show_sharelatex_logs() {
}
parse_args "$@"
read_image_version
show_logs

View file

@ -19,9 +19,9 @@ fi
source "$TOOLKIT_ROOT/lib/shared-functions.sh"
function usage() {
echo "Usage: bin/update-env"
echo "Usage: bin/rename-env-vars-5-0"
echo ""
echo "Updates config/variables.env, adding new environment variables"
echo "Updates config/variables.env to ensure variables are renamed from 'SHARELATEX_' to 'OVERLEAF_'"
echo ""
}
@ -31,12 +31,10 @@ function __main__() {
exit
fi
# read_image_version
echo "This script will update your config/variables.env."
echo "We recommend backing up your config with bin/backup-config."
prompt "Do you want to continue?"
rebrand_sharelatex_env_variables
rebrand_sharelatex_env_variables 'variables.env'
echo "Done."
}

42
bin/rename-rc-vars Executable file
View file

@ -0,0 +1,42 @@
#! /usr/bin/env bash
# shellcheck source-path=..
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 usage() {
echo "Usage: bin/rename-rc-vars"
echo ""
echo "Updates config/overleaf.rc to ensure variables are renamed from 'SHARELATEX_' to 'OVERLEAF_'"
echo ""
}
function __main__() {
if [[ "${1:-null}" == "help" ]] || [[ "${1:-null}" == "--help" ]]; then
usage
exit
fi
echo "This script will update your config/overleaf.rc."
echo "We recommend backing up your config with bin/backup-config."
rebrand_sharelatex_env_variables 'overleaf.rc'
echo "Done."
}
__main__ "$@"

17
bin/up
View file

@ -35,22 +35,6 @@ function check_config() {
fi
}
function check_sharelatex_env_vars() {
local invalid_prefix="SHARELATEX_"
if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then
invalid_prefix="OVERLEAF_"
fi
if grep -q "$invalid_prefix" "$TOOLKIT_ROOT/config/variables.env"; then
echo "WARNING: some environment variables defined in config/variables.env"
echo "contain '$invalid_prefix' in their name"
echo "Starting with Overleaf CE and Server Pro 5.0.0 the environment variables"
echo "use the prefix 'OVERLEAF_' instead of 'SHARELATEX_'."
echo "Please check your config/version and config/variables.env files"
prompt "Do you want to continue?"
fi
}
function initiate_mongo_replica_set() {
echo "Initiating Mongo replica set..."
"$TOOLKIT_ROOT/bin/docker-compose" up -d mongo
@ -70,7 +54,6 @@ function __main__() {
read_image_version
check_config
check_sharelatex_env_vars
read_config
if [[ "$MONGO_ENABLED" == "true" && "$IMAGE_VERSION_MAJOR" -ge 4 ]]; then

View file

@ -170,10 +170,8 @@ function handle_image_upgrade() {
echo "Over-writing config/version with $SEED_IMAGE_VERSION"
cp "$TOOLKIT_ROOT/lib/config-seed/version" "$TOOLKIT_ROOT/config/version"
if [[ "$IMAGE_VERSION_MAJOR" -le 4 && "$SEED_IMAGE_VERSION_MAJOR" -ge 5 ]]; then
echo "Renaming environment variables in config/variables.env"
prompt "Proceed with the environment variable renaming?"
rebrand_sharelatex_env_variables
if [[ "$IMAGE_VERSION_MAJOR" -le 4 && "$SEED_IMAGE_VERSION_MAJOR" -ge 5 ]]; then
rebrand_sharelatex_env_variables 'variables.env'
fi
## Maybe offer to start services again
@ -224,6 +222,11 @@ function handle_git_update() {
fi
}
function handle_rc_rebranding() {
## Rename variables in overleaf.rc SHARELATEX_ -> OVERLEAF_
rebrand_sharelatex_env_variables 'overleaf.rc' silent_if_no_match
}
function __main__() {
if [[ "${1:-null}" == "help" ]] \
|| [[ "${1:-null}" == "--help" ]] ; then
@ -238,6 +241,7 @@ function __main__() {
read_seed_image_version
read_image_version
handle_rc_rebranding
handle_image_upgrade
echo "Done"

View file

@ -45,11 +45,12 @@ convenient scripts to automate common tasks:
Inside the overleaf container, the Overleaf software runs as a set of micro-services, managed by `runit`. Some of the more interesting files inside the container are:
- `/etc/service/`: initialisation files for the microservices
- `/etc/sharelatex/settings.coffee`: unified settings file for the microservices
- `/var/log/sharelatex/`: logs for each microservice
- `/var/www/sharelatex/`: code for the various microservices
- `/var/lib/sharelatex/`: the mount-point for persistent data (corresponds to the directory indicated by `SHARELATEX_DATA_PATH` on the host)
- `/etc/overleaf/settings.js`: unified settings file for the microservices
- `/var/log/overleaf/`: logs for each microservice
- `/var/www/overleaf/`: code for the various microservices
- `/var/lib/overleaf/`: the mount-point for persistent data (corresponds to the directory indicated by `OVERLEAF_DATA_PATH` on the host)
Before Server Pro/Community Edition version 5.0, the paths used the ShareLaTeX brand.
## The MongoDB and Redis Containers

View file

@ -11,7 +11,7 @@ EXTERNAL_AUTH=ldap
```
(To preserve backward compatibility with older configuration files, if
`EXTERNAL_AUTH` is not set, but `SHARELATEX_LDAP_URL` is set, then the LDAP
`EXTERNAL_AUTH` is not set, but `OVERLEAF_LDAP_URL` is set (`SHARELATEX_LDAP_URL` for versions `4.x` and older), then the LDAP
module will be activated. We still recommend setting `EXTERNAL_AUTH` explicitely)
After bootstrapping Server Pro for the first time with LDAP authentication, an existing LDAP user must be given admin permissions visiting `/launchpad` page (or [via CLI](https://github.com/overleaf/overleaf/wiki/Creating-and-managing-users#creating-the-first-admin-user), but in this case ignoring password confirmation).
@ -26,17 +26,18 @@ At Overleaf, we test the LDAP integration against a [test openldap server](https
```
# added to variables.env
# For versions of Overleaf CE/Server Pro `4.x` and older use the 'SHARELATEX_' prefix instead of 'OVERLEAF_'
EXTERNAL_AUTH=ldap
SHARELATEX_LDAP_URL=ldap://ldap:389
SHARELATEX_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com
SHARELATEX_LDAP_SEARCH_FILTER=(uid={{username}})
SHARELATEX_LDAP_BIND_DN=cn=admin,dc=planetexpress,dc=com
SHARELATEX_LDAP_BIND_CREDENTIALS=GoodNewsEveryone
SHARELATEX_LDAP_EMAIL_ATT=mail
SHARELATEX_LDAP_NAME_ATT=cn
SHARELATEX_LDAP_LAST_NAME_ATT=sn
SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN=true
OVERLEAF_LDAP_URL=ldap://ldap:389
OVERLEAF_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com
OVERLEAF_LDAP_SEARCH_FILTER=(uid={{username}})
OVERLEAF_LDAP_BIND_DN=cn=admin,dc=planetexpress,dc=com
OVERLEAF_LDAP_BIND_CREDENTIALS=GoodNewsEveryone
OVERLEAF_LDAP_EMAIL_ATT=mail
OVERLEAF_LDAP_NAME_ATT=cn
OVERLEAF_LDAP_LAST_NAME_ATT=sn
OVERLEAF_LDAP_UPDATE_USER_DETAILS_ON_LOGIN=true
```
The `openldap` needs to run in the same network as the `sharelatex` container (which by default would be `overleaf_default`), so we'll proceed with the following steps:

View file

@ -16,25 +16,25 @@ This is useful when running multiple instances of Overleaf on one host, as each
- Default: overleaf
### `SHARELATEX_DATA_PATH`
### `OVERLEAF_DATA_PATH`
Sets the path to the directory that will be mounted into the main `sharelatex` container, and used to store compile data. This can be either a full path (beginning with a `/`), or relative to the base directory of the toolkit.
- Default: data/sharelatex
### `SHARELATEX_LISTEN_IP`
### `OVERLEAF_LISTEN_IP`
Sets the host IP address(es) that the container will bind to. For example, if this is set to `0.0.0.0`, then the web interface will be available on any host IP address.
Since https://github.com/overleaf/toolkit/pull/77 the listen mode of the application container was changed to `localhost` only, so the value of `SHARELATEX_LISTEN_IP` must be set to the public IP address for direct container access.
Since https://github.com/overleaf/toolkit/pull/77 the listen mode of the application container was changed to `localhost` only, so the value of `OVERLEAF_LISTEN_IP` must be set to the public IP address for direct container access.
Setting `SHARELATEX_LISTEN_IP` to either `0.0.0.0` or the external IP of your host will typically cause errors when used in conjunction with the [TLS Proxy](tls-proxy.md).
Setting `OVERLEAF_LISTEN_IP` to either `0.0.0.0` or the external IP of your host will typically cause errors when used in conjunction with the [TLS Proxy](tls-proxy.md).
- Default: `127.0.0.1`
### `SHARELATEX_PORT`
### `OVERLEAF_PORT`
Sets the host port that the container will bind to. For example, if this is set to `8099` and `SHARELATEX_LISTEN_IP` is set to `127.0.0.1`, then the web interface will be available on `http://localhost:8099`.
Sets the host port that the container will bind to. For example, if this is set to `8099` and `OVERLEAF_LISTEN_IP` is set to `127.0.0.1`, then the web interface will be available on `http://localhost:8099`.
- Default: 80
@ -158,7 +158,7 @@ Sets the host port that the [TLS Proxy](tls-proxy.md) container will bind to for
Sets the host IP address(es) that the [TLS Proxy](tls-proxy.md) container will bind to for http redirect. For example, if this is set to `127.0.1.1` then http connections to `127.0.1.1` will be redirected to the https web interface.
Typically this should be set to the external IP of your host. Do not set it to `0.0.0.0` as this will typically cause a conflict with `SHARELATEX_LISTEN_IP`.
Typically this should be set to the external IP of your host. Do not set it to `0.0.0.0` as this will typically cause a conflict with `OVERLEAF_LISTEN_IP`.
- Default: `127.0.1.1`

View file

@ -5,7 +5,7 @@ The Overleaf Toolkit needs to store persistent data, such as the files required
## Data Directories
The Overleaf container requires a directory in which to store data relating to LaTeX compiles. This directory is set with the `SHARELATEX_DATA_PATH` variable in `config/overleaf.rc`.
The Overleaf container requires a directory in which to store data relating to LaTeX compiles. This directory is set with the `OVERLEAF_DATA_PATH` variable in `config/overleaf.rc`.
The MongoDB container, if it is enabled, requires a directory in which to store it's database files, and the same is true of the Redis container. These directories can also be configured in `config/overleaf.rc`.

View file

@ -11,7 +11,7 @@ EXTERNAL_AUTH=saml
```
(To preserve backward compatibility with older configuration files, if
`EXTERNAL_AUTH` is not set, but `SHARELATEX_SAML_ENTRYPOINT` is set, then the SAML
`EXTERNAL_AUTH` is not set, but `SHARELATEX_SAML_ENTRYPOINT` is set (`SHARELATEX_LDAP_URL` for versions `4.x` and older), then the SAML
module will be activated. We still recommend setting `EXTERNAL_AUTH` explicitely)
The [Developer wiki](https://github.com/overleaf/overleaf/wiki/Server-Pro:-SAML-Config) contains further documentation on the available Environment Variables and other configuration elements.
@ -22,16 +22,17 @@ At Overleaf, we test the SAML integration against a SAML test server. The follow
```
# added to variables.env
# For versions of Overleaf CE/Server Pro `4.x` and older use the 'SHARELATEX_' prefix instead of 'OVERLEAF_'
EXTERNAL_AUTH=saml
SHARELATEX_SAML_ENTRYPOINT=http://localhost:8081/simplesaml/saml2/idp/SSOService.php
SHARELATEX_SAML_CALLBACK_URL=http://saml/saml/callback
SHARELATEX_SAML_ISSUER=sharelatex-test-saml
SHARELATEX_SAML_IDENTITY_SERVICE_NAME=SAML Test Server
SHARELATEX_SAML_EMAIL_FIELD=email
SHARELATEX_SAML_FIRST_NAME_FIELD=givenName
SHARELATEX_SAML_LAST_NAME_FIELD=sn
SHARELATEX_SAML_UPDATE_USER_DETAILS_ON_LOGIN=true
OVERLEAF_SAML_ENTRYPOINT=http://localhost:8081/simplesaml/saml2/idp/SSOService.php
OVERLEAF_SAML_CALLBACK_URL=http://saml/saml/callback
OVERLEAF_SAML_ISSUER=sharelatex-test-saml
OVERLEAF_SAML_IDENTITY_SERVICE_NAME=SAML Test Server
OVERLEAF_SAML_EMAIL_FIELD=email
OVERLEAF_SAML_FIRST_NAME_FIELD=givenName
OVERLEAF_SAML_LAST_NAME_FIELD=sn
OVERLEAF_SAML_UPDATE_USER_DETAILS_ON_LOGIN=true
```
The `sharelatex/saml-test` image needs to run in the same network as the `sharelatex` container (which by default would be `overleaf_default`), so we'll proceed with the following steps:

View file

@ -7,9 +7,9 @@ In Server Pro, it is possible to have each LaTeX project be compiled in a separa
When sandboxed compiles are enabled, the toolkit will mount the docker socket from the host into the overleaf container, so that the compiler service in the container can create new docker containers on the host. Then for each run of the compiler in each project, the LaTeX compiler service (CLSI) will do the following:
- Write out the project files to a location inside the `SHARELATEX_DATA_PATH`,
- Write out the project files to a location inside the `OVERLEAF_DATA_PATH`,
- Use the mounted docker socket to create a new `texlive` container for the compile run
- Have the `texlive` container read the project data from the location under `SHARELATEX_DATA_PATH`
- Have the `texlive` container read the project data from the location under `OVERLEAF_DATA_PATH`
- Compile the project inside the `texlive` container

View file

@ -60,7 +60,7 @@ You will see some output like this:
- config/overleaf.rc
- status: present
- values
- SHARELATEX_DATA_PATH: data/sharelatex
- OVERLEAF_DATA_PATH: data/sharelatex
- SERVER_PRO: false
- MONGO_ENABLED: true
- REDIS_ENABLED: true
@ -110,7 +110,7 @@ The `Configuration` section contains information about the files in the `config/
- config/overleaf.rc
- status: present
- values
- SHARELATEX_DATA_PATH: /tmp/sharelatex
- OVERLEAF_DATA_PATH: /tmp/sharelatex
- SERVER_PRO: false
- MONGO_ENABLED: false
- REDIS_ENABLED: true
@ -120,7 +120,7 @@ The `Configuration` section contains information about the files in the `config/
The above example shows a few problems:
- The `SHARELATEX_DATA_PATH` variable is set to `/tmp/sharelatex`, which is probably not a safe place to put important data
- The `OVERLEAF_DATA_PATH` variable is set to `/tmp/sharelatex`, which is probably not a safe place to put important data
- The `MONGO_ENABLED` variable is set to `false`, so the toolkit will not provision it's own MongoDB database. In this case, we had better be sure to set `MONGO_URL` to point to a MongoDB database managed outside of the toolkit
- the `config/variables.env` file is missing
@ -133,7 +133,7 @@ The `Warnings` section shows a summary of problems discovered by the doctor scri
```
====== Warnings ======
- configuration file variables.env not found
- rc file, SHARELATEX_DATA_PATH not set
- rc file, OVERLEAF_DATA_PATH not set
====== End =======
```

View file

@ -7,10 +7,21 @@ Run `bin/init --tls` to initialise local configuration with NGINX proxy configur
A default config for NGINX is provided in `config/nginx/nginx.conf` which may be customised to your requirements. The path to the config file can be changed with the `NGINX_CONFIG_PATH` variable.
In order for Overleaf to run correctly behind the proxy, the following variables should be uncommented in `config/variables.env`
Since Overleaf CE/Server Pro `5.x`:
```
OVERLEAF_BEHIND_PROXY=true
OVERLEAF_SECURE_COOKIE=true
```
For Overleaf CE/Server Pro `4.x` and older versions:
```
SHARELATEX_BEHIND_PROXY=true
SHARELATEX_SECURE_COOKIE=true
```
Add the following section to your `config/overleaf.rc` file if it is not there already:
```
# TLS proxy configuration (optional)
@ -29,7 +40,7 @@ TLS_PORT=443
By default the https web interface will be available on `https://127.0.1.1:443`. Connections to `http://127.0.1.1:80` will be redirected to `https://127.0.1.1:443`. To change the IP address that NGINX listens on, set the `NGINX_HTTP_LISTEN_IP` and `NGINX_TLS_LISTEN_IP` variables. The ports can be changed via the `NGINX_HTTP_PORT` and `TLS_PORT` variables.
If NGINX fails to start with the error message `Error starting userland proxy: listen tcp4 ... bind: address already in use` ensure that `SHARELATEX_LISTEN_IP:SHARELATEX_PORT` does not overlap with `NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT`.
If NGINX fails to start with the error message `Error starting userland proxy: listen tcp4 ... bind: address already in use` ensure that `OVERLEAF_LISTEN_IP:OVERLEAF_PORT` does not overlap with `NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT`.
```mermaid
sequenceDiagram
@ -53,7 +64,7 @@ sequenceDiagram
note over sharelatex: sharlatex:80
%% User connects to localhost HTTP
user->>+ internal: HTTP
note over internal: SHARELATEX_LISTEN_IP:SHARELATEX_PORT
note over internal: OVERLEAF_LISTEN_IP:OVERLEAF_PORT
internal->>+sharelatex: HTTP
note over sharelatex: sharlatex:80
```

View file

@ -3,12 +3,12 @@
PROJECT_NAME=overleaf
# Sharelatex container
# Uncomment the SHARELATEX_IMAGE_NAME variable to use a user-defined image.
# SHARELATEX_IMAGE_NAME=sharelatex/sharelatex
SHARELATEX_DATA_PATH=data/sharelatex
# Uncomment the OVERLEAF_IMAGE_NAME variable to use a user-defined image.
# OVERLEAF_IMAGE_NAME=sharelatex/sharelatex
OVERLEAF_DATA_PATH=data/overleaf
SERVER_PRO=false
SHARELATEX_LISTEN_IP=127.0.0.1
SHARELATEX_PORT=80
OVERLEAF_LISTEN_IP=127.0.0.1
OVERLEAF_PORT=80
# Sibling Containers
SIBLING_CONTAINERS_ENABLED=false

View file

@ -1,4 +1,4 @@
SHARELATEX_APP_NAME="Our Overleaf Instance"
OVERLEAF_APP_NAME="Our Overleaf Instance"
ENABLED_LINKED_FILE_TYPES=project_file,project_output_file
@ -13,113 +13,113 @@ EMAIL_CONFIRMATION_DISABLED=true
# NGINX_WORKER_CONNECTIONS=768
## Set for TLS via nginx-proxy
# SHARELATEX_BEHIND_PROXY=true
# SHARELATEX_SECURE_COOKIE=true
# OVERLEAF_BEHIND_PROXY=true
# OVERLEAF_SECURE_COOKIE=true
# SHARELATEX_SITE_URL=http://overleaf.example.com
# SHARELATEX_NAV_TITLE=Our Overleaf Instance
# SHARELATEX_HEADER_IMAGE_URL=http://somewhere.com/mylogo.png
# SHARELATEX_ADMIN_EMAIL=support@example.com
# OVERLEAF_SITE_URL=http://overleaf.example.com
# OVERLEAF_NAV_TITLE=Our Overleaf Instance
# OVERLEAF_HEADER_IMAGE_URL=http://somewhere.com/mylogo.png
# OVERLEAF_ADMIN_EMAIL=support@example.com
# SHARELATEX_LEFT_FOOTER=[{"text":"Powered by Overleaf © 2021", "url": "https://www.overleaf.com"}, {"text": "Contact your support team", "url": "mailto:support@example.com"} ]
# SHARELATEX_RIGHT_FOOTER=[{"text":"Hello I am on the Right"}]
# OVERLEAF_LEFT_FOOTER=[{"text":"Powered by Overleaf © 2021", "url": "https://www.overleaf.com"}, {"text": "Contact your support team", "url": "mailto:support@example.com"} ]
# OVERLEAF_RIGHT_FOOTER=[{"text":"Hello I am on the Right"}]
# SHARELATEX_EMAIL_FROM_ADDRESS=team@example.com
# OVERLEAF_EMAIL_FROM_ADDRESS=team@example.com
# SHARELATEX_EMAIL_AWS_SES_ACCESS_KEY_ID=
# SHARELATEX_EMAIL_AWS_SES_SECRET_KEY=
# OVERLEAF_EMAIL_AWS_SES_ACCESS_KEY_ID=
# OVERLEAF_EMAIL_AWS_SES_SECRET_KEY=
# SHARELATEX_EMAIL_SMTP_HOST=smtp.example.com
# SHARELATEX_EMAIL_SMTP_PORT=587
# SHARELATEX_EMAIL_SMTP_SECURE=false
# SHARELATEX_EMAIL_SMTP_USER=
# SHARELATEX_EMAIL_SMTP_PASS=
# SHARELATEX_EMAIL_SMTP_NAME=
# SHARELATEX_EMAIL_SMTP_LOGGER=false
# SHARELATEX_EMAIL_SMTP_TLS_REJECT_UNAUTH=true
# SHARELATEX_EMAIL_SMTP_IGNORE_TLS=false
# SHARELATEX_CUSTOM_EMAIL_FOOTER=This system is run by department x
# OVERLEAF_EMAIL_SMTP_HOST=smtp.example.com
# OVERLEAF_EMAIL_SMTP_PORT=587
# OVERLEAF_EMAIL_SMTP_SECURE=false
# OVERLEAF_EMAIL_SMTP_USER=
# OVERLEAF_EMAIL_SMTP_PASS=
# OVERLEAF_EMAIL_SMTP_NAME=
# OVERLEAF_EMAIL_SMTP_LOGGER=false
# OVERLEAF_EMAIL_SMTP_TLS_REJECT_UNAUTH=true
# OVERLEAF_EMAIL_SMTP_IGNORE_TLS=false
# OVERLEAF_CUSTOM_EMAIL_FOOTER=This system is run by department x
################
## Server Pro ##
################
EXTERNAL_AUTH=none
# SHARELATEX_LDAP_URL=ldap://ldap:389
# SHARELATEX_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com
# SHARELATEX_LDAP_SEARCH_FILTER=(uid={{username}})
# SHARELATEX_LDAP_BIND_DN=cn=admin,dc=planetexpress,dc=com
# SHARELATEX_LDAP_BIND_CREDENTIALS=GoodNewsEveryone
# SHARELATEX_LDAP_EMAIL_ATT=mail
# SHARELATEX_LDAP_NAME_ATT=cn
# SHARELATEX_LDAP_LAST_NAME_ATT=sn
# SHARELATEX_LDAP_UPDATE_USER_DETAILS_ON_LOGIN=true
# OVERLEAF_LDAP_URL=ldap://ldap:389
# OVERLEAF_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com
# OVERLEAF_LDAP_SEARCH_FILTER=(uid={{username}})
# OVERLEAF_LDAP_BIND_DN=cn=admin,dc=planetexpress,dc=com
# OVERLEAF_LDAP_BIND_CREDENTIALS=GoodNewsEveryone
# OVERLEAF_LDAP_EMAIL_ATT=mail
# OVERLEAF_LDAP_NAME_ATT=cn
# OVERLEAF_LDAP_LAST_NAME_ATT=sn
# OVERLEAF_LDAP_UPDATE_USER_DETAILS_ON_LOGIN=true
# SHARELATEX_TEMPLATES_USER_ID=578773160210479700917ee5
# SHARELATEX_NEW_PROJECT_TEMPLATE_LINKS=[{"name":"All Templates","url":"/templates/all"}]
# OVERLEAF_TEMPLATES_USER_ID=578773160210479700917ee5
# OVERLEAF_NEW_PROJECT_TEMPLATE_LINKS=[{"name":"All Templates","url":"/templates/all"}]
# TEX_LIVE_DOCKER_IMAGE=quay.io/sharelatex/texlive-full:2022.1
# ALL_TEX_LIVE_DOCKER_IMAGES=quay.io/sharelatex/texlive-full:2022.1,quay.io/sharelatex/texlive-full:2021.1,quay.io/sharelatex/texlive-full:2020.1
# SHARELATEX_PROXY_LEARN=true
# OVERLEAF_PROXY_LEARN=true
# S3
# Docs: https://github.com/overleaf/overleaf/wiki/S3
# ## Enable the s3 backend for filestore
# SHARELATEX_FILESTORE_BACKEND=s3
# OVERLEAF_FILESTORE_BACKEND=s3
# ## Enable S3 backend for history
# SHARELATEX_HISTORY_BACKEND=s3
# OVERLEAF_HISTORY_BACKEND=s3
# #
# # Pick one of the two sections "AWS S3" or "Self-hosted S3".
# #
# # AWS S3
# ## Bucket name for project files
# SHARELATEX_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files
# OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files
# ## Bucket name for template files
# SHARELATEX_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files
# OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files
# ## Key for filestore user
# SHARELATEX_FILESTORE_S3_ACCESS_KEY_ID=...
# OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=...
# ## Secret for filestore user
# SHARELATEX_FILESTORE_S3_SECRET_ACCESS_KEY=...
# OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=...
# ## Bucket region you picked when creating the buckets.
# SHARELATEX_FILESTORE_S3_REGION=""
# OVERLEAF_FILESTORE_S3_REGION=""
# ## Bucket name for project history blobs
# SHARELATEX_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs
# OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs
# ## Bucket name for history chunks
# SHARELATEX_HISTORY_CHUNKS_BUCKET=overleaf-chunks
# OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks
# ## Key for history user
# SHARELATEX_HISTORY_S3_ACCESS_KEY_ID=...
# OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=...
# ## Secret for history user
# SHARELATEX_HISTORY_S3_SECRET_ACCESS_KEY=...
# OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=...
# ## Bucket region you picked when creating the buckets.
# SHARELATEX_HISTORY_S3_REGION=""
# OVERLEAF_HISTORY_S3_REGION=""
#
# # Self-hosted S3
# ## Bucket name for project files
# SHARELATEX_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files
# OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files
# ## Bucket name for template files
# SHARELATEX_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files
# OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files
# ## Key for filestore user
# SHARELATEX_FILESTORE_S3_ACCESS_KEY_ID=...
# OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=...
# ## Secret for filestore user
# SHARELATEX_FILESTORE_S3_SECRET_ACCESS_KEY=...
# OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=...
# ## S3 provider endpoint
# SHARELATEX_FILESTORE_S3_ENDPOINT=http://10.10.10.10:9000
# OVERLEAF_FILESTORE_S3_ENDPOINT=http://10.10.10.10:9000
# ## Path style addressing of buckets. Most likely you need to set this to "true".
# SHARELATEX_FILESTORE_S3_PATH_STYLE="true"
# OVERLEAF_FILESTORE_S3_PATH_STYLE="true"
# ## Bucket region. Most likely you do not need to configure this.
# SHARELATEX_FILESTORE_S3_REGION=""
# OVERLEAF_FILESTORE_S3_REGION=""
# ## Bucket name for project history blobs
# SHARELATEX_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs
# OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs
# ## Bucket name for history chunks
# SHARELATEX_HISTORY_CHUNKS_BUCKET=overleaf-chunks
# OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks
# ## Key for history user
# SHARELATEX_HISTORY_S3_ACCESS_KEY_ID=...
# OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=...
# ## Secret for history user
# SHARELATEX_HISTORY_S3_SECRET_ACCESS_KEY=...
# OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=...
# ## S3 provider endpoint
# SHARELATEX_HISTORY_S3_ENDPOINT=http://10.10.10.10:9000
# OVERLEAF_HISTORY_S3_ENDPOINT=http://10.10.10.10:9000
# ## Path style addressing of buckets. Most likely you need to set this to "true".
# SHARELATEX_HISTORY_S3_PATH_STYLE="true"
# OVERLEAF_HISTORY_S3_PATH_STYLE="true"
# ## Bucket region. Most likely you do not need to configure this.
# SHARELATEX_HISTORY_S3_REGION=""
# OVERLEAF_HISTORY_S3_REGION=""

View file

@ -1 +1 @@
4.2.3
5.0.1

View file

@ -2,8 +2,8 @@
PROJECT_NAME=overleaf
SERVER_PRO=false
SHARELATEX_DATA_PATH=data/sharelatex
SHARELATEX_PORT=80
OVERLEAF_DATA_PATH=data/sharelatex
OVERLEAF_PORT=80
# Sibling containers
SIBLING_CONTAINERS_ENABLED=false

View file

@ -7,17 +7,15 @@ services:
image: "${IMAGE}"
container_name: sharelatex
volumes:
- "${SHARELATEX_DATA_PATH}:/var/lib/sharelatex"
- "${OVERLEAF_DATA_PATH}:${OVERLEAF_IN_CONTAINER_DATA_PATH}"
ports:
- "${SHARELATEX_LISTEN_IP:-127.0.0.1}:${SHARELATEX_PORT:-80}:80"
- "${OVERLEAF_LISTEN_IP:-127.0.0.1}:${OVERLEAF_PORT:-80}:80"
environment:
GIT_BRIDGE_ENABLED: "${GIT_BRIDGE_ENABLED}"
GIT_BRIDGE_HOST: "git-bridge"
GIT_BRIDGE_PORT: "8000"
REDIS_HOST: "${REDIS_HOST}"
REDIS_PORT: "${REDIS_PORT}"
SHARELATEX_MONGO_URL: "${MONGO_URL}"
SHARELATEX_REDIS_HOST: "${REDIS_HOST}"
V1_HISTORY_URL: "http://sharelatex:3100/api"
env_file:
- ../config/variables.env

View file

@ -8,5 +8,5 @@ services:
DOCKER_RUNNER: 'true'
SANDBOXED_COMPILES: 'true'
SANDBOXED_COMPILES_SIBLING_CONTAINERS: 'true'
SANDBOXED_COMPILES_HOST_DIR: "${SHARELATEX_DATA_PATH}/data/compiles"
SYNCTEX_BIN_HOST_PATH: "${SHARELATEX_DATA_PATH}/bin/synctex"
SANDBOXED_COMPILES_HOST_DIR: "${OVERLEAF_DATA_PATH}/data/compiles"
SYNCTEX_BIN_HOST_PATH: "${OVERLEAF_DATA_PATH}/bin/synctex"

View file

@ -0,0 +1,8 @@
---
version: '2.2'
services:
sharelatex:
environment:
SHARELATEX_MONGO_URL: "${MONGO_URL}"
SHARELATEX_REDIS_HOST: "${REDIS_HOST}"

View file

@ -0,0 +1,8 @@
---
version: '2.2'
services:
sharelatex:
environment:
OVERLEAF_MONGO_URL: "${MONGO_URL}"
OVERLEAF_REDIS_HOST: "${REDIS_HOST}"

View file

@ -27,18 +27,77 @@ prompt() {
}
rebrand_sharelatex_env_variables() {
set +o pipefail
sharelatex_occurrences=$(grep -o "SHARELATEX_" "$TOOLKIT_ROOT/config/variables.env" | wc -l | sed 's/ //g')
set -o pipefail
local filename=$1
local silent=${2:-no}
sharelatex_occurrences=$(set +o pipefail && grep -o "SHARELATEX_" "$TOOLKIT_ROOT/config/$filename" | wc -l | sed 's/ //g')
if [ "$sharelatex_occurrences" -gt 0 ]; then
echo "Found $sharelatex_occurrences lines with SHARELATEX_"
echo "Rebranding from ShareLaTeX to Overleaf"
echo " Found $sharelatex_occurrences lines with SHARELATEX_ in config/$filename"
local timestamp=$(date "+%Y.%m.%d-%H.%M.%S")
echo "Creating backup file config/__old-variables.env.$timestamp"
cp config/variables.env config/__old-variables.env.$timestamp
echo "Replacing 'SHARELATEX_' with 'OVERLEAF_' in config/variables.env"
sed -i "s/SHARELATEX_/OVERLEAF_/g" "$TOOLKIT_ROOT/config/variables.env"
echo "Updated $sharelatex_occurrences lines in $TOOLKIT_ROOT/config/variables.env"
local backup_filename="__old-$filename.$timestamp"
echo " Will create backup of config/$filename at config/$backup_filename"
prompt " Proceed with the renaming in config/$filename?"
echo " Creating backup file config/$backup_filename"
cp "$TOOLKIT_ROOT/config/$filename" "$TOOLKIT_ROOT/config/$backup_filename"
echo " Replacing 'SHARELATEX_' with 'OVERLEAF_' in config/$filename"
sed -i "s/SHARELATEX_/OVERLEAF_/g" "$TOOLKIT_ROOT/config/$filename"
echo " Updated $sharelatex_occurrences lines in config/$filename"
else
echo "No 'SHARELATEX_' ocurrences found in config/variables.env"
if [[ "$silent" != "silent_if_no_match" ]]; then
echo "Rebranding from ShareLaTeX to Overleaf"
echo " No 'SHARELATEX_' occurrences found in config/$filename"
fi
fi
}
function check_sharelatex_env_vars() {
local rc_occurrences=$(set +o pipefail && grep -o SHARELATEX_ "$TOOLKIT_ROOT/config/overleaf.rc" | wc -l | sed 's/ //g')
if [ "$rc_occurrences" -gt 0 ]; then
echo "Rebranding from ShareLaTeX to Overleaf"
echo " The Toolkit has adopted to Overleaf brand for its variables."
echo " Your config/overleaf.rc still has $rc_occurrences variables using the previous ShareLaTeX brand."
echo " Moving forward the 'SHARELATEX_' prefixed variables must be renamed to 'OVERLEAF_'."
echo " You can migrate your config/overleaf.rc to use the Overleaf brand by running:"
echo ""
echo " toolkit$ bin/rename-rc-vars"
echo ""
exit 1
fi
local expected_prefix="OVERLEAF_"
local invalid_prefix="SHARELATEX_"
if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then
expected_prefix="SHARELATEX_"
invalid_prefix="OVERLEAF_"
fi
local env_occurrences=$(set +o pipefail && grep -o "$invalid_prefix" "$TOOLKIT_ROOT/config/variables.env" | wc -l | sed 's/ //g')
if [ "$env_occurrences" -gt 0 ]; then
echo "Rebranding from ShareLaTeX to Overleaf"
echo " Starting with Overleaf CE and Server Pro version 5.0.0 the environment variables will use the Overleaf brand."
echo " Previous versions used the ShareLaTeX brand for environment variables."
echo " Your config/variables.env has $env_occurrences entries matching '$invalid_prefix', expected prefix '$expected_prefix'."
echo " Please align your config/version with the naming scheme of variables in config/variables.env."
if [[ ! "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then
echo " You can migrate your config/variables.env to use the Overleaf brand by running:"
echo ""
echo " toolkit$ bin/rename-env-vars-5-0"
echo ""
fi
exit 1
fi
if [[ ! "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then
if grep -q -e 'TEXMFVAR=/var/lib/sharelatex/tmp/texmf-var' "$TOOLKIT_ROOT/config/variables.env"; then
echo "Rebranding from ShareLaTeX to Overleaf"
echo " The 'TEXMFVAR' override is not needed since Server Pro/Overleaf CE version 3.2 (August 2022) and it conflicts with the rebranded paths."
echo " Please remove the following entry from your config/variables.env:"
echo ""
echo " TEXMFVAR=/var/lib/sharelatex/tmp/texmf-var"
echo ""
exit 1
fi
fi
}