├── data └── .gitkeep ├── config └── .gitkeep ├── lib ├── config-seed │ ├── version │ ├── overleaf.rc │ ├── nginx.conf │ └── variables.env ├── docker-compose.logging.yml ├── docker-compose.vars.yml ├── docker-compose.vars-legacy.yml ├── docker-compose.sibling-containers.yml ├── docker-compose.redis.yml ├── docker-compose.mongo.yml ├── docker-compose.base.yml ├── docker-compose.nginx.yml ├── docker-compose.git-bridge.yml ├── default.rc └── shared-functions.sh ├── doc ├── img │ └── upgrade-demo.gif ├── dependencies.md ├── README.md ├── getting-server-pro.md ├── upgrading.md ├── persistent-data.md ├── sandboxed-compiles.md ├── saml.md ├── ldap.md ├── configuration.md ├── tls-proxy.md ├── docker-compose.md ├── overview.md ├── ce-upgrading-texlive.md ├── docker-compose-to-toolkit-migration.md ├── the-doctor.md ├── quick-start-guide.md ├── overleaf-rc.md └── upgrading-from-0.x.md ├── bin ├── dev │ └── lint ├── stop ├── start ├── shell ├── mongo ├── rename-rc-vars ├── rename-env-vars-5-0 ├── images ├── error-logs ├── backup-config ├── run-script ├── init ├── up ├── logs ├── docker-compose ├── upgrade └── doctor ├── .gitignore ├── .editorconfig ├── .github ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── README.md ├── CHANGELOG.md └── LICENSE /data/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /config/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/config-seed/version: -------------------------------------------------------------------------------- 1 | 6.0.1 2 | -------------------------------------------------------------------------------- /doc/img/upgrade-demo.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/overleaf/toolkit/HEAD/doc/img/upgrade-demo.gif -------------------------------------------------------------------------------- /bin/dev/lint: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | exec find ./bin -type f -not -name '*.swp' -print0 | xargs -0 shellcheck 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | *.log 4 | tmp/ 5 | *.swp 6 | 7 | config/**/* 8 | !config/.gitkeep 9 | 10 | data/**/* 11 | !data/.gitkeep 12 | -------------------------------------------------------------------------------- /lib/docker-compose.logging.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | sharelatex: 4 | volumes: 5 | - "${OVERLEAF_LOG_PATH}:${OVERLEAF_IN_CONTAINER_LOG_PATH}" 6 | -------------------------------------------------------------------------------- /lib/docker-compose.vars.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | 4 | sharelatex: 5 | environment: 6 | OVERLEAF_MONGO_URL: "${MONGO_URL}" 7 | OVERLEAF_REDIS_HOST: "${REDIS_HOST}" 8 | -------------------------------------------------------------------------------- /lib/docker-compose.vars-legacy.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | 4 | sharelatex: 5 | environment: 6 | SHARELATEX_MONGO_URL: "${MONGO_URL}" 7 | SHARELATEX_REDIS_HOST: "${REDIS_HOST}" 8 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | ## Description 2 | 3 | 4 | 5 | ## Related issues / Pull Requests 6 | 7 | 8 | 9 | ## Contributor Agreement 10 | 11 | - [ ] I confirm I have signed the [Contributor License Agreement](https://github.com/overleaf/overleaf/blob/main/CONTRIBUTING.md#contributor-license-agreement) 12 | -------------------------------------------------------------------------------- /lib/docker-compose.sibling-containers.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | sharelatex: 4 | volumes: 5 | - "${DOCKER_SOCKET_PATH}:/var/run/docker.sock" 6 | environment: 7 | DOCKER_RUNNER: 'true' 8 | SANDBOXED_COMPILES: 'true' 9 | SANDBOXED_COMPILES_SIBLING_CONTAINERS: 'true' 10 | SANDBOXED_COMPILES_HOST_DIR: "${OVERLEAF_DATA_PATH}/data/compiles" 11 | SYNCTEX_BIN_HOST_PATH: "${OVERLEAF_DATA_PATH}/bin/synctex" 12 | -------------------------------------------------------------------------------- /lib/docker-compose.redis.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | 4 | redis: 5 | restart: always 6 | image: "${REDIS_IMAGE}" 7 | volumes: 8 | - "${REDIS_DATA_PATH}:/data" 9 | container_name: redis 10 | command: ${REDIS_COMMAND} 11 | expose: 12 | - 6379 13 | 14 | sharelatex: 15 | depends_on: 16 | redis: 17 | condition: service_started 18 | links: 19 | - redis 20 | -------------------------------------------------------------------------------- /lib/docker-compose.mongo.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | 4 | mongo: 5 | restart: always 6 | image: "${MONGO_DOCKER_IMAGE}" 7 | command: "${MONGO_ARGS}" 8 | container_name: mongo 9 | volumes: 10 | - "${MONGO_DATA_PATH}:/data/db" 11 | expose: 12 | - 27017 13 | healthcheck: 14 | test: echo 'db.stats().ok' | ${MONGOSH} localhost:27017/test --quiet 15 | interval: 10s 16 | timeout: 10s 17 | retries: 5 18 | 19 | sharelatex: 20 | depends_on: 21 | mongo: 22 | condition: service_healthy 23 | links: 24 | - mongo 25 | -------------------------------------------------------------------------------- /bin/stop: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | function __main__() { 19 | exec "$TOOLKIT_ROOT/bin/docker-compose" stop "$@" 20 | } 21 | 22 | __main__ "$@" 23 | -------------------------------------------------------------------------------- /bin/start: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | function __main__() { 19 | exec "$TOOLKIT_ROOT/bin/docker-compose" start "$@" 20 | } 21 | 22 | __main__ "$@" 23 | -------------------------------------------------------------------------------- /lib/docker-compose.base.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | 4 | sharelatex: 5 | restart: always 6 | image: "${IMAGE}" 7 | container_name: sharelatex 8 | volumes: 9 | - "${OVERLEAF_DATA_PATH}:${OVERLEAF_IN_CONTAINER_DATA_PATH}" 10 | ports: 11 | - "${OVERLEAF_LISTEN_IP:-127.0.0.1}:${OVERLEAF_PORT:-80}:80" 12 | environment: 13 | GIT_BRIDGE_ENABLED: "${GIT_BRIDGE_ENABLED}" 14 | GIT_BRIDGE_HOST: "git-bridge" 15 | GIT_BRIDGE_PORT: "8000" 16 | REDIS_HOST: "${REDIS_HOST}" 17 | REDIS_PORT: "${REDIS_PORT}" 18 | V1_HISTORY_URL: "http://sharelatex:3100/api" 19 | env_file: 20 | - ../config/variables.env 21 | stop_grace_period: 60s 22 | -------------------------------------------------------------------------------- /bin/shell: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | function __main__() { 19 | exec "$TOOLKIT_ROOT/bin/docker-compose" exec sharelatex bash 20 | } 21 | 22 | __main__ "$@" 23 | -------------------------------------------------------------------------------- /lib/docker-compose.nginx.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | sharelatex: 4 | environment: 5 | OVERLEAF_SECURE_COOKIE: 'true' 6 | OVERLEAF_TRUSTED_PROXY_IPS: "${OVERLEAF_TRUSTED_PROXY_IPS}" 7 | # Enabled by default in Server Pro 6.0 8 | OVERLEAF_BEHIND_PROXY: 'true' 9 | 10 | depends_on: 11 | - nginx 12 | 13 | nginx: 14 | image: "${NGINX_IMAGE}" 15 | ports: 16 | - "${NGINX_TLS_LISTEN_IP:-0.0.0.0}:${TLS_PORT:-443}:443" 17 | - "${NGINX_HTTP_LISTEN_IP:-127.0.1.1}:${NGINX_HTTP_PORT:-80}:80" 18 | volumes: 19 | - "${TLS_PRIVATE_KEY_PATH}:/certs/nginx_key.pem:ro" 20 | - "${TLS_CERTIFICATE_PATH}:/certs/nginx_certificate.pem:ro" 21 | - "${NGINX_CONFIG_PATH}:/etc/nginx/nginx.conf:ro" 22 | restart: always 23 | container_name: nginx 24 | -------------------------------------------------------------------------------- /doc/dependencies.md: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | 3 | This project requires a modern unix system as a base (such as Ubuntu Linux). 4 | It also requires `bash` and `docker`. 5 | 6 | The `bin/doctor` script can be used to check for missing dependencies. 7 | 8 | Note: MacOS does not ship with a `realpath` program. In this case we fall 9 | back to a custom shell function to imitate some of what `realpath` does, but 10 | it is relatively limited. We recommend users on MacOS install the gnu coreutils 11 | with `brew install coreutils`, to get a working version of `realpath`. 12 | 13 | 14 | ## Host Environment 15 | 16 | The Overleaf Toolkit is tested on Ubuntu Linux, but we expect that most modern Linux systems will be able to run the toolkit without problems. Although it is possible to run the toolkit on other platforms, they are not officially supported. 17 | -------------------------------------------------------------------------------- /lib/docker-compose.git-bridge.yml: -------------------------------------------------------------------------------- 1 | --- 2 | services: 3 | 4 | git-bridge: 5 | restart: always 6 | image: "${GIT_BRIDGE_IMAGE}" 7 | volumes: 8 | - "${GIT_BRIDGE_DATA_PATH}:/data/git-bridge" 9 | container_name: git-bridge 10 | expose: 11 | - "8000" 12 | environment: 13 | GIT_BRIDGE_API_BASE_URL: "${GIT_BRIDGE_API_BASE_URL}" 14 | GIT_BRIDGE_OAUTH2_SERVER: "http://sharelatex" 15 | GIT_BRIDGE_POSTBACK_BASE_URL: "http://git-bridge:8000" 16 | GIT_BRIDGE_ROOT_DIR: "/data/git-bridge" 17 | LOG_LEVEL: "${GIT_BRIDGE_LOG_LEVEL}" 18 | env_file: 19 | - ../config/variables.env 20 | user: root 21 | command: ["/server-pro-start.sh"] 22 | 23 | sharelatex: 24 | links: 25 | - git-bridge 26 | -------------------------------------------------------------------------------- /lib/default.rc: -------------------------------------------------------------------------------- 1 | # Default values for config/overleaf.rc 2 | 3 | PROJECT_NAME=overleaf 4 | SERVER_PRO=false 5 | OVERLEAF_DATA_PATH=data/sharelatex 6 | OVERLEAF_PORT=80 7 | 8 | # Sibling containers 9 | SIBLING_CONTAINERS_ENABLED=false 10 | DOCKER_SOCKET_PATH=/var/run/docker.sock 11 | 12 | # Mongo configuration 13 | MONGO_ENABLED=true 14 | MONGO_IMAGE=mongo:4.0 15 | MONGO_URL=mongodb://mongo/sharelatex 16 | 17 | # Redis configuration 18 | REDIS_ENABLED=true 19 | REDIS_IMAGE=redis:5.0 20 | REDIS_HOST=redis 21 | REDIS_PORT=6379 22 | REDIS_DATA_PATH=data/redis 23 | 24 | # Git bridge configuration 25 | GIT_BRIDGE_ENABLED=false 26 | GIT_BRIDGE_DATA_PATH=data/git-bridge 27 | GIT_BRIDGE_LOG_LEVEL=INFO 28 | 29 | # TLS proxy configuration 30 | NGINX_ENABLED=false 31 | NGINX_IMAGE=nginx:1.28-alpine 32 | NGINX_CONFIG_PATH=config/nginx/nginx.conf 33 | NGINX_HTTP_PORT=80 34 | TLS_PORT=443 35 | -------------------------------------------------------------------------------- /bin/mongo: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | source "$TOOLKIT_ROOT/lib/shared-functions.sh" 19 | 20 | function __main__() { 21 | read_mongo_version 22 | exec env SKIP_WARNINGS=true "$TOOLKIT_ROOT/bin/docker-compose" exec mongo $MONGOSH sharelatex 23 | } 24 | 25 | __main__ "$@" 26 | -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | # Documentation 2 | 3 | Welcome to the documentation for the Overleaf Toolkit. 4 | 5 | This documentation is under construction. You can still find the legacy 6 | documentation on the [Overleaf Wiki](https://github.com/overleaf/overleaf/wiki) 7 | 8 | 9 | ## Getting Started 10 | 11 | - [Overview](./overview.md) 12 | - [Quick Start Guide](./quick-start-guide.md) 13 | - [Dependencies](./dependencies.md) 14 | - [docker-compose.yml to Toolkit migration](./docker-compose-to-toolkit-migration.md) 15 | 16 | 17 | ## Using the Toolkit 18 | 19 | - [The Doctor](./the-doctor.md) 20 | - [Working with Docker-Compose Services](./docker-compose.md) 21 | 22 | 23 | ## Configuration 24 | 25 | - [Configuration Overview](./configuration.md) 26 | - [overleaf.rc](./overleaf-rc.md) 27 | - [TLS proxy](./tls-proxy.md) 28 | 29 | 30 | ## Persistent Data 31 | 32 | - [Persistent Data Overview](./persistent-data.md) 33 | 34 | 35 | ## Server Pro 36 | 37 | - [Getting Server Pro](./getting-server-pro.md) 38 | - [Sandboxed Compiles](./sandboxed-compiles.md) 39 | - [LDAP integration](./ldap.md) 40 | - [SAML integration](./saml.md) 41 | 42 | 43 | ## Upgrades 44 | 45 | - [Upgrading the Toolkit](./upgrading.md) 46 | - [Community Edition: Upgrading TexLive](./ce-upgrading-texlive.md) 47 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Overleaf Toolkit 2 | 3 | This repository contains the Overleaf Toolkit, the standard tools for running a local 4 | instance of [Overleaf](https://overleaf.com). This toolkit will help you to set up and administer both Overleaf Community Edition (free to use, and community supported), and Overleaf Server Pro (commercial, with professional support). 5 | 6 | The [Developer wiki](https://github.com/overleaf/overleaf/wiki) contains further documentation on releases, features and other configuration elements. 7 | 8 | 9 | ## Getting Started 10 | 11 | Clone this repository locally: 12 | 13 | ``` sh 14 | git clone https://github.com/overleaf/toolkit.git ./overleaf-toolkit 15 | ``` 16 | 17 | Then follow the [Quick Start Guide](./doc/quick-start-guide.md). 18 | 19 | 20 | ## Documentation 21 | 22 | See [Documentation Index](./doc/README.md) 23 | 24 | 25 | ## Contributing 26 | 27 | See the [CONTRIBUTING](https://github.com/overleaf/overleaf/blob/main/CONTRIBUTING.md) file. 28 | 29 | 30 | ## Getting Help 31 | 32 | Users of the free Community Edition should [open an issue on github](https://github.com/overleaf/toolkit/issues). 33 | 34 | Users of Server Pro should contact `support@overleaf.com` for assistance. 35 | 36 | In both cases, it is a good idea to include the output of the `bin/doctor` script in your message. 37 | 38 | -------------------------------------------------------------------------------- /bin/rename-rc-vars: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | # shellcheck source-path=.. 3 | 4 | set -euo pipefail 5 | 6 | #### Detect Toolkit Project Root #### 7 | # if realpath is not available, create a semi-equivalent function 8 | command -v realpath >/dev/null 2>&1 || realpath() { 9 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 10 | } 11 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 12 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 13 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 14 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 15 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 16 | exit 1 17 | fi 18 | 19 | source "$TOOLKIT_ROOT/lib/shared-functions.sh" 20 | 21 | function usage() { 22 | echo "Usage: bin/rename-rc-vars" 23 | echo "" 24 | echo "Updates config/overleaf.rc to ensure variables are renamed from 'SHARELATEX_' to 'OVERLEAF_'" 25 | echo "" 26 | } 27 | 28 | function __main__() { 29 | if [[ "${1:-null}" == "help" ]] || [[ "${1:-null}" == "--help" ]]; then 30 | usage 31 | exit 32 | fi 33 | 34 | echo "This script will update your config/overleaf.rc." 35 | echo "We recommend backing up your config with bin/backup-config." 36 | 37 | rebrand_sharelatex_env_variables 'overleaf.rc' 38 | 39 | echo "Done." 40 | } 41 | 42 | __main__ "$@" 43 | -------------------------------------------------------------------------------- /doc/getting-server-pro.md: -------------------------------------------------------------------------------- 1 | # Getting Server Pro 2 | 3 | Overleaf Server Pro is a commercial version of Overleaf, with extra features and commercial support. 4 | See https://www.overleaf.com/for/enterprises/features for more details about Server Pro and how to 5 | buy a license. Or, if you already have a license, contact support@overleaf.com if you need assistance. 6 | 7 | 8 | ## Obtaining Server Pro Image 9 | 10 | Server Pro is distributed as a docker image on the [quay.io](https://quay.io) registry: `quay.io/sharelatex/sharelatex-pro` 11 | 12 | You will have been supplied with a set of credentials when you signed up for a Server Pro license. 13 | 14 | First use your Server Pro credentials to log in to quay.io: 15 | 16 | ``` 17 | docker login quay.io 18 | Username: 19 | Password: 20 | ``` 21 | 22 | Then run `bin/docker-compose pull` to pull the image from the `quay.io` registry. 23 | 24 | 25 | ## Switching your installation to Server Pro 26 | 27 | We recommend first setting up your toolkit with the default Community Edition image before switching to Server Pro. 28 | 29 | You can enable Server Pro by opening `config/overleaf.rc` and changing the `SERVER_PRO` setting to `true`: 30 | 31 | ``` 32 | SERVER_PRO=true 33 | ``` 34 | 35 | The next time you run `bin/up`, the toolkit will use the Server Pro image. 36 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | ## Steps to Reproduce 17 | 18 | 19 | 20 | 1. 21 | 2. 22 | 3. 23 | 24 | ## Expected Behaviour 25 | 26 | 27 | ## Observed Behaviour 28 | 29 | 30 | 31 | ## Context 32 | 33 | 34 | ## Technical Info 35 | 36 | 37 | * URL: 38 | * Browser Name and version: 39 | * Operating System and version (desktop or mobile): 40 | * Signed in as: 41 | * Project and/or file: 42 | 43 | ## Analysis 44 | 45 | -------------------------------------------------------------------------------- /bin/rename-env-vars-5-0: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | # shellcheck source-path=.. 3 | 4 | set -euo pipefail 5 | 6 | #### Detect Toolkit Project Root #### 7 | # if realpath is not available, create a semi-equivalent function 8 | command -v realpath >/dev/null 2>&1 || realpath() { 9 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 10 | } 11 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 12 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 13 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 14 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 15 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 16 | exit 1 17 | fi 18 | 19 | source "$TOOLKIT_ROOT/lib/shared-functions.sh" 20 | 21 | function usage() { 22 | echo "Usage: bin/rename-env-vars-5-0" 23 | echo "" 24 | echo "Updates config/variables.env to ensure variables are renamed from 'SHARELATEX_' to 'OVERLEAF_'" 25 | echo "" 26 | } 27 | 28 | function __main__() { 29 | if [[ "${1:-null}" == "help" ]] || [[ "${1:-null}" == "--help" ]]; then 30 | usage 31 | exit 32 | fi 33 | 34 | echo "This script will update your config/variables.env." 35 | echo "We recommend backing up your config with bin/backup-config." 36 | 37 | rebrand_sharelatex_env_variables 'variables.env' 38 | 39 | echo "Done." 40 | } 41 | 42 | __main__ "$@" 43 | -------------------------------------------------------------------------------- /bin/images: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -uo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | 19 | function usage() { 20 | echo "Usage: bin/images" 21 | echo "" 22 | echo "Prints information about overleaf docker images on the system" 23 | } 24 | 25 | function __main__() { 26 | if [[ "${1:-null}" == "help" ]] \ 27 | || [[ "${1:-null}" == "--help" ]] ; then 28 | usage && exit 29 | fi 30 | 31 | echo "---- Community Edition Images ----" 32 | docker images sharelatex/sharelatex 33 | echo "---- Server Pro Images ----" 34 | docker images quay.io/sharelatex/sharelatex-pro 35 | echo "---- TexLive Images ----" 36 | docker images quay.io/sharelatex/texlive-full 37 | echo "---- Git Bridge Images ----" 38 | docker images quay.io/sharelatex/git-bridge 39 | } 40 | 41 | __main__ "$@" 42 | -------------------------------------------------------------------------------- /lib/config-seed/overleaf.rc: -------------------------------------------------------------------------------- 1 | #### Overleaf RC #### 2 | 3 | PROJECT_NAME=overleaf 4 | 5 | # Sharelatex container 6 | # Uncomment the OVERLEAF_IMAGE_NAME variable to use a user-defined image. 7 | # OVERLEAF_IMAGE_NAME=sharelatex/sharelatex 8 | OVERLEAF_DATA_PATH=data/overleaf 9 | SERVER_PRO=false 10 | OVERLEAF_LISTEN_IP=127.0.0.1 11 | OVERLEAF_PORT=80 12 | 13 | # Sibling Containers 14 | SIBLING_CONTAINERS_ENABLED=true 15 | DOCKER_SOCKET_PATH=/var/run/docker.sock 16 | 17 | # Mongo configuration 18 | MONGO_ENABLED=true 19 | MONGO_DATA_PATH=data/mongo 20 | MONGO_IMAGE=mongo 21 | MONGO_VERSION=8.0 22 | 23 | # Redis configuration 24 | REDIS_ENABLED=true 25 | REDIS_DATA_PATH=data/redis 26 | REDIS_IMAGE=redis:7.4 27 | REDIS_AOF_PERSISTENCE=true 28 | 29 | # Git-bridge configuration (Server Pro only) 30 | GIT_BRIDGE_ENABLED=false 31 | GIT_BRIDGE_DATA_PATH=data/git-bridge 32 | 33 | # TLS proxy configuration (optional) 34 | # See documentation in doc/tls-proxy.md 35 | NGINX_ENABLED=false 36 | NGINX_CONFIG_PATH=config/nginx/nginx.conf 37 | NGINX_HTTP_PORT=80 38 | # Replace these IP addresses with the external IP address of your host 39 | NGINX_HTTP_LISTEN_IP=127.0.1.1 40 | NGINX_TLS_LISTEN_IP=127.0.1.1 41 | TLS_PRIVATE_KEY_PATH=config/nginx/certs/overleaf_key.pem 42 | TLS_CERTIFICATE_PATH=config/nginx/certs/overleaf_certificate.pem 43 | TLS_PORT=443 44 | 45 | # In Air-gapped setups, skip pulling images 46 | # PULL_BEFORE_UPGRADE=false 47 | # SIBLING_CONTAINERS_PULL=false 48 | -------------------------------------------------------------------------------- /doc/upgrading.md: -------------------------------------------------------------------------------- 1 | # Upgrading 2 | 3 | The Overleaf Toolkit is a git repository, so it's easy to get new toolkit features. Just run `bin/upgrade` and follow the prompts. 4 | 5 | It is worth noting that the docker image version (at `config/version`), is managed separately from the toolkit code updates. Updating the toolkit code will not automatically change the version of the docker image that you are running. 6 | 7 | 8 | ## The `bin/upgrade` Script 9 | 10 | When you run `bin/upgrade`, the script will check if there is an available update to the toolkit code, and offer to update your toolkit. You can always say no to this upgrade, and nothing will change. 11 | 12 | If you do choose to update the toolkit code, the script will then check if the _default_ docker image version has changed, and offer to upgrade your local version file (at `config/version`) to match the new default. 13 | 14 | If you do choose to switch versions, the script will then walk you through a process of shutting down the docker services, taking a backup, and restarting the docker services. Your old version file will be automatically copied to `config/__old-version`, just in case you need to roll back to that version of the docker images. 15 | 16 | The whole process looks like this: 17 | 18 | ![Demonstration of the upgrade script](./img/upgrade-demo.gif) 19 | 20 | > Note: For air-gapped setups that manually import docker images, please set `PULL_BEFORE_UPGRADE=false` in your `config/overleaf.rc` file. 21 | -------------------------------------------------------------------------------- /bin/error-logs: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | function usage() { 19 | echo "Usage: bin/error-logs [OPTIONS] [SERVICES...]" 20 | echo "" 21 | echo "Services: chat, clsi, contacts, docstore, document-updater," 22 | echo " filestore, notifications, real-time, spelling," 23 | echo " tags, track-changes, web, project-history, history-v1" 24 | echo "" 25 | echo "Options:" 26 | echo " -f follow log output" 27 | echo " -n {number} number of lines to print (default 20)" 28 | echo "" 29 | echo "Examples:" 30 | echo "" 31 | echo " bin/error-logs -n 50 web clsi" 32 | echo "" 33 | echo " bin/error-logs -f web" 34 | echo "" 35 | echo " bin/error-logs -f web chat docstore" 36 | echo "" 37 | echo " bin/error-logs -n 100 -f filestore " 38 | echo "" 39 | echo " bin/error-logs -f" 40 | } 41 | 42 | function __main__() { 43 | if [[ "${1:-null}" == "help" ]] || [[ "${1:-null}" == "--help" ]]; then 44 | usage 45 | exit 46 | fi 47 | # preserve the '==>' labels from tail output 48 | "$TOOLKIT_ROOT/bin/logs" "$@" | grep -E '(^==>.*$|^.*level":50.*$)' --color=never 49 | } 50 | 51 | __main__ "$@" 52 | -------------------------------------------------------------------------------- /lib/config-seed/nginx.conf: -------------------------------------------------------------------------------- 1 | events {} 2 | 3 | http { 4 | # 127.0.0.11 is the DNS server running in Docker. It can resolve the docker compose service name "sharelatex" to a container IP. 5 | # https://github.com/docker/docs/issues/20532 6 | resolver 127.0.0.11 ipv6=off valid=10s; 7 | upstream sharelatex { 8 | zone dns 64k; 9 | server sharelatex:80 resolve; 10 | } 11 | 12 | server { 13 | listen 80 default_server; 14 | server_name _; 15 | return 301 https://$host$request_uri; 16 | } 17 | 18 | 19 | server { 20 | listen 443 ssl; 21 | 22 | ssl_certificate /certs/nginx_certificate.pem; 23 | ssl_certificate_key /certs/nginx_key.pem; 24 | 25 | # Intermediate Mozilla Config 26 | # https://ssl-config.mozilla.org/#server=nginx&version=1.26.0&config=intermediate&openssl=1.1.1w&ocsp=false&guideline=5.7 27 | ssl_protocols TLSv1.2 TLSv1.3; 28 | ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384:DHE-RSA-CHACHA20-POLY1305; 29 | ssl_prefer_server_ciphers off; 30 | 31 | # config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security 32 | # to avoid ssl stripping https://en.wikipedia.org/wiki/SSL_stripping#SSL_stripping 33 | add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;"; 34 | 35 | server_tokens off; 36 | 37 | client_max_body_size 50M; 38 | 39 | location / { 40 | proxy_pass http://sharelatex; 41 | proxy_set_header X-Forwarded-Proto $scheme; 42 | proxy_http_version 1.1; 43 | proxy_set_header Upgrade $http_upgrade; 44 | proxy_set_header Connection "upgrade"; 45 | proxy_set_header Host $host; 46 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 47 | proxy_read_timeout 3m; 48 | proxy_send_timeout 3m; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /doc/persistent-data.md: -------------------------------------------------------------------------------- 1 | # Persistent Data Overview 2 | 3 | The Overleaf Toolkit needs to store persistent data, such as the files required to compile LaTeX projects, and the contents of the MongoDB database. This is achieved by mounting a few directories from the host machine into the docker containers, and writing the data to those directories. 4 | 5 | 6 | ## Data Directories 7 | 8 | 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`. 9 | 10 | 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`. 11 | 12 | 13 | ## File Permissions 14 | 15 | Because docker runs as `root`, the data directories will end up being owned by the `root` user, even if the toolkit is being used by a non-root user. This is not a problem, but is worth being aware of, if you intend to alter the persistent data from outside of the containers. 16 | 17 | 18 | ## Backups 19 | 20 | Documentation for creating a backup on data can be found in the [Developer Wiki](https://github.com/overleaf/overleaf/wiki/Backup-of-Data). 21 | 22 | 23 | ## Volumes 24 | 25 | If you're running Overleaf on Windows or macOS, the `mongo` service may fail to restart, with an error: 26 | 27 | ``` 28 | Failed to start up WiredTiger under any compatibility version. 29 | Reason: 1: Operation not permitted 30 | ``` 31 | 32 | To avoid this error, the data needs to be stored in a volume rather than a bind mounted directory (see [the `mongo` image documentation for more details](https://github.com/docker-library/docs/blob/master/mongo/content.md#where-to-store-data)). 33 | To store data inside Docker volumes mounted inside the MongoDB and Redis containers, add the following to `config/docker-compose.override.yml` (create this file if it doesn't exist yet): 34 | 35 | ```yaml 36 | volumes: 37 | mongo-data: 38 | redis-data: 39 | 40 | services: 41 | mongo: 42 | volumes: 43 | - mongo-data:/data/db 44 | 45 | redis: 46 | volumes: 47 | - redis-data:/data 48 | ``` 49 | -------------------------------------------------------------------------------- /bin/backup-config: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | function usage() { 19 | echo "Usage: bin/backup-config [OPTIONS] [DESTINATION]" 20 | echo "" 21 | echo "Backup configuration files, to DESTINATION" 22 | echo "" 23 | echo "Options:" 24 | echo " -m mode: zip | tar | copy (default=copy)" 25 | echo "" 26 | echo "Examples:" 27 | echo "" 28 | echo " bin/backup-config -m zip ~/overleaf-config-backup.zip" 29 | echo "" 30 | echo " bin/backup-config -m tar ~/overleaf-config-backup.tar" 31 | echo "" 32 | echo " bin/backup-config -m copy ~/overleaf-config-backup" 33 | echo "" 34 | echo " bin/backup-config ~/overleaf-config-backup" 35 | echo "" 36 | } 37 | 38 | function __main__() { 39 | mode='copy' 40 | 41 | while getopts "m:" opt 42 | do 43 | case $opt in 44 | m ) mode="${OPTARG}" ;; 45 | \?) usage && exit ;; 46 | esac 47 | done 48 | shift $(( OPTIND -1 )) 49 | 50 | if [[ "${1:-null}" == "null" ]] \ 51 | || [[ "${1:-null}" == "help" ]] \ 52 | || [[ "${1:-null}" == "--help" ]] ; then 53 | usage && exit 54 | fi 55 | 56 | destination="$1" 57 | 58 | if [[ "$mode" == "copy" ]]; then 59 | cp -r "$TOOLKIT_ROOT/config" "$destination" 60 | elif [[ "$mode" == "zip" ]]; then 61 | zip -j -r "$destination" "$TOOLKIT_ROOT/config" 62 | elif [[ "$mode" == "tar" ]]; then 63 | tar -cf "$destination" -C "$TOOLKIT_ROOT" config 64 | else 65 | echo "Error: unrecognized mode '$mode'" 66 | exit 1 67 | fi 68 | } 69 | 70 | __main__ "$@" 71 | -------------------------------------------------------------------------------- /doc/sandboxed-compiles.md: -------------------------------------------------------------------------------- 1 | # Sandboxed Compiles 2 | 3 | In Server Pro, it is possible to have each LaTeX project be compiled in a separate docker container, achieving sandbox isolation between projects. 4 | 5 | This feature is also known as "Sibling containers" as LaTeX compiles are running in a sibling container next to the Server Pro docker container. 6 | 7 | When not using Sandboxed Compiles, users have full read and write access to the `sharelatex` container resources (filesystem, network, environment variables) when running LaTeX compiles. 8 | 9 | Note: 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. 10 | 11 | ## How It Works 12 | 13 | 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: 14 | 15 | - Write out the project files to a location inside the `OVERLEAF_DATA_PATH`, 16 | - Use the mounted docker socket to create a new `texlive` container for the compile run 17 | - Have the `texlive` container read the project data from the location under `OVERLEAF_DATA_PATH` 18 | - Compile the project inside the `texlive` container 19 | 20 | 21 | ## Enabling Sibling Containers 22 | 23 | In `config/overleaf.rc`, set `SIBLING_CONTAINERS_ENABLED=true`, and ensure that the `DOCKER_SOCKET_PATH` setting is set to the location of the docker socket on the host. 24 | 25 | The next time you start the docker services (with `bin/up`), the requested TeX Live image (`ALL_TEX_LIVE_DOCKER_IMAGES`) will get downloaded. This process can take several minutes. Once the images have been downloaded, the Server Pro container will get started with the latest configuration changes applied (such as enabling the Sandboxed Compiles feature or adding new TeX Live images). 26 | 27 | You can skip the download of images using `SIBLING_CONTAINERS_PULL=false` in `config/overleaf.rc`. 28 | 29 | Note: We do not support running sandboxed compiles with Docker as installed via `snap`. Please follow the steps for installing Docker CE on https://docs.docker.com/engine/install/. 30 | -------------------------------------------------------------------------------- /bin/run-script: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | 19 | function usage() { 20 | echo "Usage: 21 | bin/run-script [-e 'VAR1=value VAR2=value'] [SCRIPT...] [SCRIPT_ARGS..] 22 | bin/run-script [OPTIONS] 23 | 24 | Options: 25 | help prints this help 26 | ls prints a list of all available scripts 27 | -e space-separated list of environment variables (optional) 28 | 29 | Examples: 30 | bin/run-script scripts/create_project.js --user-id=649c3f45711ad101a13de737 31 | bin/run-script -e 'PROJECT_ID=5ac1011aa13de547c3fd' scripts/delete_dangling_file_refs.js 32 | bin/run-script ls" 33 | } 34 | 35 | 36 | function __main__() { 37 | local env_vars='' 38 | while getopts ":e:" opt 39 | do 40 | case $opt in 41 | e ) env_vars="${OPTARG}" ;; 42 | \?) usage && exit ;; 43 | : ) usage && exit ;; 44 | esac 45 | done 46 | shift $(( OPTIND -1 )) 47 | 48 | if [[ "${1:-null}" == "null" ]] \ 49 | || [[ "${1:-null}" == "help" ]] \ 50 | || [[ "${1:-null}" == "--help" ]] ; then 51 | usage && exit 52 | fi 53 | 54 | if [[ "${1:-null}" == "ls" ]] || [[ "${1:-null}" == "--ls" ]]; then 55 | # runs `ls` excluding dirs and adds the name of the directory as prefix 56 | local cmd="cd /overleaf/services/web && find scripts/ modules/server-ce-scripts/scripts/ -maxdepth 1 -type f" 57 | exec "$TOOLKIT_ROOT/bin/docker-compose" exec sharelatex bash -c "$cmd" 58 | exit 59 | fi 60 | 61 | local container_env="source /etc/overleaf/env.sh || source /etc/sharelatex/env.sh && source /etc/container_environment.sh" 62 | local run_cmd="${container_env} && cd /overleaf/services/web && ${env_vars} node $@" 63 | exec "$TOOLKIT_ROOT/bin/docker-compose" exec sharelatex bash -c "$run_cmd" 64 | } 65 | 66 | __main__ "$@" 67 | -------------------------------------------------------------------------------- /doc/saml.md: -------------------------------------------------------------------------------- 1 | # Overleaf SAML 2 | 3 | Available in Overleaf Server Pro is the ability to use a SAML server to manage users. 4 | 5 | SAML is configured in the Toolkit via [`variables.env`](./configuration.md). 6 | 7 | The `EXTERNAL_AUTH` variable must be set to `saml`, to enable the SAML module: 8 | 9 | ``` 10 | EXTERNAL_AUTH=saml 11 | ``` 12 | 13 | (To preserve backward compatibility with older configuration files, if 14 | `EXTERNAL_AUTH` is not set, but `SHARELATEX_SAML_ENTRYPOINT` is set (`SHARELATEX_LDAP_URL` for versions `4.x` and older), then the SAML 15 | module will be activated. We still recommend setting `EXTERNAL_AUTH` explicitely) 16 | 17 | 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. 18 | 19 | ## Example 20 | 21 | At Overleaf, we test the SAML integration against a SAML test server. The following is an example of a working configuration: 22 | 23 | ``` 24 | # added to variables.env 25 | # For versions of Overleaf CE/Server Pro `4.x` and older use the 'SHARELATEX_' prefix instead of 'OVERLEAF_' 26 | 27 | EXTERNAL_AUTH=saml 28 | OVERLEAF_SAML_ENTRYPOINT=http://localhost:8081/simplesaml/saml2/idp/SSOService.php 29 | OVERLEAF_SAML_CALLBACK_URL=http://saml/saml/callback 30 | OVERLEAF_SAML_ISSUER=sharelatex-test-saml 31 | OVERLEAF_SAML_IDENTITY_SERVICE_NAME=SAML Test Server 32 | OVERLEAF_SAML_EMAIL_FIELD=email 33 | OVERLEAF_SAML_FIRST_NAME_FIELD=givenName 34 | OVERLEAF_SAML_LAST_NAME_FIELD=sn 35 | OVERLEAF_SAML_UPDATE_USER_DETAILS_ON_LOGIN=true 36 | ``` 37 | 38 | 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: 39 | 40 | - Run `docker network create overleaf_default` (will possibly fail due to a `network with name overleaf_default already exists` error, that's ok). 41 | - Start `saml-test` container with some environment parameters: 42 | 43 | ``` 44 | docker run --network=overleaf_default --name=saml \ 45 | --publish='8081:80' \ 46 | --env SAML_BASE_URL_PATH='http://localhost:8081/simplesaml/' \ 47 | --env SAML_TEST_SP_ENTITY_ID='sharelatex-test-saml' \ 48 | --env SAML_TEST_SP_LOCATION='http://localhost/saml/callback' \ 49 | sharelatex/saml-test 50 | ``` 51 | 52 | - Edit `variables.env` to add the SAML Environment Variables as listed above. 53 | - Restart Server Pro. 54 | 55 | You should be able to login using `sally` as username and `sall123` as password. 56 | -------------------------------------------------------------------------------- /doc/ldap.md: -------------------------------------------------------------------------------- 1 | # LDAP 2 | 3 | Available in Overleaf Server Pro is the ability to use a LDAP server to manage users. It is also possible to use with Active Directory systems. 4 | 5 | LDAP is configured in the Toolkit via [`variables.env`](./configuration.md). 6 | 7 | The `EXTERNAL_AUTH` variable must be set to `ldap`, to enable the LDAP module: 8 | 9 | ``` 10 | EXTERNAL_AUTH=ldap 11 | ``` 12 | 13 | (To preserve backward compatibility with older configuration files, if 14 | `EXTERNAL_AUTH` is not set, but `OVERLEAF_LDAP_URL` is set (`SHARELATEX_LDAP_URL` for versions `4.x` and older), then the LDAP 15 | module will be activated. We still recommend setting `EXTERNAL_AUTH` explicitely) 16 | 17 | 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). 18 | 19 | LDAP users will appear in Overleaf Admin Panel once they log in first time with their initial credentials. 20 | 21 | The [Developer wiki](https://github.com/overleaf/overleaf/wiki/Server-Pro:-LDAP-Config) contains further documentation on the available Environment Variables and other configuration elements. 22 | 23 | ## Example 24 | 25 | At Overleaf, we test the LDAP integration against a [test openldap server](https://github.com/rroemhild/docker-test-openldap). The following is an example of a working configuration: 26 | 27 | ``` 28 | # added to variables.env 29 | # For versions of Overleaf CE/Server Pro `4.x` and older use the 'SHARELATEX_' prefix instead of 'OVERLEAF_' 30 | 31 | EXTERNAL_AUTH=ldap 32 | OVERLEAF_LDAP_URL=ldap://ldap:389 33 | OVERLEAF_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com 34 | OVERLEAF_LDAP_SEARCH_FILTER=(uid={{username}}) 35 | OVERLEAF_LDAP_BIND_DN=cn=admin,dc=planetexpress,dc=com 36 | OVERLEAF_LDAP_BIND_CREDENTIALS=GoodNewsEveryone 37 | OVERLEAF_LDAP_EMAIL_ATT=mail 38 | OVERLEAF_LDAP_NAME_ATT=cn 39 | OVERLEAF_LDAP_LAST_NAME_ATT=sn 40 | OVERLEAF_LDAP_UPDATE_USER_DETAILS_ON_LOGIN=true 41 | ``` 42 | 43 | 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: 44 | 45 | - Run `docker network create overleaf_default` (will possibly fail due to a `network with name overleaf_default already exists` error, that's ok). 46 | - Start `openldap` container with `docker run --network=overleaf_default --name=ldap rroemhild/test-openldap:1.1` 47 | - Edit `variables.env` to add the LDAP Environment Variables as listed above. 48 | - Restart Server Pro 49 | 50 | You should be able to login using `fry` as both username and password. 51 | -------------------------------------------------------------------------------- /doc/configuration.md: -------------------------------------------------------------------------------- 1 | # Configuration Overview 2 | 3 | This document describes the configuration files that are used to configure the Overleaf Toolkit. 4 | 5 | 6 | ## Configuration File Location 7 | 8 | All user-owned configuration files are found in the `config/` directory. 9 | This directory is excluded from the git revision control system, so it will not be changed by updating the toolkit code. The toolkit will not change any data in the `config/` directory without your permission. 10 | 11 | Note that changes to the configuration files will not be automatically applied 12 | to existing containers, even if the container is stopped and restarted (with 13 | `bin/stop` and `bin/start`). To apply the changes, run `bin/up`, and 14 | `docker compose` will automatically apply the configuration changes to a new 15 | container. (Or, run `bin/up -d`, if you prefer to not attach to the docker logs) 16 | 17 | 18 | ## Initializing the Configuration 19 | 20 | Run `bin/init` to initialize a new configuration, with sensible defaults. 21 | This script will not over-write any existing configuration files. 22 | 23 | 24 | ## Backing Up Your Configuration 25 | 26 | Use the `bin/backup-config` script to make a backup of your configuration files. 27 | For example: 28 | 29 | ```sh 30 | bin/backup-config -m zip ~/overleaf-config-backup.zip 31 | ``` 32 | 33 | 34 | ## The `overleaf.rc` File 35 | 36 | The `config/overleaf.rc` file is the most important contains the most important "top level" configuration in the toolkit. It contains statements that set variables, in the format `VARIABLE_NAME=value`. 37 | 38 | 39 | See [The full specification](./overleaf-rc.md) for more details on the supported options. 40 | 41 | Note: we recommend that you re-create the docker containers after changing anything in `overleaf.rc` or `variables.env`, by running `bin/docker-compose down`, followed by `bin/up` 42 | 43 | 44 | ## The `variables.env` File 45 | 46 | The `config/variables.env` file contains environment variables that are loaded into the overleaf docker container, and used to configure the overleaf microservices. These include the name of the application, as displayed in the header of the web interface, settings for sending emails, and settings for using LDAP with Server Pro. 47 | 48 | 49 | ## The `version` File 50 | 51 | The `config/version` file contains the version number of the docker images that will be used to create the running instance of Overleaf. 52 | 53 | 54 | ## The `docker-compose.override.yml` File 55 | 56 | If present, the `config/docker-compose.override.yml` file will be included in the invocation to `docker compose`. This is useful for overriding configuration specific to docker compose. 57 | 58 | See the [docker-compose documentation](https://docs.docker.com/compose/extends/#adding-and-overriding-configuration) for more details. 59 | -------------------------------------------------------------------------------- /doc/tls-proxy.md: -------------------------------------------------------------------------------- 1 | ## TLS Proxy for Overleaf Toolkit environment 2 | 3 | An optional TLS proxy for terminating https connections, based on NGINX. 4 | 5 | Run `bin/init --tls` to initialise local configuration with NGINX proxy configuration, or to add NGINX proxy configuration to an existing local configuration. A sample private key is created in `config/nginx/certs/overleaf_key.pem` and a dummy certificate in `config/nginx/certs/overleaf_certificate.pem`. Either replace these with your actual private key and certificate, or set the values of the `TLS_PRIVATE_KEY_PATH` and `TLS_CERTIFICATE_PATH` variables to the paths of your actual private key and certificate respectively. 6 | 7 | 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. 8 | 9 | Add the following section to your `config/overleaf.rc` file if it is not there already: 10 | ``` 11 | # TLS proxy configuration (optional) 12 | # See documentation in doc/tls-proxy.md 13 | NGINX_ENABLED=false 14 | NGINX_CONFIG_PATH=config/nginx/nginx.conf 15 | NGINX_HTTP_PORT=80 16 | # Replace these IP addresses with the external IP address of your host 17 | NGINX_HTTP_LISTEN_IP=127.0.1.1 18 | NGINX_TLS_LISTEN_IP=127.0.1.1 19 | TLS_PRIVATE_KEY_PATH=config/nginx/certs/overleaf_key.pem 20 | TLS_CERTIFICATE_PATH=config/nginx/certs/overleaf_certificate.pem 21 | TLS_PORT=443 22 | ``` 23 | In order to run the proxy, change the value of the `NGINX_ENABLED` variable in `config/overleaf.rc` from `false` to `true` and re-run `bin/up`. 24 | 25 | 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. 26 | 27 | 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`. 28 | 29 | ```mermaid 30 | sequenceDiagram 31 | participant user as User 32 | participant external as Host External 33 | participant internal as Host Internal 34 | participant nginx as nginx 35 | participant sharelatex as sharelatex 36 | %% User connects to external host HTTP 37 | user->>+ external: HTTP 38 | note over external: NGINX_HTTP_LISTEN_IP:NGINX_HTTP_PORT 39 | external->>+ nginx: HTTP 40 | note over nginx: nginx:80 41 | nginx-->>-external: 301 42 | %% User connects to external host HTTPS 43 | user->>+ external: HTTPS 44 | note over external: NGINX_TLS_LISTEN_IP:TLS_PORT 45 | external->>+ nginx: HTTPS 46 | note over nginx: nginx:443 47 | nginx->>+ sharelatex: HTTP 48 | note over sharelatex: sharlatex:80 49 | %% User connects to localhost HTTP 50 | user->>+ internal: HTTP 51 | note over internal: OVERLEAF_LISTEN_IP:OVERLEAF_PORT 52 | internal->>+sharelatex: HTTP 53 | note over sharelatex: sharlatex:80 54 | ``` 55 | -------------------------------------------------------------------------------- /doc/docker-compose.md: -------------------------------------------------------------------------------- 1 | # Working with Docker Compose Services 2 | 3 | The Overleaf Toolkit runs Overleaf inside a docker container, plus the 4 | supporting databases (MongoDB and Redis), in their own containers. All of this 5 | is orchestrated with `docker compose`. 6 | 7 | Note: for legacy reasons, the main Overleaf container is called `sharelatex`, 8 | and is based on the `sharelatex/sharelatex` docker image. This is because the 9 | technology is based on the ShareLaTeX code base, which was merged into Overleaf. 10 | See [this blog 11 | post](https://www.overleaf.com/blog/518-exciting-news-sharelatex-is-joining-overleaf) 12 | for more details. At some point in the future, this will be renamed to match the 13 | Overleaf naming scheme. 14 | 15 | 16 | ## The `bin/docker-compose` Wrapper 17 | 18 | The `bin/docker-compose` script is a wrapper around `docker compose`. It 19 | loads configuration from the `config/` directory, before invoking 20 | `docker compose` with whatever arguments were passed to the script. 21 | 22 | You can treat `bin/docker-compose` as a transparent wrapper for the 23 | `docker compose` program installed on your machine. 24 | 25 | For example, we can check which containers are running with the following: 26 | 27 | ``` 28 | $ bin/docker-compose ps 29 | ``` 30 | 31 | 32 | ## Convenience Helpers 33 | 34 | In addition to `bin/docker-compose`, the toolkit also provides a collection of 35 | convenient scripts to automate common tasks: 36 | 37 | - `bin/up`: shortcut for `bin/docker-compose up` 38 | - `bin/start`: shortcut for `bin/docker-compose start` 39 | - `bin/stop`: shortcut for `bin/docker-compose stop` 40 | - `bin/shell`: starts a shell inside the main container 41 | 42 | 43 | ## Architecture 44 | 45 | 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: 46 | 47 | - `/etc/service/`: initialisation files for the microservices 48 | - `/etc/overleaf/settings.js`: unified settings file for the microservices 49 | - `/var/log/overleaf/`: logs for each microservice 50 | - `/var/www/overleaf/`: code for the various microservices 51 | - `/var/lib/overleaf/`: the mount-point for persistent data (corresponds to the directory indicated by `OVERLEAF_DATA_PATH` on the host) 52 | 53 | Before Server Pro/Community Edition version 5.0, the paths used the ShareLaTeX brand. 54 | 55 | ## The MongoDB and Redis Containers 56 | 57 | Overleaf dedends on two external databases: MongoDB and Redis. By default, the toolkit will provision a container for each of these databases, in addition to the Overleaf container, for a total of three docker containers. 58 | 59 | If you would prefer to connect to an existing MongoDB or Redis instance, you can do so by setting the appropriate settings in the [overleaf.rc](./overleaf-rc.md) configuration file. 60 | 61 | 62 | ## Viewing Individual Micro-Service Logs 63 | 64 | The `bin/logs` script allows you to select individual log streams from inside the overleaf container. 65 | For example, if you want to see just the logs for the `web` and `clsi` (compiler) micro-services, run: 66 | 67 | ``` 68 | $ bin/logs -f web clsi 69 | ``` 70 | 71 | See the output of `bin/logs --help` for more options. 72 | -------------------------------------------------------------------------------- /doc/overview.md: -------------------------------------------------------------------------------- 1 | # Overleaf Toolkit Overview 2 | 3 | 4 | ## What is Overleaf? 5 | 6 | [Overleaf](https://overleaf.com) is an online collaborative writing and publishing tool that makes the whole process of writing, editing and publishing scientific documents much quicker and easier. Overleaf provides the convenience of an easy-to-use LaTeX editor with real-time collaboration and the fully compiled output produced automatically in the background as you type. 7 | 8 | 9 | ## What is the Overleaf Toolkit? 10 | 11 | The [Overleaf Toolkit](https://github.com/overleaf/toolkit) is a set of tools that allow anyone to run their own local version of Overleaf. The Overleaf software is distributed in [Docker](https://www.docker.com) images, while the toolkit manages the complexity of making those images run on your computer. 12 | 13 | 14 | ## What are "Community Edition" and "Server Pro"? 15 | 16 | Community Edition is the free version of Overleaf, while Server Pro is our enterprise offering, with more features and commercial support. Community Edition is distributed as a docker image on [Docker Hub](https://hub.docker.com/r/sharelatex/sharelatex), whereas Server Pro is distributed as a docker image on a private [quay.io](https://quay.io) registry. 17 | 18 | When you set up Overleaf using the toolkit, you will start with Community Edition, and can easily switch to Server Pro by changing just one setting. 19 | 20 | 21 | ## Docker, Docker Compose, and Overleaf 22 | 23 | The toolkit uses [Docker](https://www.docker.com) and [Docker Compose](https://docs.docker.com/compose/) to run the Overleaf software in an isolated sandbox. While we do recommend becoming familiar with both Docker and Docker Compose, we also aim to make it as easy as possible to run Overleaf on your own computer. 24 | 25 | 26 | ## How do I get the Toolkit? 27 | 28 | The toolkit is distributed as a git repository, here: https://github.com/overleaf/toolkit 29 | 30 | If you want to get started right now, we recommend you take a look at the 31 | [Quick-Start Guide](./quick-start-guide.md). 32 | 33 | 34 | ## Toolkit Structure 35 | 36 | If you take a look at the toolkit repository, you will see a file structure like this: 37 | 38 | ``` 39 | bin/ 40 | config/ 41 | data/ 42 | doc/ 43 | lib/ 44 | README.md 45 | ``` 46 | 47 | The `README.md` file contains some important information about the project. The `lib/` directory contains files that are internal to the toolkit, and users should not need to worry about. 48 | 49 | 50 | ### Data Files 51 | 52 | By default, the toolkit will put your overleaf data in the `data/` directory. This directory is ignored by git, so you don't need to worry about it being over-written by an update to the toolkit code. 53 | 54 | 55 | ### Configuration Files 56 | 57 | Your own configuration files will live in the `config/` directory. This directory is also ignored by git, so it won't be over-written by the toolkit. 58 | 59 | 60 | ### The `bin/` directory 61 | 62 | The `bin/` directory contains a collection of scripts, which will be your main interface to the toolkit system. We can start the Overleaf system with `bin/start`, we can check the logs with `bin/logs`, and we can back up our configuration with `bin/backup-config` 63 | 64 | 65 | ### Documentation 66 | 67 | You will find all the documentation you need in the `doc/` directory. This documentation can also be viewed online, here: https://github.com/overleaf/toolkit/tree/master/doc/ 68 | -------------------------------------------------------------------------------- /bin/init: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | function usage() { 19 | echo "Usage: bin/init [OPTION]" 20 | echo "" 21 | echo "Initialises local configuration files in the 'config/' directory" 22 | echo "" 23 | echo "--help display this help and exit" 24 | echo "--tls Initialises local configuration with NGINX config, or" 25 | echo " adds NGINX config to an existing local configuration" 26 | } 27 | 28 | function config_exists() { 29 | [ -f "$TOOLKIT_ROOT/config/overleaf.rc" ] \ 30 | || [ -f "$TOOLKIT_ROOT/config/variables.env" ] \ 31 | || [ -f "$TOOLKIT_ROOT/config/version" ] 32 | } 33 | 34 | function tls_config_exists() { 35 | [ -f "$TOOLKIT_ROOT/config/nginx/nginx.conf" ] \ 36 | || [ -f "$TOOLKIT_ROOT/config/nginx/certs/overleaf_certificate.pem" ] \ 37 | || [ -f "$TOOLKIT_ROOT/config/nginx/certs/overleaf_key.pem" ] 38 | } 39 | 40 | function set_up_config_files() { 41 | echo "Copying config files to 'config/'" 42 | cp "$TOOLKIT_ROOT/lib/config-seed/overleaf.rc" "$TOOLKIT_ROOT/config/" 43 | cp "$TOOLKIT_ROOT/lib/config-seed/variables.env" "$TOOLKIT_ROOT/config/" 44 | cp "$TOOLKIT_ROOT/lib/config-seed/version" "$TOOLKIT_ROOT/config/" 45 | } 46 | 47 | function set_up_tls_proxy() { 48 | PRIVATE_KEY="$TOOLKIT_ROOT/config/nginx/certs/overleaf_key.pem" 49 | CERT_SIGN_REQ="$TOOLKIT_ROOT/config/nginx/certs/overleaf_csr.pem" 50 | CERT="$TOOLKIT_ROOT/config/nginx/certs/overleaf_certificate.pem" 51 | echo "Generate example self-signed TLS cert" 52 | mkdir -p config/nginx/certs 53 | cp "$TOOLKIT_ROOT/lib/config-seed/nginx.conf" "$TOOLKIT_ROOT/config/nginx/" 54 | openssl req -new -nodes -keyout "$PRIVATE_KEY" -out "$CERT_SIGN_REQ" -subj "/CN=example.com" -batch 55 | chmod 600 "$PRIVATE_KEY" 56 | openssl x509 -req -days 365 -in "$CERT_SIGN_REQ" -signkey "$PRIVATE_KEY" -out "$CERT" 57 | } 58 | 59 | HELP=false 60 | TLS=false 61 | 62 | function __main__() { 63 | while [[ $# -gt 0 ]] ; do 64 | case "$1" in 65 | help | --help ) 66 | HELP=true 67 | shift 68 | ;; 69 | --tls ) 70 | TLS=true 71 | shift 72 | ;; 73 | *) 74 | echo "Unrecognised option $1" 75 | exit 76 | ;; 77 | esac 78 | done 79 | if [[ "$HELP" == "true" ]]; then 80 | usage 81 | exit 82 | fi 83 | if [[ "$TLS" == "true" ]]; then 84 | if tls_config_exists; then 85 | echo "ERROR: TLS config files already exist, exiting" 86 | exit 1 87 | else 88 | set_up_tls_proxy 89 | fi 90 | fi 91 | if config_exists; then 92 | if [[ "$TLS" == "true" ]]; then 93 | echo "Config files already exist, exiting" 94 | exit 0 95 | else 96 | echo "ERROR: Config files already exist, exiting" 97 | exit 1 98 | fi 99 | else 100 | set_up_config_files 101 | fi 102 | } 103 | 104 | __main__ "$@" 105 | -------------------------------------------------------------------------------- /doc/ce-upgrading-texlive.md: -------------------------------------------------------------------------------- 1 | # Community Edition: Upgrading TexLive 2 | 3 | To save bandwidth, the Overleaf image only comes with a minimal install of [TeX Live](https://www.tug.org/texlive/). You can install more packages or upgrade to a complete TeX Live installation using the [tlmgr](https://www.tug.org/texlive/tlmgr.html) command in the Overleaf container. 4 | 5 | Server Pro users have the option of using [Sandboxed Compiles](./sandboxed-compiles.md), which will automatically pull down a full TexLive image. The following instructions only apply to Community Edition installations. 6 | 7 | ## Getting inside the Overleaf container 8 | 9 | To start a shell inside the Overleaf container, run 10 | 11 | ``` 12 | $ bin/shell 13 | ``` 14 | 15 | You will get a prompt that looks like: 16 | ``` 17 | root@309b192d4030:/# 18 | ``` 19 | 20 | In the following instructions, we will assume that you are in the container. 21 | 22 | ## Determining your current TeX Live version 23 | 24 | TeX Live is released every year around the month of April. Steps for using `tlmgr` are different depending on whether you are using the current release or an older one. You can check which version of TeX Live you are running with `tlmgr --version`. For example, this installation runs TeX Live 2021: 25 | 26 | ``` 27 | # tlmgr --version 28 | tlmgr revision 59291 (2021-05-21 05:14:40 +0200) 29 | tlmgr using installation: /usr/local/texlive/2021 30 | TeX Live (https://tug.org/texlive) version 2021 31 | ``` 32 | 33 | The current release of TeX Live can be found on [the TeX Live homepage](https://www.tug.org/texlive/). 34 | 35 | If you are running an older TeX Live version, you have two options. We usually release a new version of the Overleaf docker image shortly after a TeX Live release. You can wait for it and [upgrade your image using the `bin/upgrade` script](https://github.com/overleaf/toolkit/blob/master/doc/upgrading.md). 36 | 37 | If you prefer to keep the older TeX Live release, you will first need to tell `tlmgr` to use a historic repository. You will find instructions for doing so [here](https://www.tug.org/texlive/acquire.html#past). 38 | 39 | ## Installing packages 40 | 41 | To install a complete TeX Live installation, run this command inside the Overleaf container: 42 | ``` 43 | # tlmgr install scheme-full 44 | ``` 45 | 46 | You can also install individual packages manually: 47 | 48 | ``` 49 | # tlmgr install tikzlings tikzmarmots tikzducks 50 | ``` 51 | 52 | **Important**: From `3.3.0` release onwards running `tlmgr path add` is required again after every use of `tlmgr install`, in order to correctly symlink all the binaries into the system path. 53 | 54 | Many more commands are available. Find out more with: 55 | 56 | ``` 57 | # tlmgr help 58 | ``` 59 | 60 | When you're done, type `exit` or press Control-D to exit the shell. 61 | 62 | ## Saving your changes 63 | 64 | The changes you've just made have changed the `sharelatex` container, but they are ephemeral --- they will be lost if Compose recreates the container, e.g. as part of updating the config. 65 | 66 | To make them persistent, use `docker commit` to save the changes to a new docker image: 67 | 68 | ``` 69 | $ cat config/version 70 | 5.0.3 71 | #^^^^ --------------- matching version ----------- | 72 | # vvvvv 73 | $ docker commit sharelatex sharelatex/sharelatex:5.0.3-with-texlive-full 74 | 75 | $ echo 5.0.3-with-texlive-full > config/version 76 | ``` 77 | 78 | After committing the changes, update the `config/version` accordingly. Then run `bin/up`, to recreate the container. 79 | 80 | Note that you will need to repeat these steps when you [upgrade](./upgrading.md). 81 | -------------------------------------------------------------------------------- /bin/up: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | # shellcheck source-path=.. 3 | 4 | set -euo pipefail 5 | 6 | #### Detect Toolkit Project Root #### 7 | # if realpath is not available, create a semi-equivalent function 8 | command -v realpath >/dev/null 2>&1 || realpath() { 9 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 10 | } 11 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 12 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 13 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 14 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 15 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 16 | exit 1 17 | fi 18 | 19 | source "$TOOLKIT_ROOT/lib/shared-functions.sh" 20 | 21 | function usage() { 22 | echo "Usage: bin/up [FLAGS...]" 23 | echo "" 24 | echo "A wrapper around 'docker compose up'." 25 | echo "" 26 | echo "This program will pass any extra flags to docker compose," 27 | echo "for example: 'bin/up -d' will run in detached mode" 28 | } 29 | 30 | function check_config() { 31 | if [[ ! -f "$TOOLKIT_ROOT/config/overleaf.rc" ]] \ 32 | || [[ ! -f "$TOOLKIT_ROOT/config/variables.env" ]]; then 33 | echo "Config files not found! exiting" 34 | exit 1 35 | fi 36 | } 37 | 38 | function ensure_data_dirs_exist() { 39 | mkdir -p "$TOOLKIT_ROOT/data/git-bridge" 40 | mkdir -p "$TOOLKIT_ROOT/data/mongo" 41 | mkdir -p "$TOOLKIT_ROOT/data/overleaf" 42 | mkdir -p "$TOOLKIT_ROOT/data/redis" 43 | } 44 | 45 | function initiate_mongo_replica_set() { 46 | echo "Initiating Mongo replica set..." 47 | env SKIP_WARNINGS=true "$TOOLKIT_ROOT/bin/docker-compose" up -d mongo 48 | env SKIP_WARNINGS=true "$TOOLKIT_ROOT/bin/docker-compose" exec -T mongo sh -c ' 49 | while ! '$MONGOSH' --eval "db.version()" > /dev/null; do 50 | echo "Waiting for Mongo..." 51 | sleep 1 52 | done 53 | '$MONGOSH' --eval "db.isMaster().primary || rs.initiate({ _id: \"overleaf\", members: [ { _id: 0, host: \"mongo:27017\" } ] })" > /dev/null' 54 | } 55 | 56 | function pull_sandboxed_compiles() { 57 | if [[ "${SIBLING_CONTAINERS_PULL:-true}" == "false" ]]; then 58 | echo "Skipping pulling of TeX Live images" 59 | return 60 | fi 61 | local images=$(read_variable "ALL_TEX_LIVE_DOCKER_IMAGES") 62 | if [[ -z "$images" ]]; then 63 | echo 64 | echo "Please configure ALL_TEX_LIVE_DOCKER_IMAGES in $TOOLKIT_ROOT/config/variables.env" 65 | echo 66 | echo "You can read more about configuring Sandboxed Compiles in our documentation:" 67 | echo " https://github.com/overleaf/overleaf/wiki/Server-Pro:-sandboxed-compiles#changing-the-texlive-image" 68 | echo 69 | exit 1 70 | fi 71 | echo "Pulling TeX Live images..." 72 | for image in ${images//,/ }; do 73 | echo " - $image download started (may take some time)" 74 | docker pull $image 75 | echo " - $image download finished" 76 | done 77 | } 78 | 79 | function notify_about_not_using_detach_mode() { 80 | local detached=false 81 | for arg in "$@"; do 82 | case "$arg" in 83 | -d|--detach) detached=true;; 84 | esac 85 | done 86 | if [[ "$detached" == false ]]; then 87 | echo 88 | echo '---' 89 | echo 90 | echo ' NOTICE: You are running "bin/up" without the detach mode ("-d" or "--detach" option). Behind the scenes, we will invoke "docker compose up", which will tail the container logs indefinitely until you issue a keyboard interrupt (CTRL+C).' 91 | echo 92 | echo '---' 93 | echo 94 | fi 95 | } 96 | 97 | function __main__() { 98 | if [[ "${1:-null}" == "help" ]] || [[ "${1:-null}" == "--help" ]]; then 99 | usage 100 | exit 101 | fi 102 | 103 | read_image_version 104 | SKIP_WARNINGS=true read_mongo_version 105 | check_config 106 | read_config 107 | 108 | ensure_data_dirs_exist 109 | 110 | if [[ "$MONGO_ENABLED" == "true" && "$IMAGE_VERSION_MAJOR" -ge 4 ]]; then 111 | initiate_mongo_replica_set 112 | fi 113 | 114 | if [[ $SERVER_PRO == "true" && "$SIBLING_CONTAINERS_ENABLED" == "true" ]]; then 115 | pull_sandboxed_compiles 116 | fi 117 | 118 | notify_about_not_using_detach_mode "$@" 119 | exec "$TOOLKIT_ROOT/bin/docker-compose" up "$@" 120 | } 121 | 122 | __main__ "$@" 123 | -------------------------------------------------------------------------------- /doc/docker-compose-to-toolkit-migration.md: -------------------------------------------------------------------------------- 1 | # docker-compose.yml to Toolkit migration # 2 | 3 | If you're currently using Docker Compose via a `docker-compose.yml` file, migrating to the Toolkit can make running an on-premises version of Overleaf easier to deploy, upgrade and maintain. 4 | 5 | To migrate, you'll need to convert your existing Docker Compose setup into the format used by the Toolkit. This process involves copying existing configuration into the Toolkit. 6 | 7 | This guide will walk you through each step of this process, ensuring a smooth migration from Docker Compose to the Toolkit. 8 | 9 | **Note:** These instructions are for v4.x and earlier. Therefore all variables use the `SHARELATEX_` prefix instead of `OVERLEAF_` 10 | 11 | ## Clone the Toolkit repository ## 12 | 13 | First, let's clone this Toolkit repository to the host machine: 14 | ``` 15 | $ git clone https://github.com/overleaf/toolkit.git ./overleaf-toolkit 16 | ``` 17 | Next run the `bin/init` command to initialise the Toolkit with its default configuration. 18 | 19 | ## Setting the image and version ## 20 | 21 | In the `docker-compose.yml` file the image and version are defined in the component description: 22 | 23 | ``` 24 | version: '2.2' 25 | services: 26 | sharelatex: 27 | restart: always 28 | # Server Pro users: 29 | # image: quay.io/sharelatex/sharelatex-pro 30 | image: sharelatex/sharelatex:3.5.13 31 | ``` 32 | 33 | When using the Toolkit, the image name is automatically resolved; the only requirement is to set `SERVER_PRO=true` in **config/overleaf.rc** to pick the Server Pro image or `SERVER_PRO=false` to use Community Edition. 34 | 35 | The desired Server Pro/Community Edition version number is set in the **config/version** file. The Toolkit requires a specific version number like "**4.2.3**". In case you are using `latest`, you can use `bin/images` to find the image id of your local `latest` version, then use the release notes for [2.x](https://github.com/overleaf/overleaf/wiki/Release-Notes-2.0), [3.x](https://github.com/overleaf/overleaf/wiki/Release-Notes-3.x.x), [4.x](https://github.com/overleaf/overleaf/wiki/Release-Notes--4.x.x) or [5.x](https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x) to map the image id to the version. 36 | 37 | If you are sourcing the image from your own internal registry you can override the image the Toolkit uses by setting `OVERLEAF_IMAGE_NAME`. You do not need to specify the tag as the Toolkit will automatically add it based on your **config/version** file. 38 | 39 | ## Configuring external access ## 40 | 41 | By default, Overleaf will listen on **127.0.0.1:80**, only allowing traffic from the Docker host machine. 42 | 43 | To allow external access, you’ll need to set the `OVERLEAF_LISTEN_IP` and `OVERLEAF_PORT` in the **config/overleaf.rc** file. 44 | 45 | ## Environment variable migration ## 46 | 47 | You’ll likely have a set of environment variables defined in the **sharelatex** service: 48 | 49 | ``` 50 | environment: 51 | SHARELATEX_APP_NAME: Overleaf Community Edition 52 | SHARELATEX_PROXY_LEARN: 'true' 53 | … 54 | ``` 55 | 56 | Each of these variables should be copied, with several exceptions we’ll list later, into the Toolkit’s **config/variables.env** file, ensuring the following form (note the use of `=` instead of `:`): 57 | 58 | ``` 59 | SHARELATEX_APP_NAME=Overleaf Community Edition 60 | SHARELATEX_PROXY_LEARN=true 61 | ``` 62 | 63 | As mentioned above, there are several exceptions, as certain features are configured differently when using the Toolkit: 64 | 65 | - Variables starting with `SANDBOXED_COMPILES_` and `DOCKER_RUNNER` are no longer needed. To enable [Sandboxed Compiles](./sandboxed-compiles.md), set `SIBLING_CONTAINERS_ENABLED=true` in your **config/overleaf.rc** file. 66 | - Variables starting with `SHARELATEX_MONGO_`, `SHARELATEX_REDIS_` and the `REDIS_HOST` variable are no longer needed. MongoDB and Redis are now configured in the **config/overleaf.rc** file using `MONGO_URL`, `REDIS_HOST` and `REDIS_PORT`. 67 | 68 | For advanced configuration options, refer to the [overleaf.rc](./overleaf-rc.md) documentation. 69 | 70 | ## NGINX Proxy ## 71 | 72 | For instructions on how to migrate `nginx`, please see [TLS Proxy for Overleaf Toolkit environment](tls-proxy.md) 73 | 74 | ## Volumes ## 75 | 76 | ### ShareLaTeX ### 77 | 78 | The location of the data volume for the `sharelatex` container will need to be set using `OVERLEAF_DATA_PATH` in the **config/overleaf.rc** file. 79 | 80 | In case you are bind-mounting the [application logs](https://github.com/overleaf/overleaf/wiki/Log-files), you can use `OVERLEAF_LOG_PATH` to configure the host path. 81 | 82 | ### MongoDB ### 83 | 84 | The location of the data volume for the `mongo` container will need to be set using `MONGO_DATA_PATH` in the **config/overleaf.rc** file. 85 | 86 | ### Redis ### 87 | 88 | The location of the data volume for the `redis` container will need to be set using `REDIS_DATA_PATH` in the **config/overleaf.rc** file. 89 | -------------------------------------------------------------------------------- /doc/the-doctor.md: -------------------------------------------------------------------------------- 1 | # The Doctor 2 | 3 | The Overleaf Toolkit comes with a handy `doctor` script, to help with debugging. Just run `bin/doctor` and the script will print out information about your host environment, your configuration, and the dependencies the toolkit needs. This output can also help the Overleaf support team to help you figure out what has gone wrong, in the case of a Server Pro installation. 4 | 5 | 6 | ## Getting Help 7 | 8 | Users of the free Community Edition should [open an issue on github](https://github.com/overleaf/toolkit/issues). 9 | 10 | Users of Server Pro should contact `support@overleaf.com` for assistance. 11 | 12 | In both cases, it is a good idea to include the output of the `bin/doctor` script in your message. 13 | 14 | 15 | ## Consulting with the Doctor 16 | 17 | Run the doctor script: 18 | 19 | ```sh 20 | $ bin/doctor 21 | ``` 22 | 23 | You will see some output like this: 24 | 25 | ``` 26 | ====== Overleaf Doctor ====== 27 | - Host Information 28 | - Linux 29 | - Output of 'lsb_release -a': 30 | No LSB modules are available. 31 | Distributor ID: Ubuntu 32 | Description: Ubuntu 20.04 LTS 33 | Release: 20.04 34 | Codename: focal 35 | - Dependencies 36 | - bash 37 | - status: present 38 | - version info: 5.0.17(1)-release 39 | - docker 40 | - status: present 41 | - version info: Docker version 23.0.6, build 369ce74a3c 42 | - docker compose 43 | - status: present 44 | - version info: Docker Compose version v2.17.3 45 | - realpath 46 | - status: present 47 | - version info: realpath (GNU coreutils) 8.30 48 | - perl 49 | - status: present 50 | - version info: 5.030000 51 | - awk 52 | - status: present 53 | - version info: GNU Awk 5.0.1, API: 2.0 (GNU MPFR 4.0.2, GNU MP 6.2.0) 54 | - Docker Daemon 55 | - status: up 56 | ====== Configuration ====== 57 | - config/version 58 | - status: present 59 | - version: 2.3.1 60 | - config/overleaf.rc 61 | - status: present 62 | - values 63 | - OVERLEAF_DATA_PATH: data/sharelatex 64 | - SERVER_PRO: false 65 | - MONGO_ENABLED: true 66 | - REDIS_ENABLED: true 67 | - config/variables.env 68 | - status: present 69 | ====== Warnings ====== 70 | - None, all good 71 | ====== End ====== 72 | ``` 73 | 74 | 75 | ### Host Information 76 | 77 | The `Host Information` section contains information about the machine on which the toolkit is running. This includes information about the type of Linux system being used. 78 | 79 | 80 | ### Dependencies 81 | 82 | The `Dependencies` section shows a list of tools which are required for the toolkit to work. 83 | If the tool is present on the system, it will be listed as `status: present`, along with the version of the tool. For example: 84 | 85 | ``` 86 | - docker 87 | - status: present 88 | - version info: Docker version 19.03.6, build 369ce74a3c 89 | ``` 90 | 91 | However, if the tool is missing, it will be listed as `status: MISSING!`, and a warning will be added to the bottom of the `doctor` output. For example: 92 | 93 | ``` 94 | - docker 95 | - status: MISSING! 96 | ``` 97 | 98 | If any of the dependencies are missing, the toolkit will almost certainly not work. 99 | 100 | 101 | ### Configuration 102 | 103 | The `Configuration` section contains information about the files in the `config/` directory. In the case of `config/overleaf.rc`, the doctor also prints out some of the more important values from the file. If any of the files are not present, they will be listed as `status: MISSING!`, and a warning will be added to the bottom of the `doctor` output. For example: 104 | 105 | ``` 106 | ====== Configuration ====== 107 | - config/version 108 | - status: present 109 | - version: 2.3.1 110 | - config/overleaf.rc 111 | - status: present 112 | - values 113 | - OVERLEAF_DATA_PATH: /tmp/sharelatex 114 | - SERVER_PRO: false 115 | - MONGO_ENABLED: false 116 | - REDIS_ENABLED: true 117 | - config/variables.env 118 | - status: MISSING! 119 | ``` 120 | 121 | The above example shows a few problems: 122 | 123 | - The `OVERLEAF_DATA_PATH` variable is set to `/tmp/sharelatex`, which is probably not a safe place to put important data 124 | - 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 125 | - the `config/variables.env` file is missing 126 | 127 | 128 | ### Warnings 129 | 130 | 131 | The `Warnings` section shows a summary of problems discovered by the doctor script. Or, if there are no problems, this section will say so. For example: 132 | 133 | ``` 134 | ====== Warnings ====== 135 | - configuration file variables.env not found 136 | - rc file, OVERLEAF_DATA_PATH not set 137 | ====== End ======= 138 | ``` 139 | 140 | -------------------------------------------------------------------------------- /bin/logs: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | source "$TOOLKIT_ROOT/lib/shared-functions.sh" 19 | 20 | DEFAULT_TAIL_LINES=20 21 | ALL_SERVICES=(chat clsi contacts docstore document-updater filestore git-bridge \ 22 | mongo notifications real-time redis spelling tags track-changes web \ 23 | history-v1 project-history) 24 | 25 | LOGS_PID_FILE="/tmp/toolkit-logs.$$.pid" 26 | 27 | function usage() { 28 | echo "Usage: bin/logs [OPTIONS] [SERVICES...] 29 | 30 | Services: chat, clsi, contacts, docstore, document-updater, filestore, 31 | git-bridge, mongo, notifications, real-time, redis, spelling, 32 | tags, track-changes, web, history-v1, project-history 33 | 34 | Options: 35 | -f follow log output 36 | -n {number} number of lines to print (default $DEFAULT_TAIL_LINES) 37 | use '-n all' to show all log lines 38 | 39 | Examples: 40 | 41 | bin/logs -n 50 web clsi 42 | 43 | bin/logs -n all web > web.log 44 | 45 | bin/logs -f web 46 | 47 | bin/logs -f web chat docstore 48 | 49 | bin/logs -n 100 -f filestore 50 | 51 | bin/logs -f" 52 | } 53 | 54 | function parse_args() { 55 | TAIL_LINES=$DEFAULT_TAIL_LINES 56 | FOLLOW=false 57 | 58 | if [[ $# -gt 0 && $1 =~ ^help|-h|--help$ ]]; then 59 | usage && exit 60 | fi 61 | 62 | while getopts "fn:" opt 63 | do 64 | case $opt in 65 | f) FOLLOW=true ;; 66 | n) TAIL_LINES="$OPTARG" ;; 67 | \?) usage && exit 1;; 68 | esac 69 | done 70 | shift $(( OPTIND - 1 )) 71 | 72 | if [[ $# -eq 0 ]]; then 73 | SERVICES=("${ALL_SERVICES[@]}") 74 | else 75 | SERVICES=("$@") 76 | fi 77 | } 78 | 79 | function docker_compose() { 80 | # Ignore stderr and errors when calling docker compose 81 | "$TOOLKIT_ROOT/bin/docker-compose" "$@" 2>/dev/null || true 82 | } 83 | 84 | function kill_background_jobs() { 85 | if [[ ${#COMPOSE_LOGS_PIDS[@]} -gt 0 ]]; then 86 | # Kill "docker compose logs" processes 87 | kill "${COMPOSE_LOGS_PIDS[@]}" 2>/dev/null || true 88 | fi 89 | 90 | # Kill "tail -f" processes started inside the sharelatex container 91 | docker_compose exec -T sharelatex bash -c " 92 | [[ -f $LOGS_PID_FILE ]] && kill \$(cat $LOGS_PID_FILE) 2>/dev/null 93 | rm -f $LOGS_PID_FILE" 94 | } 95 | 96 | function show_logs() { 97 | COMPOSE_LOGS_PIDS=() 98 | trap kill_background_jobs EXIT 99 | 100 | for service in "${SERVICES[@]}"; do 101 | if [[ $service =~ ^(git-bridge|mongo|redis)$ ]]; then 102 | show_compose_logs "$service" & 103 | COMPOSE_LOGS_PIDS+=($!) 104 | else 105 | show_sharelatex_logs "$service" & 106 | fi 107 | done 108 | 109 | wait 110 | } 111 | 112 | function show_compose_logs() { 113 | local service="$1" 114 | local flags=(--no-color) 115 | 116 | if [[ $FOLLOW == "true" ]]; then 117 | flags+=(-f) 118 | fi 119 | if [[ $TAIL_LINES != "all" ]]; then 120 | flags+=(--tail="$TAIL_LINES") 121 | fi 122 | if [[ ${#SERVICES[@]} -eq 1 ]]; then 123 | # Do not add a service prefix when outputting logs from a single 124 | # service 125 | flags+=(--no-log-prefix) 126 | fi 127 | 128 | docker_compose logs "${flags[@]}" "$service" 129 | } 130 | 131 | function show_sharelatex_logs() { 132 | local base_path=/var/log/overleaf 133 | if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then 134 | base_path=/var/log/sharelatex 135 | fi 136 | 137 | local service="$1" 138 | local log_path="${base_path}/$service.log" 139 | local flags=() 140 | 141 | if [[ $FOLLOW == "true" ]]; then 142 | flags+=(-f) 143 | fi 144 | if [[ $TAIL_LINES = "all" ]]; then 145 | flags+=(-n "+1") 146 | else 147 | flags+=(-n "$TAIL_LINES") 148 | fi 149 | 150 | local logs_cmd="[[ -f $log_path ]] && echo \$\$ >> $LOGS_PID_FILE && tail --pid=\$\$ ${flags[*]} $log_path" 151 | if [[ ${#SERVICES[@]} -gt 1 ]]; then 152 | # Roughly reproduce the service prefix format from docker compose 153 | local padded_service 154 | padded_service=$(printf "%-13s" "$service") 155 | logs_cmd="$logs_cmd | sed -u -e 's/^/$padded_service | /'" 156 | fi 157 | 158 | docker_compose exec -T sharelatex bash -c "$logs_cmd" 159 | } 160 | 161 | parse_args "$@" 162 | read_image_version 163 | show_logs 164 | -------------------------------------------------------------------------------- /lib/config-seed/variables.env: -------------------------------------------------------------------------------- 1 | OVERLEAF_APP_NAME="Our Overleaf Instance" 2 | 3 | ENABLED_LINKED_FILE_TYPES=project_file,project_output_file 4 | 5 | # Enables Thumbnail generation using ImageMagick 6 | ENABLE_CONVERSIONS=true 7 | 8 | # Disables email confirmation requirement 9 | EMAIL_CONFIRMATION_DISABLED=true 10 | 11 | ## Nginx 12 | # NGINX_WORKER_PROCESSES=4 13 | # NGINX_WORKER_CONNECTIONS=768 14 | 15 | ## Set for TLS via nginx-proxy 16 | # OVERLEAF_BEHIND_PROXY=true 17 | # OVERLEAF_SECURE_COOKIE=true 18 | 19 | # OVERLEAF_SITE_URL=http://overleaf.example.com 20 | # OVERLEAF_NAV_TITLE=Our Overleaf Instance 21 | # OVERLEAF_HEADER_IMAGE_URL=http://somewhere.com/mylogo.png 22 | # OVERLEAF_ADMIN_EMAIL=support@example.com 23 | 24 | # OVERLEAF_LEFT_FOOTER='[{"text": "Contact your support team", "url": "mailto:support@example.com"}]' 25 | # OVERLEAF_RIGHT_FOOTER='[{"text": "Hello, I am on the Right"}]' 26 | 27 | # OVERLEAF_EMAIL_FROM_ADDRESS=team@example.com 28 | 29 | # OVERLEAF_EMAIL_AWS_SES_ACCESS_KEY_ID= 30 | # OVERLEAF_EMAIL_AWS_SES_SECRET_KEY= 31 | 32 | # OVERLEAF_EMAIL_SMTP_HOST=smtp.example.com 33 | # OVERLEAF_EMAIL_SMTP_PORT=587 34 | # OVERLEAF_EMAIL_SMTP_SECURE=false 35 | # OVERLEAF_EMAIL_SMTP_USER= 36 | # OVERLEAF_EMAIL_SMTP_PASS= 37 | # OVERLEAF_EMAIL_SMTP_NAME= 38 | # OVERLEAF_EMAIL_SMTP_LOGGER=false 39 | # OVERLEAF_EMAIL_SMTP_TLS_REJECT_UNAUTH=true 40 | # OVERLEAF_EMAIL_SMTP_IGNORE_TLS=false 41 | # OVERLEAF_CUSTOM_EMAIL_FOOTER=This system is run by department x 42 | 43 | ################ 44 | ## Server Pro ## 45 | ################ 46 | 47 | EXTERNAL_AUTH=none 48 | # OVERLEAF_LDAP_URL=ldap://ldap:389 49 | # OVERLEAF_LDAP_SEARCH_BASE=ou=people,dc=planetexpress,dc=com 50 | # OVERLEAF_LDAP_SEARCH_FILTER=(uid={{username}}) 51 | # OVERLEAF_LDAP_BIND_DN=cn=admin,dc=planetexpress,dc=com 52 | # OVERLEAF_LDAP_BIND_CREDENTIALS=GoodNewsEveryone 53 | # OVERLEAF_LDAP_EMAIL_ATT=mail 54 | # OVERLEAF_LDAP_NAME_ATT=cn 55 | # OVERLEAF_LDAP_LAST_NAME_ATT=sn 56 | # OVERLEAF_LDAP_UPDATE_USER_DETAILS_ON_LOGIN=true 57 | 58 | # OVERLEAF_TEMPLATES_USER_ID=578773160210479700917ee5 59 | # OVERLEAF_NEW_PROJECT_TEMPLATE_LINKS=[{"name":"All Templates","url":"/templates/all"}] 60 | 61 | # TEX_LIVE_DOCKER_IMAGE=quay.io/sharelatex/texlive-full:2022.1 62 | # 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 63 | 64 | # OVERLEAF_PROXY_LEARN=true 65 | 66 | # S3 67 | # Docs: https://github.com/overleaf/overleaf/wiki/S3 68 | # ## Enable the s3 backend for filestore 69 | # OVERLEAF_FILESTORE_BACKEND=s3 70 | # ## Enable S3 backend for history 71 | # OVERLEAF_HISTORY_BACKEND=s3 72 | # # 73 | # # Pick one of the two sections "AWS S3" or "Self-hosted S3". 74 | # # 75 | # # AWS S3 76 | # ## Bucket name for project files 77 | # OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files 78 | # ## Bucket name for template files 79 | # OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files 80 | # ## Key for filestore user 81 | # OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=... 82 | # ## Secret for filestore user 83 | # OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=... 84 | # ## Bucket region you picked when creating the buckets. 85 | # OVERLEAF_FILESTORE_S3_REGION="" 86 | # ## Bucket name for project history blobs 87 | # OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs 88 | # ## Bucket name for history chunks 89 | # OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks 90 | # ## Key for history user 91 | # OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=... 92 | # ## Secret for history user 93 | # OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=... 94 | # ## Bucket region you picked when creating the buckets. 95 | # OVERLEAF_HISTORY_S3_REGION="" 96 | # 97 | # # Self-hosted S3 98 | # ## Bucket name for project files 99 | # OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME=overleaf-user-files 100 | # ## Bucket name for template files 101 | # OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME=overleaf-template-files 102 | # ## Key for filestore user 103 | # OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID=... 104 | # ## Secret for filestore user 105 | # OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY=... 106 | # ## S3 provider endpoint 107 | # OVERLEAF_FILESTORE_S3_ENDPOINT=http://10.10.10.10:9000 108 | # ## Path style addressing of buckets. Most likely you need to set this to "true". 109 | # OVERLEAF_FILESTORE_S3_PATH_STYLE="true" 110 | # ## Bucket region. Most likely you do not need to configure this. 111 | # OVERLEAF_FILESTORE_S3_REGION="" 112 | # ## Bucket name for project history blobs 113 | # OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET=overleaf-project-blobs 114 | # ## Bucket name for history chunks 115 | # OVERLEAF_HISTORY_CHUNKS_BUCKET=overleaf-chunks 116 | # ## Key for history user 117 | # OVERLEAF_HISTORY_S3_ACCESS_KEY_ID=... 118 | # ## Secret for history user 119 | # OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY=... 120 | # ## S3 provider endpoint 121 | # OVERLEAF_HISTORY_S3_ENDPOINT=http://10.10.10.10:9000 122 | # ## Path style addressing of buckets. Most likely you need to set this to "true". 123 | # OVERLEAF_HISTORY_S3_PATH_STYLE="true" 124 | # ## Bucket region. Most likely you do not need to configure this. 125 | # OVERLEAF_HISTORY_S3_REGION="" 126 | -------------------------------------------------------------------------------- /doc/quick-start-guide.md: -------------------------------------------------------------------------------- 1 | # Quick-Start Guide 2 | 3 | ## Prerequisites 4 | 5 | The Overleaf Toolkit depends on the following programs: 6 | 7 | - bash 8 | - docker 9 | 10 | We recommend that you install the most recent version of docker that is 11 | available on your system. 12 | 13 | 14 | ## Install 15 | 16 | First, let's clone this git repository to your machine: 17 | 18 | ```sh 19 | $ git clone https://github.com/overleaf/toolkit.git ./overleaf-toolkit 20 | ``` 21 | 22 | Next let's move into this directory: 23 | 24 | ```sh 25 | $ cd ./overleaf-toolkit 26 | ``` 27 | 28 | For the rest of this guide, we will assume that you will run all subsequent commands from this directory. 29 | 30 | 31 | ## Take a Look Around 32 | 33 | Let's take a look at the structure of the repository: 34 | 35 | ```sh 36 | $ ls -l 37 | ``` 38 | 39 | Which will print something like this: 40 | 41 | ``` 42 | bin 43 | CHANGELOG.md 44 | config 45 | data 46 | doc 47 | lib 48 | LICENSE 49 | README.md 50 | ``` 51 | 52 | The `README.md` file contains some useful information about the project, while the `doc` directory contains all of the documentation you will need to use the toolkit. The `config` directory will contain your own local configuration files (which we will create in just a moment), while the `bin` directory contains a collection of scripts that manage your overleaf instance. 53 | 54 | 55 | ## Initialise Configuration 56 | 57 | 58 | Let's create our local configuration, by running `bin/init`: 59 | 60 | ```sh 61 | $ bin/init 62 | ``` 63 | 64 | Now check the contents of the `config/` directory 65 | 66 | ```sh 67 | $ ls config 68 | overleaf.rc variables.env version 69 | ``` 70 | 71 | These are the three configuration files you will interact with: 72 | 73 | - `overleaf.rc` : the main top-level configuration file 74 | - `variables.env` : environment variables loaded into the docker container 75 | - `version` : the version of the docker images to use 76 | 77 | ## Selecting Overleaf Community Edition or Server Pro 78 | 79 | By default, the Overleaf Toolkit uses the free Overleaf Community Edition. 80 | 81 | Overleaf Server Pro is a commercial version of Overleaf, with extra features and commercial support. 82 | See https://www.overleaf.com/for/enterprises/features for more details about Server Pro and how to 83 | buy a license. 84 | 85 | In case you are a Server Pro customer, or want to set up a Server Pro trial instance, please follow the [docs on switching to Server Pro](getting-server-pro.md) before continuing with the next step. 86 | 87 | ## Starting Up 88 | 89 | The Overleaf Toolkit uses `docker compose` to manage the overleaf docker containers. The toolkit provides a set of scripts which wrap `docker compose`, and take care of most of the details for you. 90 | 91 | Let's start the docker services: 92 | 93 | ```sh 94 | $ bin/up 95 | ``` 96 | 97 | You should see some log output from the docker containers, indicating that the containers are running. 98 | If you press `CTRL-C` at the terminal, the services will shut down. You can start them up again (without attaching to the log output) by running `bin/start`. More generally, you can run `bin/docker-compose` to control the `docker compose` system directly, if you find that the convenience scripts don't cover your use-case. 99 | 100 | 101 | ## Create the first admin account 102 | 103 | In a browser, open . You should see a form with email and password fields. 104 | Fill these in with the credentials you want to use as the admin account, then click "Register". 105 | 106 | Then click the link to go to the login page (). Enter the credentials. 107 | Once you are logged in, you will be taken to a welcome page. 108 | 109 | Click the green button at the bottom of the page to start using Overleaf. 110 | 111 | 112 | ## Create your first project 113 | 114 | On the page, you will see a button prompting you to create your first 115 | project. Click the button and follow the instructions. 116 | 117 | You should then be taken to the new project, where you will see a text editor and a PDF preview. 118 | 119 | 120 | ## (Optional) Check the logs 121 | 122 | Let's look at the logs inside the container: 123 | 124 | 125 | ```sh 126 | $ bin/logs -f web 127 | ``` 128 | 129 | 130 | You can also look at the logs for multiple services at once: 131 | 132 | ```sh 133 | $ bin/logs -f filestore docstore web clsi 134 | ``` 135 | 136 | ## TLS Proxy 137 | 138 | The Overleaf Toolkit includes optional configuration to run an NGINX proxy, which presents Server Pro over HTTPS. Initial configuration can be generated by running 139 | ``` 140 | bin/init --tls 141 | ``` 142 | This creates minimal NGINX config in `config/nginx/nginx.conf` and a sample TLS certificate and private key in `config/nginx/certs/overleaf_certificate.pem` and `config/nginx/certs/overleaf_key.pem` respectively. If you already have a signed TLS certificate for use with Server Pro, replace the sample key and certificate with your key and certificate. 143 | 144 | In order to run the proxy, change the value of the `NGINX_ENABLED` variable in `config/overleaf.rc` from `false` to `true` and re-run `bin/up`. 145 | 146 | Further information about the TLS proxy can be found in the [docs](tls-proxy.md). 147 | 148 | 149 | ## Consulting the Doctor 150 | 151 | The Overleaf Toolkit comes with a handy tool for debugging your installation: `bin/doctor` 152 | 153 | Let's run the `bin/doctor` script: 154 | 155 | ```sh 156 | $ bin/doctor 157 | ``` 158 | 159 | We should see some output similar to this: 160 | 161 | ``` 162 | ====== Overleaf Doctor ====== 163 | - Host Information 164 | - Linux 165 | ... 166 | - Dependencies 167 | - bash 168 | - status: present 169 | - version info: 5.0.17(1)-release 170 | - docker 171 | - status: present 172 | - version info: Docker version 23.06.6, build 369ce74a3c 173 | - docker compose 174 | - status: present 175 | - version info: docker compose version v2.17.3 176 | ... 177 | ====== Configuration ====== 178 | ... 179 | ====== Warnings ====== 180 | - None, all good 181 | ====== End ====== 182 | ``` 183 | 184 | First, we see some information about the host system (the machine that the toolkit is being run on), then some information about dependencies. If any dependencies are missing, we will see a warning here. Next, the doctor checks our local configuration. At the end, the doctor will print out some warnings, if any problems were encountered. 185 | 186 | When you run into problems with your toolkit, you should first run the doctor script and check it's output. 187 | 188 | 189 | ## Getting Help 190 | 191 | Users of the free Community Edition should [open an issue on github](https://github.com/overleaf/toolkit/issues). 192 | 193 | Users of Server Pro should contact `support@overleaf.com` for assistance. 194 | 195 | In both cases, it is a good idea to include the output of the `bin/doctor` script in your message. 196 | -------------------------------------------------------------------------------- /doc/overleaf-rc.md: -------------------------------------------------------------------------------- 1 | # Configuration: `overleaf.rc` 2 | 3 | This document describes the variables that are supported in the `config/overleaf.rc` file. 4 | This file consists of variable definitions in the form `NAME=value`. Lines beginning with `#` are treated as comments. 5 | 6 | Note: we recommend that you re-create the docker containers after changing anything in `overleaf.rc` or `variables.env`, by running `bin/docker-compose down`, followed by `bin/up` 7 | 8 | ## Variables 9 | 10 | 11 | ### `PROJECT_NAME` 12 | 13 | Sets the value of the `--project-name` flag supplied to `docker-compose`. 14 | This is useful when running multiple instances of Overleaf on one host, as each instance can have a different project name. 15 | 16 | - Default: overleaf 17 | 18 | 19 | ### `OVERLEAF_DATA_PATH` 20 | 21 | Sets the path to the directory that will be mounted into the main `sharelatex` container, and used to store project and compile data. This can be either a full path (beginning with a `/`), or relative to the base directory of the toolkit. 22 | 23 | - Default: data/sharelatex 24 | 25 | ### `OVERLEAF_LOG_PATH` 26 | 27 | Sets the path to the directory that will be mounted into the main `sharelatex` container, and used for making application logs available on the Docker host. This can be either a full path (beginning with a `/`), or relative to the base directory of the toolkit. 28 | 29 | Remove the config entry to disable the bind-mount. When not set, logs will be discarded when recreating the container. 30 | 31 | - Default: not set 32 | 33 | ### `OVERLEAF_LISTEN_IP` 34 | 35 | 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. 36 | 37 | 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. 38 | 39 | 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). 40 | 41 | - Default: `127.0.0.1` 42 | 43 | ### `OVERLEAF_PORT` 44 | 45 | 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`. 46 | 47 | - Default: 80 48 | 49 | ### `OVERLEAF_IMAGE_NAME` 50 | 51 | Docker image as used by the Server Pro/CE application container. This is just the Docker image name, the Docker image tag is sourced from `config/version`. 52 | 53 | - Default: 54 | - Server Pro: `quay.io/sharelatex/sharelatex-pro` 55 | - Community Edition: `sharelatex/sharelatex` 56 | 57 | ### `SERVER_PRO` 58 | 59 | When set to `true`, tells the toolkit to use the Server Pro image (`quay.io/sharelatex/sharelatex-pro`), rather than the default Community Edition image (`sharelatex/sharelatex`). 60 | 61 | - Default: false 62 | 63 | 64 | ### `SIBLING_CONTAINERS_ENABLED` 65 | 66 | When set to `true`, tells the toolkit to use the "Sibling Containers" technique 67 | for compiling projects in separate sandboxes, using a separate docker container for 68 | each project. See [the legacy documentation on Sandboxed Compiles](https://github.com/sharelatex/sharelatex/wiki/Server-Pro:-sandboxed-compiles) for more information. 69 | 70 | Requires `SERVER_PRO=true` 71 | 72 | - Default: false 73 | 74 | 75 | ### `DOCKER_SOCKET_PATH` 76 | 77 | Sets the path to the docker socket on the host machine (the machine running the toolkit code). When `SIBLING_CONTAINERS_ENABLED` is `true`, the socket will be mounted into the container, to allow the compiler service to spawn new docker containers on the host. 78 | 79 | Requires `SIBLING_CONTAINERS_ENABLED=true` 80 | 81 | - Default: /var/run/docker.sock 82 | 83 | ### `GIT_BRIDGE_ENABLED` 84 | 85 | Set to `true` to enable the git-bridge feature (Server Pro only). 86 | 87 | User documentation: https://www.overleaf.com/learn/how-to/Git_integration 88 | 89 | - Default: false 90 | 91 | ### `GIT_BRIDGE_IMAGE` 92 | 93 | Docker image as used by the git-bridge container (Server Pro only). This is just the Docker image name, the Docker image tag is sourced from `config/version`. 94 | 95 | - Default: `quay.io/sharelatex/git-bridge` 96 | 97 | ### `GIT_BRIDGE_DATA_PATH` 98 | 99 | Sets the path to the directory that will be mounted into the `git-bridge` container (Server Pro only), and used to store the git-repositories. This can be either a full path (beginning with a `/`), or relative to the base directory of the toolkit. 100 | 101 | - Default: data/git-bridge 102 | 103 | ### `GIT_BRIDGE_LOG_LEVEL` 104 | 105 | Configure the logging level of the `git-bridge` container. Available levels: `TRACE`, `DEBUG`, `INFO`, `WARN`, `ERROR`. 106 | 107 | - Default: INFO 108 | 109 | ### `MONGO_ENABLED` 110 | 111 | When set to `true`, tells the toolkit to create a MongoDB container, to host the database. 112 | When set to `false`, this container will not be created, and the system will use the MongoDB database specified by `MONGO_URL` instead. 113 | 114 | - Default: true 115 | 116 | 117 | ### `MONGO_URL` 118 | 119 | Specifies the MongoDB connection URL to use when `MONGO_ENABLED` is `false` 120 | 121 | - Default: not set 122 | 123 | 124 | ### `MONGO_DATA_PATH` 125 | 126 | Sets the path to the directory that will be mounted into the `mongo` container, and used to store the MongoDB database. This can be either a full path (beginning with a `/`), or relative to the base directory of the toolkit. This option only affects the local `mongo` container that is created when `MONGO_ENABLED` is `true`. 127 | 128 | - Default: data/mongo 129 | 130 | ### `MONGO_IMAGE` 131 | 132 | Docker image as used by the MongoDB container. This is just the name of the Docker image, the Docker image tag should go into `MONGO_VERSION` (see below). 133 | 134 | - Default: `mongo` 135 | 136 | ### `MONGO_VERSION` 137 | 138 | MongoDB version as used by the MongoDB container. The value must start with the major MongoDB version and a dot, e.g. `6.0` or `6.0-with-suffix`. 139 | 140 | - Default: `6.0` 141 | 142 | ### `REDIS_ENABLED` 143 | 144 | When set to `true`, tells the toolkit to create a Redis container, to host the redis database. 145 | When set to `false`, this container will not be created, and the system will use the Redis database specified by `REDIS_HOST` and `REDIS_PORT` instead. 146 | 147 | - Default: true 148 | 149 | 150 | ### `REDIS_HOST` 151 | 152 | Specifies the Redis host to use when `REDIS_ENABLED` is `false` 153 | 154 | - Default: not set 155 | 156 | 157 | ### `REDIS_PORT` 158 | 159 | Specifies the Redis port to use when `REDIS_ENABLED` is `false` 160 | 161 | - Default: not set 162 | 163 | 164 | ### `REDIS_DATA_PATH` 165 | 166 | Sets the path to the directory that will be mounted into the `redis` container, and used to store the Redis database. This can be either a full path (beginning with a `/`), or relative to the base directory of the toolkit. This option only affects the local `redis` container that is created when `REDIS_ENABLED` is `true`. 167 | 168 | - Default: data/redis 169 | 170 | ### `REDIS_IMAGE` 171 | 172 | Docker image as used by the Redis container. 173 | 174 | - Default: `redis:6.2` 175 | 176 | ### `REDIS_AOF_PERSISTENCE` 177 | 178 | Turn on AOF (Append Only File) persistence for Redis. This is the recommended configuration for Redis persistence. 179 | 180 | For additional details, see https://github.com/overleaf/overleaf/wiki/Data-and-Backups/#redis 181 | 182 | - Default: true 183 | 184 | ### `NGINX_ENABLED` 185 | 186 | When set to `true`, tells the toolkit to create an NGINX container, to act as a [TLS Proxy](tls-proxy.md). 187 | 188 | - Default: false 189 | 190 | ### `NGINX_CONFIG_PATH` 191 | 192 | Path to the NGINX config file to use for the [TLS Proxy](tls-proxy.md). 193 | 194 | - Default: config/nginx/nginx.conf 195 | 196 | ### `TLS_PRIVATE_KEY_PATH` 197 | 198 | Path to the private key to use for the [TLS Proxy](tls-proxy.md). 199 | 200 | - Default: config/nginx/certs/overleaf_key.pem 201 | 202 | ### `TLS_CERTIFICATE_PATH` 203 | 204 | Path to the public certificate to use for the [TLS Proxy](tls-proxy.md). 205 | 206 | - Default: config/nginx/certs/overleaf_certificate.pem 207 | 208 | ### `NGINX_TLS_LISTEN_IP` 209 | 210 | Sets the host IP address(es) that the [TLS Proxy](tls-proxy.md) container will bind to for https. For example, if this is set to `0.0.0.0` then the https web interface will be available on any host IP address. 211 | 212 | Typically this should be set to the external IP of your host. 213 | 214 | - Default: `127.0.1.1` 215 | 216 | ### `TLS_PORT` 217 | 218 | Sets the host port that the [TLS Proxy](tls-proxy.md) container will bind to for https. 219 | 220 | - Default: 443 221 | 222 | ### `NGINX_HTTP_LISTEN_IP` 223 | 224 | 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. 225 | 226 | 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`. 227 | 228 | - Default: `127.0.1.1` 229 | 230 | ### `NGINX_HTTP_PORT` 231 | 232 | Sets the host port that the [TLS Proxy](tls-proxy.md) container will bind to for http. 233 | 234 | - Default: `80` -------------------------------------------------------------------------------- /bin/docker-compose: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | # shellcheck source-path=.. 3 | 4 | set -euo pipefail 5 | 6 | #### Detect Toolkit Project Root #### 7 | # if realpath is not available, create a semi-equivalent function 8 | command -v realpath >/dev/null 2>&1 || realpath() { 9 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 10 | } 11 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 12 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 13 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 14 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 15 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 16 | exit 1 17 | fi 18 | 19 | source "$TOOLKIT_ROOT/lib/shared-functions.sh" 20 | 21 | function build_environment() { 22 | canonicalize_data_paths 23 | set_base_vars 24 | 25 | if [[ $REDIS_ENABLED == "true" ]]; then 26 | set_redis_vars 27 | fi 28 | if [[ $MONGO_ENABLED == "true" ]]; then 29 | set_mongo_vars 30 | fi 31 | if [[ "$SIBLING_CONTAINERS_ENABLED" == "true" ]]; then 32 | if [[ $SERVER_PRO == "true" ]]; then 33 | set_sibling_containers_vars 34 | else 35 | if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then 36 | echo "WARNING: SIBLING_CONTAINERS_ENABLED=true is not supported in Overleaf Community Edition." >&2 37 | 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 38 | 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 39 | 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 40 | echo " Falling back using insecure in-container compiles. Set SIBLING_CONTAINERS_ENABLED=false in config/overleaf.rc to silence this warning." >&2 41 | fi 42 | fi 43 | fi 44 | if [[ "${OVERLEAF_LOG_PATH:-null}" != "null" ]]; then 45 | set_logging_vars 46 | fi 47 | if [[ $NGINX_ENABLED == "true" ]]; then 48 | set_nginx_vars 49 | fi 50 | if [[ $GIT_BRIDGE_ENABLED == "true" ]]; then 51 | set_git_bridge_vars 52 | fi 53 | 54 | # Include docker-compose.override.yml if it is present 55 | if [[ -f "$TOOLKIT_ROOT/config/docker-compose.override.yml" ]]; then 56 | DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/config/docker-compose.override.yml") 57 | fi 58 | } 59 | 60 | function canonicalize_data_paths() { 61 | OVERLEAF_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$OVERLEAF_DATA_PATH") 62 | if [[ "${OVERLEAF_LOG_PATH:-null}" != "null" ]]; then 63 | OVERLEAF_LOG_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$OVERLEAF_LOG_PATH") 64 | fi 65 | MONGO_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$MONGO_DATA_PATH") 66 | REDIS_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$REDIS_DATA_PATH") 67 | GIT_BRIDGE_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$GIT_BRIDGE_DATA_PATH") 68 | } 69 | 70 | # Set environment variables for docker-compose.base.yml 71 | function set_base_vars() { 72 | DOCKER_COMPOSE_FLAGS=(-f "$TOOLKIT_ROOT/lib/docker-compose.base.yml") 73 | if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then 74 | DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.vars-legacy.yml") 75 | else 76 | DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.vars.yml") 77 | fi 78 | 79 | set_server_pro_image_name "$IMAGE_VERSION" 80 | 81 | if [[ ${OVERLEAF_LISTEN_IP:-null} == "null" ]]; 82 | then 83 | if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then 84 | 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 85 | fi 86 | OVERLEAF_LISTEN_IP="0.0.0.0" 87 | fi 88 | export OVERLEAF_LISTEN_IP 89 | 90 | HAS_WEB_API=false 91 | if [[ $IMAGE_VERSION_MAJOR -gt 4 ]]; then 92 | HAS_WEB_API=true 93 | elif [[ $IMAGE_VERSION_MAJOR == 4 && $IMAGE_VERSION_MINOR -ge 2 ]]; then 94 | HAS_WEB_API=true 95 | fi 96 | 97 | OVERLEAF_IN_CONTAINER_DATA_PATH=/var/lib/overleaf 98 | if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then 99 | OVERLEAF_IN_CONTAINER_DATA_PATH=/var/lib/sharelatex 100 | fi 101 | 102 | export GIT_BRIDGE_ENABLED 103 | export MONGO_URL 104 | export REDIS_HOST 105 | export REDIS_PORT 106 | export OVERLEAF_DATA_PATH 107 | export OVERLEAF_PORT 108 | export OVERLEAF_IN_CONTAINER_DATA_PATH 109 | 110 | } 111 | 112 | # Set environment variables for docker-compose.redis.yml 113 | function set_redis_vars() { 114 | DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.redis.yml") 115 | export REDIS_IMAGE 116 | export REDIS_DATA_PATH 117 | 118 | if [[ -z "${REDIS_AOF_PERSISTENCE:-}" ]]; then 119 | if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then 120 | echo "WARNING: the value of REDIS_AOF_PERSISTENCE is not set in config/overleaf.rc" 121 | echo " See https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#redis-aof-persistence-enabled-by-default" 122 | fi 123 | REDIS_COMMAND="redis-server" 124 | elif [[ $REDIS_AOF_PERSISTENCE == "true" ]]; then 125 | REDIS_COMMAND="redis-server --appendonly yes" 126 | else 127 | REDIS_COMMAND="redis-server" 128 | fi 129 | export REDIS_COMMAND 130 | } 131 | 132 | # Set environment variables for docker-compose.mongo.yml 133 | function set_mongo_vars() { 134 | DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.mongo.yml") 135 | 136 | if [[ $MONGO_ENABLED == "true" && $IMAGE_VERSION_MAJOR -ge 4 ]]; then 137 | MONGO_ARGS="--replSet overleaf" 138 | else 139 | MONGO_ARGS="" 140 | fi 141 | export MONGO_ARGS 142 | 143 | export MONGO_DATA_PATH 144 | export MONGO_DOCKER_IMAGE 145 | export MONGOSH 146 | } 147 | 148 | # Set environment variables for docker-compose.sibling-containers.yml 149 | function set_sibling_containers_vars() { 150 | DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.sibling-containers.yml") 151 | export DOCKER_SOCKET_PATH 152 | export OVERLEAF_DATA_PATH 153 | } 154 | 155 | # Set environment variables for docker-compose.logging.yml 156 | function set_logging_vars() { 157 | DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.logging.yml") 158 | 159 | if [[ $IMAGE_VERSION_MAJOR -ge 5 ]]; then 160 | OVERLEAF_IN_CONTAINER_LOG_PATH="/var/log/overleaf" 161 | else 162 | OVERLEAF_IN_CONTAINER_LOG_PATH="/var/log/sharelatex" 163 | fi 164 | export OVERLEAF_IN_CONTAINER_LOG_PATH 165 | export OVERLEAF_LOG_PATH 166 | } 167 | 168 | # Set environment variables for docker-compose.nginx.yml 169 | function set_nginx_vars() { 170 | DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.nginx.yml") 171 | 172 | if [[ -n ${TLS_PRIVATE_KEY_PATH-} ]]; then 173 | TLS_PRIVATE_KEY_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$TLS_PRIVATE_KEY_PATH") 174 | fi 175 | if [[ -n ${TLS_CERTIFICATE_PATH-} ]]; then 176 | TLS_CERTIFICATE_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$TLS_CERTIFICATE_PATH") 177 | fi 178 | if [[ -n ${NGINX_CONFIG_PATH-} ]]; then 179 | NGINX_CONFIG_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$NGINX_CONFIG_PATH") 180 | fi 181 | OVERLEAF_TRUSTED_PROXY_IPS=$(read_variable OVERLEAF_TRUSTED_PROXY_IPS || echo "") 182 | if [[ "${OVERLEAF_TRUSTED_PROXY_IPS:-null}" == "null" ]]; then 183 | # https://en.wikipedia.org/wiki/Private_network 184 | # Docker allocates subnets from 172.16.0.0/12 by default. 185 | OVERLEAF_TRUSTED_PROXY_IPS="loopback,172.16.0.0/12" 186 | fi 187 | 188 | export NGINX_CONFIG_PATH 189 | export NGINX_IMAGE 190 | export NGINX_HTTP_PORT 191 | export NGINX_HTTP_LISTEN_IP 192 | export NGINX_TLS_LISTEN_IP 193 | export TLS_CERTIFICATE_PATH 194 | export TLS_PORT 195 | export TLS_PRIVATE_KEY_PATH 196 | export OVERLEAF_TRUSTED_PROXY_IPS 197 | } 198 | 199 | # Set environment variables for docker-compose.git-bridge.yml 200 | function set_git_bridge_vars() { 201 | set_git_bridge_image_name "$IMAGE_VERSION" 202 | 203 | GIT_BRIDGE_API_BASE_URL="http://sharelatex/api/v0/" 204 | if [[ $HAS_WEB_API == "true" ]]; then 205 | GIT_BRIDGE_API_BASE_URL="http://sharelatex:3000/api/v0/" 206 | fi 207 | 208 | DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.git-bridge.yml") 209 | export GIT_BRIDGE_API_BASE_URL 210 | export GIT_BRIDGE_DATA_PATH 211 | export GIT_BRIDGE_LOG_LEVEL 212 | } 213 | 214 | function print_debug_info() { 215 | if [[ ${RC_DEBUG:-null} != "null" ]]; then 216 | echo ">>>>>>VARS>>>>>>" 217 | echo "$(set -o posix; set)" # print all vars 218 | echo "IMAGE_VERSION=$IMAGE_VERSION" 219 | echo "<<<<<<<<<<<<<<<<" 220 | echo ">>>>COMPOSE-ARGS>>>>" 221 | echo "-p $PROJECT_NAME" 222 | echo "${DOCKER_COMPOSE_FLAGS[@]}" 223 | echo "$@" 224 | echo "<<<<<<<<<<<<<<<<<<<<" 225 | fi 226 | } 227 | 228 | function docker_compose() { 229 | local flags=(-p "$PROJECT_NAME" "${DOCKER_COMPOSE_FLAGS[@]}" "$@") 230 | if docker compose version >/dev/null 2>&1; then 231 | # Docker compose v2 is available 232 | exec docker compose "${flags[@]}" 233 | elif command -v docker-compose >/dev/null; then 234 | # Fall back to docker-compose v1 235 | if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then 236 | 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 237 | fi 238 | exec docker-compose "${flags[@]}" 239 | else 240 | echo "ERROR: Could not find Docker Compose." >&2 241 | exit 1 242 | fi 243 | } 244 | 245 | read_image_version 246 | read_mongo_version 247 | read_config 248 | check_retracted_version 249 | check_sharelatex_env_vars 250 | build_environment 251 | print_debug_info "$@" 252 | docker_compose "$@" 253 | -------------------------------------------------------------------------------- /lib/shared-functions.sh: -------------------------------------------------------------------------------- 1 | # shellcheck shell=bash 2 | # shellcheck disable=SC2034 3 | # shellcheck source-path=.. 4 | 5 | function read_config() { 6 | source "$TOOLKIT_ROOT/lib/default.rc" 7 | # shellcheck source=/dev/null 8 | source "$TOOLKIT_ROOT/config/overleaf.rc" 9 | 10 | if [[ $SERVER_PRO != "true" || $IMAGE_VERSION_MAJOR -lt 4 ]]; then 11 | # Force git bridge to be disabled if not ServerPro >= 4 12 | GIT_BRIDGE_ENABLED=false 13 | fi 14 | } 15 | 16 | function read_image_version() { 17 | IMAGE_VERSION="$(head -n 1 "$TOOLKIT_ROOT/config/version")" 18 | if [[ ! "$IMAGE_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9])+(-RC[0-9]*)?(-with-texlive-full)?$ ]]; then 19 | echo "ERROR: invalid version '${IMAGE_VERSION}'" 20 | exit 1 21 | fi 22 | IMAGE_VERSION_MAJOR=${BASH_REMATCH[1]} 23 | IMAGE_VERSION_MINOR=${BASH_REMATCH[2]} 24 | IMAGE_VERSION_PATCH=${BASH_REMATCH[3]} 25 | } 26 | 27 | function read_mongo_version() { 28 | local mongo_image=$(read_configuration "MONGO_IMAGE") 29 | local mongo_version=$(read_configuration "MONGO_VERSION") 30 | if [ -z "${mongo_version}" ]; then 31 | if [[ "$mongo_image" =~ ^mongo:([0-9]+)\.(.*)$ ]]; then 32 | # when running a chain of commands (example: bin/up -> bin/docker-compose) we're passing 33 | # SKIP_WARNINGS=true to prevent the warning message to be printed several times 34 | if [[ ${SKIP_WARNINGS:-null} != "true" ]]; then 35 | echo "------------------- WARNING ----------------------" 36 | echo " Deprecation warning: the mongo image is now split between MONGO_IMAGE" 37 | echo " and MONGO_VERSION configurations. Please update your config/overleaf.rc as" 38 | echo " your current configuration may stop working in future versions of the toolkit." 39 | echo " Example: MONGO_IMAGE=mongo" 40 | echo " MONGO_VERSION=6.0" 41 | echo "------------------- WARNING ----------------------" 42 | fi 43 | MONGO_VERSION_MAJOR=${BASH_REMATCH[1]} 44 | MONGO_DOCKER_IMAGE="$mongo_image" 45 | else 46 | echo "--------------------- ERROR -----------------------" 47 | echo " The mongo image is now split between MONGO_IMAGE and MONGO_VERSION configurations." 48 | echo " Please update your config/overleaf.rc." 49 | echo "" 50 | echo " MONGO_VERSION must start with the actual major version of mongo, followed by a dot." 51 | echo " Example: MONGO_IMAGE=my.dockerhub.com/custom-mongo" 52 | echo " MONGO_VERSION=6.0-custom" 53 | echo "--------------------- ERROR -----------------------" 54 | exit 1 55 | fi 56 | else 57 | if [[ ! "$mongo_version" =~ ^([0-9]+)\.(.+)$ ]]; then 58 | echo "--------------------- ERROR -----------------------" 59 | echo " Invalid MONGO_VERSION: $mongo_version" 60 | echo "" 61 | echo " MONGO_VERSION must start with the actual major version of mongo, followed by a dot." 62 | echo " Example: MONGO_IMAGE=my.dockerhub.com/custom-mongo" 63 | echo " MONGO_VERSION=6.0-custom" 64 | echo "--------------------- ERROR -----------------------" 65 | exit 1 66 | fi 67 | MONGO_VERSION_MAJOR=${BASH_REMATCH[1]} 68 | MONGO_DOCKER_IMAGE="$mongo_image:$mongo_version" 69 | fi 70 | 71 | if [[ "$MONGO_VERSION_MAJOR" -lt 6 ]]; then 72 | MONGOSH="mongo" 73 | else 74 | MONGOSH="mongosh" 75 | fi 76 | } 77 | 78 | function set_server_pro_image_name() { 79 | local version=$1 80 | local image_name 81 | if [[ -n ${OVERLEAF_IMAGE_NAME:-} ]]; then 82 | image_name="$OVERLEAF_IMAGE_NAME" 83 | elif [[ $SERVER_PRO == "true" ]]; then 84 | image_name="quay.io/sharelatex/sharelatex-pro" 85 | else 86 | image_name="sharelatex/sharelatex" 87 | fi 88 | export IMAGE="$image_name:$version" 89 | } 90 | 91 | function set_git_bridge_image_name() { 92 | local version=$1 93 | local image_name 94 | if [[ -n ${GIT_BRIDGE_IMAGE:-} ]]; then 95 | image_name="$GIT_BRIDGE_IMAGE" 96 | else 97 | image_name="quay.io/sharelatex/git-bridge" 98 | fi 99 | 100 | # since we're reusing the GIT_BRIDGE_IMAGE environment variable, we check here if the version 101 | # has already been added to it, for scenarios where this function is called more than once 102 | if [[ "$image_name" == *"$version" ]]; then 103 | export GIT_BRIDGE_IMAGE="$image_name" 104 | else 105 | export GIT_BRIDGE_IMAGE="$image_name:$version" 106 | fi 107 | 108 | } 109 | 110 | function check_retracted_version() { 111 | if [[ "${OVERLEAF_SKIP_RETRACTION_CHECK:-null}" == "$IMAGE_VERSION" ]]; then 112 | return 113 | fi 114 | 115 | local version="$IMAGE_VERSION_MAJOR.$IMAGE_VERSION_MINOR.$IMAGE_VERSION_PATCH" 116 | if [[ "$version" == "5.0.1" ]]; then 117 | echo "-------------------------------------------------------" 118 | echo "--------------------- WARNING -----------------------" 119 | echo "-------------------------------------------------------" 120 | echo " You are currently using a retracted version, $version." 121 | echo "" 122 | echo " We have identified a critical bug in a database migration that causes data loss in the history system." 123 | echo " A new release is available with a fix and an automated recovery process." 124 | echo " Please follow the steps of the recovery process in the following wiki page:" 125 | echo " https://github.com/overleaf/overleaf/wiki/Doc-version-recovery" 126 | echo "-------------------------------------------------------" 127 | echo "--------------------- WARNING -----------------------" 128 | echo "-------------------------------------------------------" 129 | exit 1 130 | fi 131 | } 132 | 133 | prompt() { 134 | read -p "$1 (y/n): " choice 135 | if [[ ! "$choice" =~ [Yy] ]]; then 136 | echo "Exiting." 137 | exit 1 138 | fi 139 | } 140 | 141 | rebrand_sharelatex_env_variables() { 142 | local filename=$1 143 | local silent=${2:-no} 144 | sharelatex_occurrences=$(set +o pipefail && grep -o "SHARELATEX_" "$TOOLKIT_ROOT/config/$filename" | wc -l | sed 's/ //g') 145 | if [ "$sharelatex_occurrences" -gt 0 ]; then 146 | echo "Rebranding from ShareLaTeX to Overleaf" 147 | echo " Found $sharelatex_occurrences lines with SHARELATEX_ in config/$filename" 148 | local timestamp=$(date "+%Y.%m.%d-%H.%M.%S") 149 | local backup_filename="__old-$filename.$timestamp" 150 | echo " Will create backup of config/$filename at config/$backup_filename" 151 | prompt " Proceed with the renaming in config/$filename?" 152 | echo " Creating backup file config/$backup_filename" 153 | cp "$TOOLKIT_ROOT/config/$filename" "$TOOLKIT_ROOT/config/$backup_filename" 154 | echo " Replacing 'SHARELATEX_' with 'OVERLEAF_' in config/$filename" 155 | sed -i "s/SHARELATEX_/OVERLEAF_/g" "$TOOLKIT_ROOT/config/$filename" 156 | echo " Updated $sharelatex_occurrences lines in config/$filename" 157 | else 158 | if [[ "$silent" != "silent_if_no_match" ]]; then 159 | echo "Rebranding from ShareLaTeX to Overleaf" 160 | echo " No 'SHARELATEX_' occurrences found in config/$filename" 161 | fi 162 | fi 163 | } 164 | 165 | function check_sharelatex_env_vars() { 166 | local rc_occurrences=$(set +o pipefail && grep -o SHARELATEX_ "$TOOLKIT_ROOT/config/overleaf.rc" | wc -l | sed 's/ //g') 167 | 168 | if [ "$rc_occurrences" -gt 0 ]; then 169 | echo "Rebranding from ShareLaTeX to Overleaf" 170 | echo " The Toolkit has adopted to Overleaf brand for its variables." 171 | echo " Your config/overleaf.rc still has $rc_occurrences variables using the previous ShareLaTeX brand." 172 | echo " Moving forward the 'SHARELATEX_' prefixed variables must be renamed to 'OVERLEAF_'." 173 | echo " You can migrate your config/overleaf.rc to use the Overleaf brand by running:" 174 | echo "" 175 | echo " toolkit$ bin/rename-rc-vars" 176 | echo "" 177 | exit 1 178 | fi 179 | 180 | local expected_prefix="OVERLEAF_" 181 | local invalid_prefix="SHARELATEX_" 182 | if [[ "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then 183 | expected_prefix="SHARELATEX_" 184 | invalid_prefix="OVERLEAF_" 185 | fi 186 | 187 | local env_occurrences=$(set +o pipefail && grep -o "$invalid_prefix" "$TOOLKIT_ROOT/config/variables.env" | wc -l | sed 's/ //g') 188 | 189 | if [ "$env_occurrences" -gt 0 ]; then 190 | echo "Rebranding from ShareLaTeX to Overleaf" 191 | echo " Starting with Overleaf CE and Server Pro version 5.0.0 the environment variables will use the Overleaf brand." 192 | echo " Previous versions used the ShareLaTeX brand for environment variables." 193 | echo " Your config/variables.env has $env_occurrences entries matching '$invalid_prefix', expected prefix '$expected_prefix'." 194 | echo " Please align your config/version with the naming scheme of variables in config/variables.env." 195 | if [[ ! "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then 196 | echo " You can migrate your config/variables.env to use the Overleaf brand by running:" 197 | echo "" 198 | echo " toolkit$ bin/rename-env-vars-5-0" 199 | echo "" 200 | fi 201 | exit 1 202 | fi 203 | 204 | if [[ ! "$IMAGE_VERSION_MAJOR" -lt 5 ]]; then 205 | if grep -q -e 'TEXMFVAR=/var/lib/sharelatex/tmp/texmf-var' "$TOOLKIT_ROOT/config/variables.env"; then 206 | echo "Rebranding from ShareLaTeX to Overleaf" 207 | echo " The 'TEXMFVAR' override is not needed since Server Pro/Overleaf CE version 3.2 (August 2022) and it conflicts with the rebranded paths." 208 | echo " Please remove the following entry from your config/variables.env:" 209 | echo "" 210 | echo " TEXMFVAR=/var/lib/sharelatex/tmp/texmf-var" 211 | echo "" 212 | exit 1 213 | fi 214 | fi 215 | } 216 | 217 | function read_variable() { 218 | local name=$1 219 | grep -E "^$name=" "$TOOLKIT_ROOT/config/variables.env" \ 220 | | sed -r "s/^$name=([\"']?)(.+)\1\$/\2/" 221 | } 222 | 223 | function read_configuration() { 224 | local name=$1 225 | grep -E "^$name=" "$TOOLKIT_ROOT/config/overleaf.rc" \ 226 | | sed -r "s/^$name=([\"']?)(.+)\1\$/\2/" 227 | } 228 | -------------------------------------------------------------------------------- /doc/upgrading-from-0.x.md: -------------------------------------------------------------------------------- 1 | # Upgrading Server CE/Pro with a DB that was used since Server CE/Pro version 0.x 2 | 3 | Thank you for your continued trust in Overleaf as a long term customer of Server Pro! 4 | 5 | > **Note** 6 | > For reference: Server CE/Pro version 1.x was released in 2017. 7 | > 8 | > If you are still using 0.x and plan to upgrade, please do so one major version at a time 9 | (e.g. from 0.6.3 to 1.24, then 2.7.1, then the [latest release of `3.x.x`](https://github.com/overleaf/overleaf/wiki/Release-Notes-3.x.x)). 10 | 11 | ## Potential issues when upgrading to version 3.x 12 | 13 | ### Duplicate indexes 14 | 15 | #### projectInvites 16 | 17 | > MongoError: Error during migrate "20190912145023_create_projectInvites_indexes": Index with name: expires_1 already exists with different options 18 | 19 | Early versions of Server CE/Pro had their indexes defined inline in the model layer of the application. 20 | The indexes were automatically created/updated as needed by an application framework. 21 | 22 | We have since moved to explicit creation/removal of indexes as part of migration scripts. 23 | Some of these very early indexes were not taken into account when writing these new migrations. 24 | 25 | The `expires_1` index in the `projectInvites` collection is one of these old indexes that needs to be recreated with different parameters. 26 | It is safe to delete it when the application (Server CE/Pro) is not running. 27 | 28 | ```shell 29 | # Change the directory to the root of the toolkit checkout. E.g.: 30 | # cd ~/toolkit 31 | 32 | # Stop the application 33 | bin/docker-compose stop sharelatex 34 | 35 | # Check the existing indexes 36 | echo 'db.projectInvites.getIndexes()' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 37 | # Expected output variant 1 (use of Server CE from August 2016, changed `expireAfterSeconds` attribute): 38 | # [ 39 | # ... 40 | # { 41 | # "v" : 2, 42 | # "key" : { 43 | # "expires" : 1 44 | # }, 45 | # "name" : "expires_1", 46 | # "expireAfterSeconds" : 2592000, 47 | # "background" : true 48 | # } 49 | # ... 50 | # ] 51 | 52 | # Expected output variant 2 (use of an old mongodb version, offending `"safe":null` attribute): 53 | # [ 54 | # ... 55 | # { 56 | # "v" : 2, 57 | # "key" : { 58 | # "expires" : 1 59 | # }, 60 | # "name" : "expires_1", 61 | # "expireAfterSeconds" : 10, 62 | # "background" : true, 63 | # "safe": null 64 | # } 65 | # ... 66 | # ] 67 | 68 | 69 | # Also check for completed migrations 70 | echo 'db.migrations.count({"name":"20190912145023_create_projectInvites_indexes"})' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 71 | # Expected output: 72 | # 0 73 | 74 | # If the output of any of the two above commands does not match, stop here. 75 | # Please reach out to support@overleaf.com for assistance and provide the output. 76 | 77 | 78 | # If the output matches, continue below. 79 | # Drop the expires_1 index 80 | echo 'db.projectInvites.dropIndex("expires_1")' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 81 | # Expected output (NOTE: the "nIndexesWas" number may differ) 82 | # { "nIndexesWas" : 3, "ok" : 1 } 83 | 84 | # Start the application again 85 | bin/docker-compose start sharelatex 86 | ``` 87 | 88 | #### templates 89 | 90 | > MongoError: Error during migrate "20190912145030_create_templates_indexes": Index with name: project_id_1 already exists with different options 91 | 92 | See comment in projectInvites section. 93 | 94 | It is safe to delete the `project_id_1` index for re-creation by the `20190912145030_create_templates_indexes` migration. 95 | The `user_id_1` and `name_1` indexes are likely affected as well, and you can delete them right away as well. 96 | Please make sure that the application (Server CE/Pro) is not running. 97 | 98 | ```shell 99 | # Change the directory to the root of the toolkit checkout. E.g.: 100 | # cd ~/toolkit 101 | 102 | # Stop the application 103 | bin/docker-compose stop sharelatex 104 | 105 | # Check the existing indexes 106 | echo 'db.templates.getIndexes()' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 107 | # Expected output (use of an old mongodb version, offending `"safe":null` attribute): 108 | # [ 109 | # ... 110 | # { 111 | # "v" : 1, 112 | # "key" : { 113 | # "name" : 1 114 | # }, 115 | # "name" : "name_1", 116 | # "ns" : "sharelatex.templates", 117 | # "background" : true, 118 | # "safe" : null 119 | # }, 120 | # { 121 | # "v" : 1, 122 | # "unique" : true, 123 | # "key" : { 124 | # "project_id" : 1 125 | # }, 126 | # "name" : "project_id_1", 127 | # "ns" : "sharelatex.templates", 128 | # "background" : true, 129 | # "safe" : null 130 | # }, 131 | # { 132 | # "v" : 1, 133 | # "key" : { 134 | # "user_id" : 1 135 | # }, 136 | # "name" : "user_id_1", 137 | # "ns" : "sharelatex.templates", 138 | # "background" : true, 139 | # "safe" : null 140 | # } 141 | # ] 142 | 143 | # Also check for completed migrations 144 | echo 'db.migrations.count({"name":"20190912145030_create_templates_indexes"})' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 145 | # Expected output: 146 | # 0 147 | 148 | # If the output of any of the two above commands does not match, stop here. 149 | # Please reach out to support@overleaf.com for assistance and provide the output. 150 | 151 | 152 | # If the output matches, continue below. 153 | # Drop the project_id_1, user_id_1 and name_1 index 154 | echo 'db.templates.dropIndex("project_id_1")' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 155 | # Expected output (NOTE: the "nIndexesWas" number may differ) 156 | # { "nIndexesWas" : 4, "ok" : 1 } 157 | echo 'db.templates.dropIndex("user_id_1")' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 158 | # Expected output (NOTE: the "nIndexesWas" number may differ) 159 | # { "nIndexesWas" : 3, "ok" : 1 } 160 | echo 'db.templates.dropIndex("name_1")' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 161 | # Expected output (NOTE: the "nIndexesWas" number may differ) 162 | # { "nIndexesWas" : 2, "ok" : 1 } 163 | 164 | # Start the application again 165 | bin/docker-compose start sharelatex 166 | ``` 167 | 168 | ### Users with non-unique emails 169 | 170 | > MongoError: Error during migrate "20190912145032_create_users_indexes": E11000 duplicate key error collection: sharelatex.users index: email_case_insensitive collation 171 | 172 | Older versions of Server Pro did not normalize emails sufficiently to ensure that unique emails are used by different users. 173 | 174 | Server Pro 3.x applies stricter normalization. It is possible that old databases have users with non-unique emails. 175 | 176 | The first step is identifying the scope of this issue: 177 | 178 | ```shell 179 | # Change the directory to the root of the toolkit checkout. E.g.: 180 | # cd ~/toolkit 181 | 182 | # list emails that have more than one related user when normalized to lower case. 183 | echo 'db.users.aggregate([{"$group":{"_id":{"$toLower":"$email"},"count":{"$sum":1}}},{"$match":{"count":{"$gt":1}}}])' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 184 | # Expected output 185 | # { "_id" : "foo@bar.com", "count" : 2 } 186 | # ... 187 | ``` 188 | 189 | There are two options to deal with a duplicate. 190 | 191 | > **Note** Please take a DB backup before making any of these changes. 192 | 193 | 1. You can change the email address of one of these account (see query below) and deal with the project access later. 194 | 2. Do that later task now: 195 | 1. You will need to check the contents of both accounts and decide which of these should be the primary account moving forward. 196 | 2. The admin panel of Server Pro can help here, and you can find it under "https:///admin/user" (requires an admin account). 197 | 3. On this page you can enter the users email address, and it should display two user entries (if not, try different casing, see query below). 198 | 4. When you click on the individual list entries you should see a user info page. 199 | 5. The "projects" tab lists all the users projects. 200 | 6. You will need to transfer the ownership of each of these projects into the desired account using the "Transfer ownership" button. 201 | 7. Once all projects are migrated out of one account, you can use the "Delete User" button on the admin user info page. (The user deletion here is a soft-deletion and you can restore it later if needed.) 202 | 203 | ```shell 204 | # Change the directory to the root of the toolkit checkout. E.g.: 205 | # cd ~/toolkit 206 | 207 | # Change the email of one of the accounts and deal with the project access later. 208 | # Replace the three placeholders "foo@bar.com" with an actual email address that has two related users. 209 | # The "^" and "$" characters around the email ensure that we do not match similar emails, e.g. "this-is-not-foo@bar.com" also contains "foo@bar.com". 210 | echo 'db.users.updateOne({"email":/^foo@bar.com$/i},{"$set":{"email":"duplicate-foo@bar.com","emails.0.email":"duplicate-foo@bar.com"}})' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 211 | # Expected output 212 | # { "acknowledged" : true, "matchedCount" : 1, "modifiedCount" : 1 } 213 | ``` 214 | 215 | ```shell 216 | # Change the directory to the root of the toolkit checkout. E.g.: 217 | # cd ~/toolkit 218 | # Find exact casing of the email addresses 219 | # Replace the placeholder "foo@bar.com" with an actual email address that has two related users. 220 | # The "^" and "$" characters around the email ensure that we do not match similar emails, e.g. "this-is-not-foo@bar.com" also contains "foo@bar.com". 221 | echo 'db.users.find({"email":/^foo@bar.com$/i},{"email":1})' | bin/docker-compose exec -T mongo mongo --quiet sharelatex 222 | # Expected output 223 | # { "_id" : ObjectId("637276cd42fab6008ec8c88c"), "email" : "foo@bar.com" } 224 | # { "_id" : ObjectId("637276cd42fab6008ec8c88d"), "email" : "FOO@bar.com" } 225 | ``` 226 | 227 | Please do not hesitate to reach out to [support@overleaf.com](mailto:support@overleaf.com) if you have any questions or concerns about this process. We are happy to help! 228 | -------------------------------------------------------------------------------- /bin/upgrade: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | source "$TOOLKIT_ROOT/lib/shared-functions.sh" 19 | 20 | function usage() { 21 | echo "Usage: bin/upgrade" 22 | echo "" 23 | echo "This script will check for updates to the toolkit code (via git)," 24 | echo "and offer to pull the new changes. It will then check the latest" 25 | echo "available version of the docker image, and offer to update the" 26 | echo "locally configured image (in config/image) if applicable" 27 | echo "" 28 | echo "This script will prompt the user for confirmation at" 29 | echo "each step along the way." 30 | } 31 | 32 | function services_up() { 33 | local top_output 34 | top_output="$("$TOOLKIT_ROOT/bin/docker-compose" top)" 35 | if [[ -z "$top_output" ]]; then 36 | return 1 37 | else 38 | return 0 39 | fi 40 | } 41 | 42 | function git_pull_available() { 43 | local branch="$1" 44 | local fetch_output 45 | fetch_output="$(git -C "$TOOLKIT_ROOT" fetch --dry-run origin "$branch" 2>&1)" 46 | local filtered_fetch_output 47 | filtered_fetch_output="$(echo "$fetch_output" | grep '\-> origin/'"$branch")" 48 | if [[ -z "$filtered_fetch_output" ]]; then 49 | return 1 50 | else 51 | return 0 52 | fi 53 | } 54 | 55 | function git_diff() { 56 | git -C "$TOOLKIT_ROOT" diff "$@" 57 | } 58 | 59 | function is_up_to_date_with_remote() { 60 | local branch="$1" 61 | git_diff --quiet HEAD "origin/$branch" 62 | } 63 | 64 | function show_changes() { 65 | local branch="$1" 66 | 67 | if git_diff --quiet HEAD "origin/$branch" -- CHANGELOG.md; then 68 | echo "No changelog available" 69 | return 0 70 | fi 71 | 72 | # show CHANGELOG.md changes 73 | # git diff --unified=0 hide diff context 74 | # tail -n+6 hide the patch header 75 | 76 | # Example output 77 | # 78 | # Changelog: 79 | # ---------- 80 | # +## 2020-11-19 81 | # +### Added 82 | # +- Updated ... 83 | # ---------- 84 | 85 | echo "Changelog:" 86 | echo "----------" 87 | git_diff --color --unified=0 HEAD "origin/$branch" -- CHANGELOG.md \ 88 | | tail -n+6 89 | echo "----------" 90 | } 91 | 92 | function read_seed_image_version() { 93 | SEED_IMAGE_VERSION="$(head -n 1 "$TOOLKIT_ROOT/lib/config-seed/version")" 94 | if [[ ! "$SEED_IMAGE_VERSION" =~ ^([0-9]+)\.([0-9]+)\.[0-9]+(-RC[0-9]*)?(-with-texlive-full)?$ ]]; then 95 | echo "ERROR: invalid config-seed/version '${SEED_IMAGE_VERSION}'" 96 | exit 1 97 | fi 98 | SEED_IMAGE_VERSION_MAJOR=${BASH_REMATCH[1]} 99 | SEED_IMAGE_VERSION_MINOR=${BASH_REMATCH[2]} 100 | } 101 | 102 | function handle_image_upgrade() { 103 | if [[ ! "$SEED_IMAGE_VERSION" > "$IMAGE_VERSION" ]]; then 104 | echo "No change to docker image version" 105 | return 0 106 | fi 107 | 108 | echo "New docker image version available ($SEED_IMAGE_VERSION)" 109 | echo "Current image version is '$IMAGE_VERSION' (from config/version)" 110 | 111 | local user_image_major_version="$(echo "$IMAGE_VERSION" | awk -F. '{print $1}')" 112 | local seed_image_major_version="$(echo "$SEED_IMAGE_VERSION" | awk -F. '{print $1}')" 113 | if [[ "$seed_image_major_version" > "$user_image_major_version" ]]; then 114 | echo "WARNING: this is a major version update, please check the Release Notes for breaking changes before proceeding:" 115 | echo "* https://github.com/overleaf/overleaf/wiki#release-notes" 116 | fi 117 | 118 | local should_upgrade="n" 119 | read -r -p "Upgrade image? [y/n] " should_upgrade 120 | 121 | if [[ ! "$should_upgrade" =~ [Yy] ]]; then 122 | echo "Keeping image version '$IMAGE_VERSION'" 123 | check_retracted_version 124 | return 0 125 | fi 126 | 127 | echo "Upgrading config/version from $IMAGE_VERSION to $SEED_IMAGE_VERSION" 128 | 129 | local docker_compose_override_path="$TOOLKIT_ROOT/config/docker-compose.override.yml" 130 | if [ -f "$docker_compose_override_path" ]; then 131 | if grep -q -E '^\s*image: sharelatex/sharelatex.*' "$docker_compose_override_path"; then 132 | echo "WARNING: you are using a customized docker image, the server may not run on the latest version post upgrade." 133 | echo "* If you have followed the guide 'Upgrading TexLive', please remove and recreate the modified image." 134 | echo "* Remove the image: 'docker rm sharelatex/sharelatex:with-texlive-full'" 135 | echo "* Remove the override file: 'rm config/docker-compose.override.yml'" 136 | echo "* Recreate the image by following: https://github.com/overleaf/toolkit/blob/master/doc/ce-upgrading-texlive.md" 137 | fi 138 | fi 139 | 140 | 141 | # Skip retraction check in sub-shells 142 | export OVERLEAF_SKIP_RETRACTION_CHECK="$IMAGE_VERSION" 143 | local version="$IMAGE_VERSION_MAJOR.$IMAGE_VERSION_MINOR.$IMAGE_VERSION_PATCH" 144 | if [[ "$version" == "5.0.1" ]]; then 145 | echo "-------------------------------------------------------" 146 | echo "--------------------- WARNING -----------------------" 147 | echo "-------------------------------------------------------" 148 | echo " You are currently using a retracted version, $version." 149 | echo "" 150 | echo " We have identified a critical bug in a database migration that causes data loss in the history system." 151 | echo " Please follow the steps of the recovery process in the following wiki page:" 152 | echo " https://github.com/overleaf/overleaf/wiki/Doc-version-recovery" 153 | echo "-------------------------------------------------------" 154 | echo "--------------------- WARNING -----------------------" 155 | echo "-------------------------------------------------------" 156 | prompt "Are you following the recovery process?" 157 | fi 158 | 159 | if [[ "${PULL_BEFORE_UPGRADE:-true}" == "true" ]]; then 160 | echo "Pulling new images" 161 | set_server_pro_image_name "$SEED_IMAGE_VERSION" 162 | docker pull "$IMAGE" 163 | if [[ $GIT_BRIDGE_ENABLED == "true" ]]; then 164 | if [[ -n ${GIT_BRIDGE_IMAGE:-} ]]; then 165 | echo "------------------- WARNING ----------------------" 166 | echo " You're using the custom git bridge image $GIT_BRIDGE_IMAGE" 167 | echo " Before continuing you need to tag the updated image separately, making sure that:" 168 | echo " 1. The Docker image is tagged with the new version: $SEED_IMAGE_VERSION" 169 | echo " 2. The config/overleaf.rc entry GIT_BRIDGE_IMAGE only contains the image name, and not a tag/version." 170 | echo " You wont be able to continue with this upgrade until you've tagged your custom image with $SEED_IMAGE_VERSION" 171 | echo "------------------- WARNING ----------------------" 172 | prompt "Has the custom image been tagged?" 173 | fi 174 | set_git_bridge_image_name "$SEED_IMAGE_VERSION" 175 | docker pull "$GIT_BRIDGE_IMAGE" 176 | fi 177 | fi 178 | 179 | ## Offer to stop docker services 180 | local services_stopped="false" 181 | if services_up; then 182 | echo "docker services are up, stop them first?" 183 | local should_stop="n" 184 | read -r -p "Stop docker services? [y/n] " should_stop 185 | if [[ ! "$should_stop" =~ [Yy] ]]; then 186 | echo "exiting without stopping services" 187 | exit 1 188 | fi 189 | services_stopped="true" 190 | echo "Stopping docker services" 191 | "$TOOLKIT_ROOT/bin/docker-compose" stop 192 | fi 193 | 194 | ## Advise the user to take a backup 195 | ## (NOTE: we can't do this automatically because it will likely require 196 | ## sudo privileges. We leave it to the user to sort out for now) 197 | echo "At this point, we recommend backing up your data before proceeding" 198 | echo "!! WARNING: Only do this while the docker services are stopped!!" 199 | local should_proceed="n" 200 | read -r -p "Proceed with the upgrade? [y/n] " should_proceed 201 | if [[ ! "$should_proceed" =~ [Yy] ]]; then 202 | echo "Not proceeding with upgrade" 203 | return 1 204 | fi 205 | 206 | ## Set the new image version 207 | echo "Backing up old version file to config/__old-version" 208 | cp "$TOOLKIT_ROOT/config/version" "$TOOLKIT_ROOT/config/__old-version" 209 | echo "Over-writing config/version with $SEED_IMAGE_VERSION" 210 | cp "$TOOLKIT_ROOT/lib/config-seed/version" "$TOOLKIT_ROOT/config/version" 211 | 212 | if [[ "$IMAGE_VERSION_MAJOR" -le 4 && "$SEED_IMAGE_VERSION_MAJOR" -ge 5 ]]; then 213 | rebrand_sharelatex_env_variables 'variables.env' 214 | fi 215 | 216 | ## Maybe offer to start services again 217 | if [[ "${services_stopped:-null}" == "true" ]]; then 218 | local should_start="n" 219 | read -r -p "Start docker services again? [y/n] " should_start 220 | if [[ "$should_start" =~ [Yy] ]]; then 221 | echo "Starting docker services" 222 | "$TOOLKIT_ROOT/bin/docker-compose" up -d 223 | fi 224 | fi 225 | } 226 | 227 | function handle_git_update() { 228 | local current_branch 229 | current_branch="$(git -C "$TOOLKIT_ROOT" rev-parse --abbrev-ref HEAD)" 230 | local current_commit 231 | current_commit="$(git -C "$TOOLKIT_ROOT" rev-parse --short HEAD)" 232 | 233 | if [[ ! "$current_branch" == "master" ]]; then 234 | echo "Warning: current branch is not master, '$current_branch' instead" 235 | fi 236 | 237 | echo "Checking for code update..." 238 | 239 | if ! git_pull_available "$current_branch"; then 240 | echo "No code update available for download" 241 | else 242 | echo "Code update available for download!" 243 | git -C "$TOOLKIT_ROOT" fetch origin "$current_branch" 244 | fi 245 | 246 | if ! is_up_to_date_with_remote "$current_branch"; then 247 | show_changes "$current_branch" 248 | 249 | local should_pull="n" 250 | read -r -p "Perform code update? [y/n] " should_pull 251 | 252 | if [[ ! "$should_pull" =~ [Yy] ]]; then 253 | echo "Continuing without updating code" 254 | else 255 | echo "Current commit is $current_commit" 256 | echo "Updating code..." 257 | git -C "$TOOLKIT_ROOT" pull origin "$current_branch" 258 | echo "Relaunching bin/upgrade after code update" 259 | exec $0 --skip-git-update 260 | fi 261 | fi 262 | } 263 | 264 | function handle_rc_rebranding() { 265 | ## Rename variables in overleaf.rc SHARELATEX_ -> OVERLEAF_ 266 | rebrand_sharelatex_env_variables 'overleaf.rc' silent_if_no_match 267 | } 268 | 269 | function __main__() { 270 | if [[ "${1:-null}" == "help" ]] \ 271 | || [[ "${1:-null}" == "--help" ]] ; then 272 | usage && exit 273 | fi 274 | 275 | if [[ "${1:-null}" == "--skip-git-update" ]]; then 276 | echo "Skipping git update" 277 | else 278 | handle_git_update 279 | fi 280 | 281 | read_seed_image_version 282 | read_image_version 283 | read_config 284 | handle_rc_rebranding 285 | handle_image_upgrade 286 | 287 | echo "Done" 288 | exit 0 289 | } 290 | 291 | __main__ "$@" 292 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 2025-11-17 4 | ### Added 5 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `6.0.1`. 6 | 7 | ## 2025-10-29 8 | ### Added 9 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `6.0.0`. 10 | 11 | :warning: This is a major release. Please check the [release notes](https://docs.overleaf.com/on-premises/release-notes/release-notes-6.x.x) for details. 12 | 13 | - Updated mongo default version to `8.0`. 14 | - Updated redis default version to `7.4`. 15 | 16 | ## 2025-10-29 17 | ### Added 18 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.5.6`. 19 | 20 | ## 2025-10-23 21 | ### Added 22 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.5.5`. 23 | 24 | ## 2025-08-14 25 | ### Changed 26 | - Upgrade default nginx version for TLS proxy to version 1.28. If you configured a custom `NGINX_IMAGE`, please upgrade it. 27 | - Fix graceful shutdown procedure with TLS proxy enabled. 28 | Swap the dependency between the TLS proxy and Server Pro/CE container. This ensures that `bin/stop` will wait for the application container to stop before taking down the TLS proxy. Notably this ensures that connected users can flush their changes as part of the graceful shutdown procedure. 29 | Please align your nginx config with the updated default configuration (add upstream, configure docker as resolver and switch proxy_pass to upstream) by comparing `config/nginx/nginx.conf` and `lib/config-seed/nginx.conf`. 30 | - Automatically configure `OVERLEAF_SECURE_COOKIE`/`OVERLEAF_BEHIND_PROXY`/`OVERLEAF_TRUSTED_PROXY_IPS` for TLS proxy. 31 | In case you are using a subnet from `172.16.0.0/12` (default subnet for Docker networks) for your regular network, please set `OVERLEAF_TRUSTED_PROXY_IPS=loopback,` in your `config/variables.env`. Where `` is the `IPAM -> Config -> Subnet` value in `docker inspect overleaf_default`, e.g. `OVERLEAF_TRUSTED_PROXY_IPS=loopback,172.19.0.0/16` 32 | 33 | Customers with an external TLS proxy (i.e. not managed by the Overleaf Toolkit), please ensure that `OVERLEAF_TRUSTED_PROXY_IPS=loopback,` is set in your `config/variables.env`, e.g. `OVERLEAF_TRUSTED_PROXY_IPS=loopback,192.168.13.37`. 34 | 35 | ## 2025-08-04 36 | ### Added 37 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.5.4`. 38 | ### Fixed 39 | - Fix `Permission denied` errors when running `bin/upgrade`. 40 | 41 | ## 2025-07-29 42 | ### Added 43 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.5.3`. 44 | 45 | ## 2025-07-09 46 | ### Added 47 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.5.2`. 48 | 49 | ## 2025-05-28 50 | ### Added 51 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.5.1`. 52 | - 53 | ## 2025-05-28 54 | ### Added 55 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.5.0`. 56 | 57 | ## 2025-04-30 58 | ### Added 59 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.4.1`. 60 | 61 | ## 2025-04-11 62 | ### Added 63 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.4.0`. 64 | 65 | ## 2025-03-21 66 | ### Added 67 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.3.3`. 68 | 69 | ## 2025-03-11 70 | ### Added 71 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.3.2`. 72 | 73 | 74 | ## 2025-01-29 75 | ### Added 76 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.3.1`. 77 | 78 | ## 2025-01-06 79 | ### Added 80 | - Add new config option for skipping docker pull before upgrading 81 | - Document config options for air-gapped setups 82 | 83 | ## 2024-11-18 84 | ### Added 85 | - When a custom `GIT_BRIDGE_IMAGE` is set, `bin/upgrade` no longer tries to pull the new version, and prompts 86 | the user to update and tag the custom image separately. 87 | - Tighten SSL security on nginx proxy 88 | 89 | ## 2024-10-29 90 | ### Added 91 | - Pull new images from `bin/upgrade` ahead of stopping containers 92 | 93 | ## 2024-10-24 94 | ### Added 95 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.2.1`. 96 | - Drop support for Docker Compose v1. [How to switch to Compose V2](https://docs.docker.com/compose/releases/migrate/#how-do-i-switch-to-compose-v2). 97 | Docker Compose v1 has reached its End Of Life in July 2023. 98 | 99 | ### Changed 100 | - If set, the `overleaf.rc` entry `GIT_BRIDGE_IMAGE` must be specified without the version now. 101 | 102 | Example: 103 | ```diff 104 | -GIT_BRIDGE_IMAGE=my.registry.com/overleaf/git-bridge:5.1.1 105 | +GIT_BRIDGE_IMAGE=my.registry.com/overleaf/git-bridge 106 | ``` 107 | 108 | ## 2024-09-24 109 | ### Added 110 | - Print warning when running `bin/up` without detach mode 111 | 112 | ## 2024-09-11 113 | ### Added 114 | - Add loud warning to `bin/doctor` when not using Sandboxed Compiles/`SIBLING_CONTAINERS_ENABLED=true` 115 | - Add loud warning for using Community Edition with `SIBLING_CONTAINERS_ENABLED=true` 116 | 117 | ## 2024-09-03 118 | ### Added 119 | - Add a new config option `OVERLEAF_LOG_PATH` for making [application logs](https://github.com/overleaf/overleaf/wiki/Log-files) available on the Docker host. 120 | 121 | ## 2024-08-27 122 | ### Added 123 | - Surface `MONGO_VERSION` from `bin/doctor` 124 | 125 | ## 2024-08-20 126 | ### Fixed 127 | - Fix unquoting of variables (e.g. `ALL_TEX_LIVE_DOCKER_IMAGES`) 128 | 129 | ## 2024-08-13 130 | ### Added 131 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.1.1`. 132 | 133 | ## 2024-07-30 134 | ### Added 135 | - New `bin/run-script` command 136 | 137 | ## 2024-07-29 138 | ### Fixed 139 | - Sandboxed Compiles is available for Server Pro only 140 | 141 | ## 2024-07-17 142 | ### Added 143 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.1.0`. 144 | 145 | - `SIBLING_CONTAINERS_ENABLED` is now set to `true` for new installs in [`config-seed/overleaf.rc`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/overleaf.rc). 146 | 147 | We strongly recommend enabling the [Sandboxed Compiles feature](https://github.com/overleaf/toolkit/blob/master/doc/sandboxed-compiles.md) 148 | for existing installations as well. 149 | 150 | - Added "--appendonly yes" configuration to redis. 151 | 152 | Redis persistence documentation: https://redis.io/docs/latest/operate/oss_and_stack/management/persistence/ 153 | 154 | - Updated mongo to 6.0 in [`config-seed/overleaf.rc`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/overleaf.rc). 155 | 156 | Mongo image name needs to be split between `MONGO_IMAGE` (with just the image name) and `MONGO_VERSION` in `config/overleaf.rc`. 157 | 158 | ## 2024-07-16 159 | ### Added 160 | - Added support for Mongo 6.0. 161 | 162 | ## 2024-07-12 163 | ### Added 164 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.0.7`. 165 | :warning: This is a security release. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#server-pro-507) for details. 166 | 167 | Note: Server Pro version 4.2.7 contains the equivalent security update for the 4.x.x release line. 168 | 169 | ## 2024-06-21 170 | ### Added 171 | - Added warning for usage of legacy docker-compose v1. 172 | 173 | docker-compose v1 has reached its End Of Life in July 2023 (https://docs.docker.com/compose/migrate/). 174 | Support for docker-compose v1 in the Overleaf Toolkit will be dropped with the release of Server Pro 5.2. 175 | We recommend upgrading to Docker Compose v2 before then. 176 | 177 | - Added warning for usage of End Of Life Docker versions before v23 178 | 179 | ## 2024-06-20 180 | ### Added 181 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.0.6`. 182 | :warning: This is a security release. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#server-pro-506) for details. 183 | 184 | Note: Server Pro version 4.2.6 contains the equivalent security update for the 4.x.x release line. 185 | 186 | ## 2024-06-11 187 | ### Added 188 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.0.5`. 189 | :warning: This is a security release. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#server-pro-505) for details. 190 | 191 | Note: Server Pro version 4.2.5 contains the equivalent security update for the 4.x.x release line. 192 | 193 | ## 2024-05-27 194 | ### Added 195 | - Pull TeX Live images from `bin/up` 196 | 197 | You can disable the automatic pulling using `SIBLING_CONTAINERS_PULL=false` in your `config/overleaf.rc` file. 198 | 199 | ## 2024-05-24 200 | ### Added 201 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.0.4`. 202 | :warning: This is a security release. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#server-pro-504) for details. 203 | 204 | ## 2024-05-08 205 | ### Added 206 | - Add warning for using docker installing via `snap`. 207 | 208 | ## 2024-04-22 209 | ### Added 210 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.0.3`. 211 | 212 | :warning: This is a security release. This release also fixes a critical bug in a database migration as included in release 5.0.1. The recovery procedure for doc versions has been updated compared to 5.0.2. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#server-pro-503) for details. 213 | 214 | Note: Server Pro version 4.2.4 contains the equivalent security update for the 4.x.x release line. 215 | 216 | ## 2024-04-22 217 | ### Added 218 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.0.2`. 219 | 220 | :warning: This is a security release. This release also fixes a critical bug in a database migration as included in release 5.0.1. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes-5.x.x#server-pro-502) for details. 221 | 222 | Note: Server Pro version 4.2.4 contains the equivalent security update for the 4.x.x release line. 223 | ### Fixed 224 | - Retracted release 5.0.2 225 | 226 | :warning: We have identified a few corner cases in the recovery procedure for docs. 227 | 228 | ## 2024-04-18 229 | ### Fixed 230 | - Retracted release 5.0.1 231 | 232 | :warning: We have identified a critical bug in a database migration that causes data loss. Please defer upgrading to release 5.0.1 until further notice on the mailing list. Please hold on to any backups that were taken prior to upgrading to version 5.0.1. 233 | 234 | ## 2024-04-09 235 | ### Added 236 | 237 | - Print column headers from `bin/images` 238 | - List Git Bridge images via `bin/images` 239 | 240 | ## 2024-04-02 241 | ### Added 242 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `5.0.1`. 243 | 244 | :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. 245 | 246 | - Rebranded 'SHARELATEX_' variables to 'OVERLEAF_' 247 | 248 | 249 | ## 2024-02-27 250 | ### Fixed 251 | 252 | - Relaunch `bin/upgrade` after updating Toolkit code. 253 | 254 | We are planning to expand the scope of the `bin/upgrade` script in a following release and these changes need to be applied _while_ running `bin/upgrade`. 255 | 256 | With this release there is a one-time requirement that you choose "Yes" to "Perform code update?" and "No" to "Upgrade image?". After the Toolkit code has been updated, run `bin/upgrade` again and choose to upgrade the image. 257 | 258 | ## 2024-02-16 259 | ### Added 260 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.2.3`. 261 | 262 | :warning: This is a security release. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes--4.x.x#server-pro-423) for details. 263 | 264 | ## 2024-02-14 265 | ### Added 266 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.2.2`. 267 | 268 | :warning: This is a security release. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes--4.x.x#server-pro-422) for details. 269 | 270 | ## 2024-01-12 271 | ### Added 272 | - Updated Mongo version from 4.4 to 5.0 in config seed. Documentation on Mongo updates can be found [here](https://github.com/overleaf/overleaf/wiki/Updating-Mongo-version). 273 | 274 | ## 2023-11-10 275 | ### Added 276 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.2.0`. 277 | 278 | ## 2023-11-02 279 | ### Added 280 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.1.6`. 281 | The previous release `4.1.5` is an important bug fix release for the history system, see the full [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes--4.x.x#server-pro-415). 282 | 283 | ## 2023-10-24 284 | ### Added 285 | - `bin/logs`: Pick up logs from history-v1 and project-history 286 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.1.4`. 287 | 288 | ## 2023-10-06 289 | ### Added 290 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.1.3`. 291 | 292 | ## 2023-09-18 293 | 294 | ### Added 295 | - Prepare for addition of web-api service in upcoming Server Pro 4.2 release. 296 | 297 | ## 2023-09-06 298 | ### Added 299 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.1.1`. 300 | 301 | This is a bug fix release, see the full [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes--4.x.x#server-pro-411). 302 | 303 | ## 2023-08-24 304 | ### Added 305 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.1.0`. 306 | 307 | :warning: This is a security release. Please check the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes--4.x.x#server-pro-410) for details. 308 | 309 | ## 2023-08-11 310 | ### Added 311 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.0.6`. 312 | 313 | From the [release notes](https://github.com/overleaf/overleaf/wiki/Release-Notes--4.x.x#server-pro-406): 314 | 315 | - Bring back the [History Migration Cleanup Script](https://github.com/overleaf/overleaf/wiki/Full-Project-History-Migration#clean-up-legacy-history-data) with a fix to free up mongo storage space. 316 | 317 | > :warning: We advise customers to re-run the script again as per the documentation. 318 | 319 | ## 2023-07-28 320 | ### Added 321 | - Added support for a version suffix of `-with-texlive-full` to be able to load a custom image with TeXLive full backed in. 322 | 323 | Server Pro customers: We strongly recommend using [Sandboxed compiles](https://github.com/overleaf/toolkit/blob/master/doc/sandboxed-compiles.md) instead of running a custom TeXLive full installation. Please reach out to us if you have any questions or need help with setting up Sandboxed compiles in Server Pro. 324 | 325 | ## 2023-07-20 326 | ### Added 327 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.0.5`. 328 | 329 | ## 2023-07-14 330 | ### Added 331 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.0.4`. 332 | 333 | ## 2023-06-29 334 | ### Added 335 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.0.3`. 336 | - 337 | 338 | ## 2023-06-08 339 | ### Added 340 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.0.2`. 341 | - 342 | ## 2023-05-30 343 | ### Added 344 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `4.0.1`. 345 | 346 | ## 2023-05-16 347 | ### Added 348 | - Use Docker Compose v2 by default. Fall back to Docker Compose v1 if v2 is 349 | unavailable. 350 | ### Fixed 351 | - Propagate the `REDIS_PORT` variable to the sharelatex container 352 | 353 | ## 2023-05-15 354 | ### Added 355 | - Support listing container logs with `bin/logs` command 356 | - `bin/logs -n all` shows all logs for a given service 357 | 358 | ## 2023-05-11 359 | ### Added 360 | - Change the location of the git-bridge data directory to /data/git-bridge 361 | inside the container 362 | 363 | ## 2023-05-01 364 | ### Added 365 | - Start Mongo in a replica set by default 366 | 367 | ## 2023-04-14 368 | ### Fixed 369 | - Fix openssl invocation on OS X 370 | 371 | ## 2023-04-13 372 | ### Fixed 373 | - Ensure git bridge is disabled by default 374 | 375 | ## 2023-04-10 376 | ### Added 377 | - Git bridge support in Server Pro 4.x 378 | 379 | ## 2023-03-21 380 | ### Added 381 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.5.5`. 382 | 383 | ## 2023-03-20 384 | ### Added 385 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.5.4`. 386 | 387 | ## 2023-03-16 388 | ### Added 389 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.5.3`. 390 | 391 | ## 2023-03-07 392 | ### Added 393 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.5.2`. 394 | 395 | ## 2023-03-06 396 | ### Added 397 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.5.1`. 398 | 399 | ## 2023-02-28 400 | ### Added 401 | - Add variables for S3 402 | - Extend doctor script to flag incomplete S3 config 403 | 404 | ## 2023-02-10 405 | ### Added 406 | - Increase SIGKILL timeout for docker container to enable graceful shutdown in version 3.5 onwards 407 | 408 | ## 2023-01-11 409 | ### Added 410 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.4.0`. 411 | 412 | ## 2022-11-15 413 | ### Added 414 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.3.2`. 415 | 416 | ## 2022-10-13 417 | ### Added 418 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.3.0`. 419 | 420 | ## 2022-09-22 421 | ### Added 422 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.2.2`. 423 | 424 | ## 2022-08-16 425 | ### Added 426 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to `3.2.0`. 427 | - Updated Mongo version from 4.2 to 4.4. Documentation on Mongo updates can be found [here](https://github.com/overleaf/overleaf/wiki/Updating-Mongo-version). 428 | - Print warning when `SHARELATEX_LISTEN_IP` is not defined. 429 | 430 | ## 2021-10-13 431 | ### Added 432 | - HTTP to HTTPS redirection. 433 | - Listen mode of the `sharelatex` container now `localhost` only, so the value of `SHARELATEX_LISTEN_IP` must be set to the public IP address for direct container access. 434 | 435 | ## 2021-08-12 436 | ### Added 437 | - Server Pro: New variable to control LDAP and SAML, `EXTERNAL_AUTH`, which can 438 | be set to one of `ldap`, `saml`, `none`. This is the preferred way to activate 439 | LDAP and SAML. For backward compatibility, if this is not set, we fall back 440 | to the legacy behaviour of inferring which module to activate from the 441 | relevant environment variables. 442 | - This should not affect current installations. Please contact support if you 443 | encounter any problems 444 | - See [LDAP](./doc/ldap.md) and [SAML](./doc/saml.md) documentation for more 445 | 446 | ## 2020-11-25 447 | ### Added 448 | - `bin/upgrade` displays any changes to the changelog and prompts for 449 | confirmation before applying the remote changes to the local branch. 450 | ### Misc 451 | - Fix code linting errors in bin/ scripts 452 | 453 | ## 2020-11-19 454 | ### Added 455 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to 2.5.0 456 | - Updated Mongo version from 3.6 to 4.0. Documentation on Mongo updates can be found [here](https://github.com/overleaf/overleaf/wiki/Updating-Mongo-version). 457 | 458 | ## 2020-10-22 459 | ### Added 460 | - Updated default [`version`](https://github.com/overleaf/toolkit/blob/master/lib/config-seed/version) to 2.4.2 461 | 462 | 463 | ## 2020-10-21 464 | ### Added 465 | - `bin/up` now passes along any supplied flags to `docker-compose`, 466 | for example: `bin/up -d` will run in detached mode 467 | - Documentation on how to update environment variables. ([documentation](./doc/configuration.md)) 468 | ### Fixed 469 | - A typo 470 | 471 | 472 | ## 2020-10-09 473 | ### Added 474 | - Add `SHARELATEX_PORT` option to `overleaf.rc` file, which defaults 475 | to `80`, same as the previous hard-coded value. ([documentation](./doc/overleaf-rc.md)) 476 | -------------------------------------------------------------------------------- /bin/doctor: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env bash 2 | 3 | set -euo pipefail 4 | 5 | #### Detect Toolkit Project Root #### 6 | # if realpath is not available, create a semi-equivalent function 7 | command -v realpath >/dev/null 2>&1 || realpath() { 8 | [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" 9 | } 10 | SCRIPT_PATH="$(realpath "${BASH_SOURCE[0]}")" 11 | SCRIPT_DIR="$(dirname "$SCRIPT_PATH")" 12 | TOOLKIT_ROOT="$(realpath "$SCRIPT_DIR/..")" 13 | if [[ ! -d "$TOOLKIT_ROOT/bin" ]] || [[ ! -d "$TOOLKIT_ROOT/config" ]]; then 14 | echo "ERROR: could not find root of overleaf-toolkit project (inferred project root as '$TOOLKIT_ROOT')" 15 | exit 1 16 | fi 17 | 18 | source "$TOOLKIT_ROOT/lib/shared-functions.sh" 19 | 20 | SPACES_PER_INDENT=4 21 | 22 | WARNINGS_FILE="$(mktemp)" 23 | 24 | function add_warning() { 25 | echo "$@" >> "$WARNINGS_FILE" 26 | } 27 | 28 | function indent_to_level() { 29 | local levels="$1" 30 | local number_of_spaces=$(( levels * SPACES_PER_INDENT )) 31 | local spaces 32 | spaces="$(printf %${number_of_spaces}s)" 33 | echo -n "${spaces}" 34 | } 35 | 36 | function print_section_separator() { 37 | echo "====== $* ======" 38 | } 39 | 40 | function print_point() { 41 | local indent_level="0" 42 | if [[ "${1:-null}" =~ [0-9]{1} ]]; then 43 | indent_level="$1" 44 | shift 45 | fi 46 | # shellcheck disable=SC2086 47 | echo "$(indent_to_level $indent_level)- $*" 48 | } 49 | 50 | function check_host_information() { 51 | print_point 0 "Host Information" 52 | 53 | # Linux or not? 54 | if [[ $(uname -a) =~ .*Linux.* ]]; then 55 | print_point 1 "Linux" 56 | else 57 | print_point 1 "Not Linux !" 58 | add_warning "This system seems to not be Linux" 59 | fi 60 | 61 | # LSB Information (particular distribution of Linux, and version) 62 | if [[ -n $(command -v lsb_release) ]]; then 63 | print_point 1 "Output of 'lsb_release -a':" 64 | lsb_release -a 2>&1 | while read -r _line; do 65 | echo "$(indent_to_level 3)$_line" 66 | done 67 | else 68 | print_point 1 "lsb_release not found !" 69 | fi 70 | } 71 | 72 | 73 | function check_dependencies() { 74 | 75 | function get_version() { 76 | local binary_name="$1" 77 | if [[ "bash" == "$binary_name" ]]; then 78 | bash -c 'echo $BASH_VERSION' 79 | elif [[ "perl" == "$binary_name" ]]; then 80 | perl -e 'print $];' 81 | elif [[ "openssl" == "$binary_name" ]]; then 82 | openssl version 83 | elif [[ "awk" == "$binary_name" ]]; then 84 | if awk -Wversion > /dev/null 2>&1; then 85 | awk -Wversion 2>&1 | head -n 1 86 | else 87 | awk --version | head -n 1 88 | fi 89 | else 90 | $binary_name --version | head -n 1 91 | fi 92 | } 93 | 94 | function check_for_binary() { 95 | local binary_name="$1" 96 | print_point 1 "$binary_name" 97 | if [[ -n $(command -v "$binary_name") ]]; then 98 | print_point 2 "status: present" 99 | local version 100 | version=$(get_version "$binary_name") 101 | print_point 2 "version info: $version" 102 | if [[ "$binary_name" == "realpath" ]] \ 103 | && [[ "$(command -V "$binary_name")" =~ .*function.* ]]; then 104 | local message="Could not find 'realpath' binary, falling back to custom function" 105 | print_point 2 "WARNING: $message" 106 | add_warning "$message" 107 | fi 108 | else 109 | print_point 2 "status: MISSING !" 110 | add_warning "$binary_name not found" 111 | fi 112 | } 113 | 114 | print_point 0 "Dependencies" 115 | declare -a binaries=( 116 | bash 117 | docker 118 | realpath 119 | perl 120 | awk 121 | openssl 122 | ) 123 | 124 | for binary in "${binaries[@]}"; do 125 | check_for_binary "$binary" 126 | done 127 | 128 | if docker compose version > /dev/null 2>&1; then 129 | print_point 1 "docker compose" 130 | print_point 2 "status: present" 131 | print_point 2 "version info: $(docker compose version)" 132 | elif command -v docker-compose > /dev/null; then 133 | add_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." 134 | check_for_binary docker-compose 135 | else 136 | add_warning "Docker Compose not found" 137 | fi 138 | } 139 | 140 | function check_docker_daemon() { 141 | print_point 0 "Docker Daemon" 142 | if docker ps &>/dev/null; then 143 | print_point 1 "status: up" 144 | 145 | local docker_server_version=$(docker version -f '{{.Server.Version}}') 146 | print_point 1 "server version: $docker_server_version" 147 | if [[ "$docker_server_version" =~ ^([0-9]+)\.([0-9]+) ]]; then 148 | local major="${BASH_REMATCH[1]}" 149 | local minor="${BASH_REMATCH[2]}" 150 | if [[ "$major" -lt 23 ]]; then 151 | add_warning "Docker v$major.$minor has reached its End Of Life. We recommend upgrading to a supported version." 152 | fi 153 | else 154 | add_warning "Docker server version unknown ($docker_server_version)" 155 | fi 156 | 157 | if docker info | grep -q -e '/var/snap/docker/common/var-lib-docker'; then 158 | add_warning "Installing Docker via snap is not supported. The sandboxed compiles feature may not be available. Please follow the steps for installing Docker CE on https://docs.docker.com/engine/install/." 159 | fi 160 | else 161 | print_point 1 "status: DOWN !" 162 | add_warning "Docker daemon is not running" 163 | fi 164 | } 165 | 166 | function print_warnings() { 167 | print_section_separator "Warnings" 168 | if [[ -n $(head -n 1 "$WARNINGS_FILE") ]]; then 169 | while read -r _line; do 170 | echo "! $_line" 171 | done < "$WARNINGS_FILE" 172 | else 173 | echo "- None, all good" 174 | fi 175 | } 176 | 177 | function check_config_files() { 178 | print_section_separator "Configuration" 179 | 180 | local config_files=( 181 | "config/version" 182 | "config/overleaf.rc" 183 | "config/variables.env" 184 | ) 185 | for config_file in "${config_files[@]}" 186 | do 187 | 188 | print_point 0 "$config_file" 189 | 190 | if [[ ! -f "$TOOLKIT_ROOT/$config_file" ]]; then 191 | print_point 1 "status: MISSING !" 192 | add_warning "configuration file $config_file not found" 193 | else 194 | 195 | print_point 1 "status: present" 196 | 197 | if [[ "$config_file" == "config/version" ]]; then 198 | print_point 1 "version: $(head -n 1 "$TOOLKIT_ROOT/$config_file")" 199 | elif [[ "$config_file" == "config/overleaf.rc" ]]; then 200 | print_point 1 "values" 201 | 202 | # Load vars from the rc file 203 | # shellcheck disable=SC1090 204 | source "$TOOLKIT_ROOT/$config_file" 205 | 206 | # Check some vars from the RC file 207 | if [[ "${OVERLEAF_DATA_PATH:-null}" != "null" ]]; then 208 | print_point 2 "OVERLEAF_DATA_PATH: $OVERLEAF_DATA_PATH" 209 | else 210 | print_point 2 "OVERLEAF_DATA_PATH: MISSING !" 211 | add_warning "rc file, OVERLEAF_DATA_PATH not set" 212 | fi 213 | if [[ "${OVERLEAF_LOG_PATH:-null}" != "null" ]]; then 214 | print_point 2 "OVERLEAF_LOG_PATH: $OVERLEAF_LOG_PATH" 215 | else 216 | print_point 2 "OVERLEAF_LOG_PATH: not set, keeping logs in container" 217 | fi 218 | 219 | print_point 2 "SERVER_PRO: $SERVER_PRO" 220 | print_point 2 "SIBLING_CONTAINERS_ENABLED: $SIBLING_CONTAINERS_ENABLED" 221 | if [[ "${SIBLING_CONTAINERS_ENABLED:-null}" != "true" ]]; then 222 | add_warning "Detected SIBLING_CONTAINERS_ENABLED=false. 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. Only use this mode in environments where all users are trusted and no isolation of users is required." 223 | fi 224 | if [[ "${SERVER_PRO:-null}" == "true" ]]; then 225 | local logged_in 226 | logged_in="$(grep -q quay.io ~/.docker/config.json && echo 'true' || echo 'false')" 227 | print_point 3 "logged in to quay.io: $logged_in" 228 | if [[ "${logged_in}" == "false" ]]; then 229 | local warning_message=( 230 | "Server Pro enabled, but not logged in to quay.io repository." 231 | "These credentials are supplied by Overleaf with a Server Pro" 232 | "license. See https://www.overleaf.com/for/enterprises/features" 233 | "for more details about Server Pro, or contact support@overleaf.com" 234 | "if you have any questions." 235 | ) 236 | add_warning "${warning_message[@]}" 237 | fi 238 | elif [[ "${SIBLING_CONTAINERS_ENABLED:-null}" == "true" ]]; then 239 | add_warning "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. 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. Set SIBLING_CONTAINERS_ENABLED=false in config/overleaf.rc to continue using insecure in-container compiles." 240 | fi 241 | if [[ "${OVERLEAF_LISTEN_IP:-null}" != "null" ]]; then 242 | print_point 2 "OVERLEAF_LISTEN_IP: ${OVERLEAF_LISTEN_IP}" 243 | fi 244 | if [[ "${OVERLEAF_PORT:-null}" != "null" ]]; then 245 | print_point 2 "OVERLEAF_PORT: ${OVERLEAF_PORT}" 246 | fi 247 | 248 | print_point 2 "MONGO_ENABLED: $MONGO_ENABLED" 249 | if [[ "${MONGO_URL:-null}" != "null" ]]; then 250 | print_point 2 "MONGO_URL: [set here]" 251 | fi 252 | if [[ "${MONGO_IMAGE:-null}" != "null" ]]; then 253 | print_point 2 "MONGO_IMAGE: $MONGO_IMAGE" 254 | fi 255 | if [[ "${MONGO_VERSION:-null}" != "null" ]]; then 256 | print_point 2 "MONGO_VERSION: $MONGO_VERSION" 257 | fi 258 | if [[ "${MONGO_DATA_PATH:-null}" != "null" ]]; then 259 | print_point 2 "MONGO_DATA_PATH: $MONGO_DATA_PATH" 260 | fi 261 | 262 | print_point 2 "REDIS_ENABLED: $REDIS_ENABLED" 263 | if [[ "${REDIS_HOST:-null}" != "null" ]]; then 264 | print_point 2 "REDIS_HOST: [set here]" 265 | fi 266 | if [[ "${REDIS_PORT:-null}" != "null" ]]; then 267 | print_point 2 "REDIS_PORT: [set here]" 268 | fi 269 | if [[ "${REDIS_IMAGE:-null}" != "null" ]]; then 270 | print_point 2 "REDIS_IMAGE: $REDIS_IMAGE" 271 | fi 272 | if [[ "${REDIS_AOF_PERSISTENCE:-null}" != "null" ]]; then 273 | print_point 2 "REDIS_AOF_PERSISTENCE: $REDIS_AOF_PERSISTENCE" 274 | fi 275 | if [[ "${REDIS_DATA_PATH:-null}" != "null" ]]; then 276 | print_point 2 "REDIS_DATA_PATH: $REDIS_DATA_PATH" 277 | fi 278 | 279 | print_point 2 "NGINX_ENABLED: ${NGINX_ENABLED:-null}" 280 | if [[ "${NGINX_CONFIG_PATH:-null}" != "null" ]]; then 281 | print_point 2 "NGINX_CONFIG_PATH: $NGINX_CONFIG_PATH" 282 | fi 283 | if [[ "${TLS_PRIVATE_KEY_PATH:-null}" != "null" ]]; then 284 | print_point 2 "TLS_PRIVATE_KEY_PATH: $TLS_PRIVATE_KEY_PATH" 285 | fi 286 | if [[ "${TLS_CERTIFICATE_PATH:-null}" != "null" ]]; then 287 | print_point 2 "TLS_CERTIFICATE_PATH: $TLS_CERTIFICATE_PATH" 288 | fi 289 | if [[ "${NGINX_HTTP_LISTEN_IP:-null}" != "null" ]]; then 290 | print_point 2 "NGINX_HTTP_LISTEN_IP: $NGINX_HTTP_LISTEN_IP" 291 | fi 292 | if [[ "${NGINX_HTTP_PORT:-null}" != "null" ]]; then 293 | print_point 2 "NGINX_HTTP_PORT: $NGINX_HTTP_PORT" 294 | fi 295 | if [[ "${NGINX_TLS_LISTEN_IP:-null}" != "null" ]]; then 296 | print_point 2 "NGINX_TLS_LISTEN_IP: $NGINX_TLS_LISTEN_IP" 297 | fi 298 | if [[ "${TLS_PORT:-null}" != "null" ]]; then 299 | print_point 2 "TLS_PORT: $TLS_PORT" 300 | fi 301 | 302 | print_point 2 "GIT_BRIDGE_ENABLED: ${GIT_BRIDGE_ENABLED:-null}" 303 | 304 | elif [[ "$config_file" == "config/variables.env" ]]; then 305 | print_point 1 "values" 306 | 307 | # Load vars from the rc file 308 | # shellcheck disable=SC1090 309 | source "$TOOLKIT_ROOT/$config_file" 310 | 311 | if [[ "${SHARELATEX_FILESTORE_BACKEND:-fs}" == "s3" ]]; then 312 | print_point 2 "SHARELATEX_FILESTORE_BACKEND: s3" 313 | if [[ "${SHARELATEX_FILESTORE_USER_FILES_BUCKET_NAME:-null}" != "null" ]]; then 314 | print_point 2 "SHARELATEX_FILESTORE_USER_FILES_BUCKET_NAME: $SHARELATEX_FILESTORE_USER_FILES_BUCKET_NAME" 315 | else 316 | add_warning "SHARELATEX_FILESTORE_USER_FILES_BUCKET_NAME is unset" 317 | fi 318 | if [[ "${SHARELATEX_FILESTORE_TEMPLATE_FILES_BUCKET_NAME:-null}" != "null" ]]; then 319 | print_point 2 "SHARELATEX_FILESTORE_TEMPLATE_FILES_BUCKET_NAME: $SHARELATEX_FILESTORE_TEMPLATE_FILES_BUCKET_NAME" 320 | else 321 | add_warning "SHARELATEX_FILESTORE_TEMPLATE_FILES_BUCKET_NAME is unset" 322 | fi 323 | if [[ "${SHARELATEX_FILESTORE_S3_ENDPOINT:-null}" != "null" ]]; then 324 | print_point 2 "SHARELATEX_FILESTORE_S3_ENDPOINT: [set here]" 325 | else 326 | print_point 2 "SHARELATEX_FILESTORE_S3_ENDPOINT: Using AWS S3" 327 | fi 328 | if [[ "${SHARELATEX_FILESTORE_S3_PATH_STYLE:-null}" == "true" ]]; then 329 | print_point 2 "SHARELATEX_FILESTORE_S3_PATH_STYLE: true" 330 | else 331 | print_point 2 "SHARELATEX_FILESTORE_S3_PATH_STYLE: false" 332 | fi 333 | if [[ "${SHARELATEX_FILESTORE_S3_REGION:-null}" != "null" ]]; then 334 | print_point 2 "SHARELATEX_FILESTORE_S3_REGION: $SHARELATEX_FILESTORE_S3_REGION" 335 | else 336 | print_point 2 "SHARELATEX_FILESTORE_S3_REGION: " 337 | fi 338 | if [[ "${SHARELATEX_FILESTORE_S3_ACCESS_KEY_ID:-null}" != "null" ]]; then 339 | print_point 2 "SHARELATEX_FILESTORE_S3_ACCESS_KEY_ID: [set here]" 340 | else 341 | add_warning "SHARELATEX_FILESTORE_S3_ACCESS_KEY_ID is missing" 342 | fi 343 | if [[ "${SHARELATEX_FILESTORE_S3_SECRET_ACCESS_KEY:-null}" != "null" ]]; then 344 | print_point 2 "SHARELATEX_FILESTORE_S3_SECRET_ACCESS_KEY: [set here]" 345 | else 346 | add_warning "SHARELATEX_FILESTORE_S3_SECRET_ACCESS_KEY is missing" 347 | fi 348 | else 349 | print_point 2 "SHARELATEX_FILESTORE_BACKEND: fs" 350 | fi 351 | if [[ "${SHARELATEX_HISTORY_BACKEND:-fs}" == "s3" ]]; then 352 | print_point 2 "SHARELATEX_HISTORY_BACKEND: s3" 353 | if [[ "${SHARELATEX_HISTORY_PROJECT_BLOBS_BUCKET:-null}" != "null" ]]; then 354 | print_point 2 "SHARELATEX_HISTORY_PROJECT_BLOBS_BUCKET: $SHARELATEX_HISTORY_PROJECT_BLOBS_BUCKET" 355 | else 356 | add_warning "SHARELATEX_HISTORY_PROJECT_BLOBS_BUCKET is unset" 357 | fi 358 | if [[ "${SHARELATEX_HISTORY_CHUNKS_BUCKET:-null}" != "null" ]]; then 359 | print_point 2 "SHARELATEX_HISTORY_CHUNKS_BUCKET: $SHARELATEX_HISTORY_CHUNKS_BUCKET" 360 | else 361 | add_warning "SHARELATEX_HISTORY_CHUNKS_BUCKET is unset" 362 | fi 363 | if [[ "${SHARELATEX_HISTORY_S3_ENDPOINT:-null}" != "null" ]]; then 364 | print_point 2 "SHARELATEX_HISTORY_S3_ENDPOINT: [set here]" 365 | else 366 | print_point 2 "SHARELATEX_HISTORY_S3_ENDPOINT: Using AWS S3" 367 | fi 368 | if [[ "${SHARELATEX_HISTORY_S3_PATH_STYLE:-null}" == "true" ]]; then 369 | print_point 2 "SHARELATEX_HISTORY_S3_PATH_STYLE: true" 370 | else 371 | print_point 2 "SHARELATEX_HISTORY_S3_PATH_STYLE: false" 372 | fi 373 | if [[ "${SHARELATEX_HISTORY_S3_REGION:-null}" != "null" ]]; then 374 | print_point 2 "SHARELATEX_HISTORY_S3_REGION: $SHARELATEX_HISTORY_S3_REGION" 375 | else 376 | print_point 2 "SHARELATEX_HISTORY_S3_REGION: " 377 | fi 378 | if [[ "${SHARELATEX_HISTORY_S3_ACCESS_KEY_ID:-null}" != "null" ]]; then 379 | print_point 2 "SHARELATEX_HISTORY_S3_ACCESS_KEY_ID: [set here]" 380 | else 381 | add_warning "SHARELATEX_HISTORY_S3_ACCESS_KEY_ID is missing" 382 | fi 383 | if [[ "${SHARELATEX_HISTORY_S3_SECRET_ACCESS_KEY:-null}" != "null" ]]; then 384 | print_point 2 "SHARELATEX_HISTORY_S3_SECRET_ACCESS_KEY: [set here]" 385 | else 386 | add_warning "SHARELATEX_HISTORY_S3_SECRET_ACCESS_KEY is missing" 387 | fi 388 | else 389 | print_point 2 "SHARELATEX_HISTORY_BACKEND: fs" 390 | fi 391 | 392 | if [[ "${OVERLEAF_FILESTORE_BACKEND:-fs}" == "s3" ]]; then 393 | print_point 2 "OVERLEAF_FILESTORE_BACKEND: s3" 394 | if [[ "${OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME:-null}" != "null" ]]; then 395 | print_point 2 "OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME: $OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME" 396 | else 397 | add_warning "OVERLEAF_FILESTORE_USER_FILES_BUCKET_NAME is unset" 398 | fi 399 | if [[ "${OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME:-null}" != "null" ]]; then 400 | print_point 2 "OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME: $OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME" 401 | else 402 | add_warning "OVERLEAF_FILESTORE_TEMPLATE_FILES_BUCKET_NAME is unset" 403 | fi 404 | if [[ "${OVERLEAF_FILESTORE_S3_ENDPOINT:-null}" != "null" ]]; then 405 | print_point 2 "OVERLEAF_FILESTORE_S3_ENDPOINT: [set here]" 406 | else 407 | print_point 2 "OVERLEAF_FILESTORE_S3_ENDPOINT: Using AWS S3" 408 | fi 409 | if [[ "${OVERLEAF_FILESTORE_S3_PATH_STYLE:-null}" == "true" ]]; then 410 | print_point 2 "OVERLEAF_FILESTORE_S3_PATH_STYLE: true" 411 | else 412 | print_point 2 "OVERLEAF_FILESTORE_S3_PATH_STYLE: false" 413 | fi 414 | if [[ "${OVERLEAF_FILESTORE_S3_REGION:-null}" != "null" ]]; then 415 | print_point 2 "OVERLEAF_FILESTORE_S3_REGION: $OVERLEAF_FILESTORE_S3_REGION" 416 | else 417 | print_point 2 "OVERLEAF_FILESTORE_S3_REGION: " 418 | fi 419 | if [[ "${OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID:-null}" != "null" ]]; then 420 | print_point 2 "OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID: [set here]" 421 | else 422 | add_warning "OVERLEAF_FILESTORE_S3_ACCESS_KEY_ID is missing" 423 | fi 424 | if [[ "${OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY:-null}" != "null" ]]; then 425 | print_point 2 "OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY: [set here]" 426 | else 427 | add_warning "OVERLEAF_FILESTORE_S3_SECRET_ACCESS_KEY is missing" 428 | fi 429 | else 430 | print_point 2 "OVERLEAF_FILESTORE_BACKEND: fs" 431 | fi 432 | if [[ "${OVERLEAF_HISTORY_BACKEND:-fs}" == "s3" ]]; then 433 | print_point 2 "OVERLEAF_HISTORY_BACKEND: s3" 434 | if [[ "${OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET:-null}" != "null" ]]; then 435 | print_point 2 "OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET: $OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET" 436 | else 437 | add_warning "OVERLEAF_HISTORY_PROJECT_BLOBS_BUCKET is unset" 438 | fi 439 | if [[ "${OVERLEAF_HISTORY_CHUNKS_BUCKET:-null}" != "null" ]]; then 440 | print_point 2 "OVERLEAF_HISTORY_CHUNKS_BUCKET: $OVERLEAF_HISTORY_CHUNKS_BUCKET" 441 | else 442 | add_warning "OVERLEAF_HISTORY_CHUNKS_BUCKET is unset" 443 | fi 444 | if [[ "${OVERLEAF_HISTORY_S3_ENDPOINT:-null}" != "null" ]]; then 445 | print_point 2 "OVERLEAF_HISTORY_S3_ENDPOINT: [set here]" 446 | else 447 | print_point 2 "OVERLEAF_HISTORY_S3_ENDPOINT: Using AWS S3" 448 | fi 449 | if [[ "${OVERLEAF_HISTORY_S3_PATH_STYLE:-null}" == "true" ]]; then 450 | print_point 2 "OVERLEAF_HISTORY_S3_PATH_STYLE: true" 451 | else 452 | print_point 2 "OVERLEAF_HISTORY_S3_PATH_STYLE: false" 453 | fi 454 | if [[ "${OVERLEAF_HISTORY_S3_REGION:-null}" != "null" ]]; then 455 | print_point 2 "OVERLEAF_HISTORY_S3_REGION: $OVERLEAF_HISTORY_S3_REGION" 456 | else 457 | print_point 2 "OVERLEAF_HISTORY_S3_REGION: " 458 | fi 459 | if [[ "${OVERLEAF_HISTORY_S3_ACCESS_KEY_ID:-null}" != "null" ]]; then 460 | print_point 2 "OVERLEAF_HISTORY_S3_ACCESS_KEY_ID: [set here]" 461 | else 462 | add_warning "OVERLEAF_HISTORY_S3_ACCESS_KEY_ID is missing" 463 | fi 464 | if [[ "${OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY:-null}" != "null" ]]; then 465 | print_point 2 "OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY: [set here]" 466 | else 467 | add_warning "OVERLEAF_HISTORY_S3_SECRET_ACCESS_KEY is missing" 468 | fi 469 | else 470 | print_point 2 "OVERLEAF_HISTORY_BACKEND: fs" 471 | fi 472 | fi 473 | fi 474 | done 475 | } 476 | 477 | function cleanup() { 478 | rm "$WARNINGS_FILE" 479 | } 480 | 481 | function __main__() { 482 | read_image_version 483 | print_section_separator "Overleaf Doctor" 484 | check_retracted_version 485 | check_sharelatex_env_vars 486 | check_host_information 487 | check_dependencies 488 | check_docker_daemon 489 | check_config_files 490 | print_warnings 491 | print_section_separator "End" 492 | cleanup 493 | } 494 | 495 | __main__ "$@" 496 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published by 637 | the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | --------------------------------------------------------------------------------