From 5c2987aceca778439b07058aeb96e4624f5e7d78 Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Tue, 3 Sep 2024 11:29:18 +0100 Subject: [PATCH 1/2] Add config option for making application logs available on docker host --- CHANGELOG.md | 4 ++++ bin/docker-compose | 19 +++++++++++++++++++ bin/doctor | 5 +++++ doc/docker-compose-to-toolkit-migration.md | 2 ++ doc/overleaf-rc.md | 10 +++++++++- lib/docker-compose.logging.yml | 6 ++++++ 6 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 lib/docker-compose.logging.yml diff --git a/CHANGELOG.md b/CHANGELOG.md index 157b51b..ea93d28 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 2024-09-03 +### Added +- 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. + ## 2024-08-27 ### Added - Surface `MONGO_VERSION` from `bin/doctor` diff --git a/bin/docker-compose b/bin/docker-compose index 01a31dc..de39481 100755 --- a/bin/docker-compose +++ b/bin/docker-compose @@ -31,6 +31,9 @@ function build_environment() { if [[ $SERVER_PRO == "true" && "$SIBLING_CONTAINERS_ENABLED" == "true" ]]; then set_sibling_containers_vars fi + if [[ "${OVERLEAF_LOG_PATH:-null}" != "null" ]]; then + set_logging_vars + fi if [[ $NGINX_ENABLED == "true" ]]; then set_nginx_vars fi @@ -46,6 +49,9 @@ function build_environment() { function canonicalize_data_paths() { OVERLEAF_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$OVERLEAF_DATA_PATH") + if [[ "${OVERLEAF_LOG_PATH:-null}" != "null" ]]; then + OVERLEAF_LOG_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$OVERLEAF_LOG_PATH") + fi MONGO_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$MONGO_DATA_PATH") REDIS_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$REDIS_DATA_PATH") GIT_BRIDGE_DATA_PATH=$(cd "$TOOLKIT_ROOT"; realpath "$GIT_BRIDGE_DATA_PATH") @@ -145,6 +151,19 @@ function set_sibling_containers_vars() { export OVERLEAF_DATA_PATH } +# Set environment variables for docker-compose.logging.yml +function set_logging_vars() { + DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.logging.yml") + + if [[ $IMAGE_VERSION_MAJOR -ge 5 ]]; then + OVERLEAF_IN_CONTAINER_LOG_PATH="/var/log/overleaf" + else + OVERLEAF_IN_CONTAINER_LOG_PATH="/var/log/sharelatex" + fi + export OVERLEAF_IN_CONTAINER_LOG_PATH + export OVERLEAF_LOG_PATH +} + # Set environment variables for docker-compose.nginx.yml function set_nginx_vars() { DOCKER_COMPOSE_FLAGS+=(-f "$TOOLKIT_ROOT/lib/docker-compose.nginx.yml") diff --git a/bin/doctor b/bin/doctor index b5ea008..33f356f 100755 --- a/bin/doctor +++ b/bin/doctor @@ -210,6 +210,11 @@ function check_config_files() { print_point 2 "OVERLEAF_DATA_PATH: MISSING !" add_warning "rc file, OVERLEAF_DATA_PATH not set" fi + if [[ "${OVERLEAF_LOG_PATH:-null}" != "null" ]]; then + print_point 2 "OVERLEAF_LOG_PATH: $OVERLEAF_LOG_PATH" + else + print_point 2 "OVERLEAF_LOG_PATH: not set, keeping logs in container" + fi print_point 2 "SERVER_PRO: $SERVER_PRO" if [[ "${SERVER_PRO:-null}" == "true" ]]; then diff --git a/doc/docker-compose-to-toolkit-migration.md b/doc/docker-compose-to-toolkit-migration.md index bdbe927..d947ceb 100644 --- a/doc/docker-compose-to-toolkit-migration.md +++ b/doc/docker-compose-to-toolkit-migration.md @@ -77,6 +77,8 @@ For instructions on how to migrate `nginx`, please see [TLS Proxy for Overleaf T 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. +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. + ### MongoDB ### 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. diff --git a/doc/overleaf-rc.md b/doc/overleaf-rc.md index cc9ccf8..40ee96f 100644 --- a/doc/overleaf-rc.md +++ b/doc/overleaf-rc.md @@ -18,10 +18,18 @@ This is useful when running multiple instances of Overleaf on one host, as each ### `OVERLEAF_DATA_PATH` -Sets the path to the directory that will be mounted into the main `sharelatex` container, and used to store compile data. This can be either a full path (beginning with a `/`), or relative to the base directory of the toolkit. +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. - Default: data/sharelatex +### `OVERLEAF_LOG_PATH` + +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. + +Remove the config entry to disable the bind-mount. When not set, logs will be discarded when recreating the container. + +- Default: not set + ### `OVERLEAF_LISTEN_IP` Sets the host IP address(es) that the container will bind to. For example, if this is set to `0.0.0.0`, then the web interface will be available on any host IP address. diff --git a/lib/docker-compose.logging.yml b/lib/docker-compose.logging.yml new file mode 100644 index 0000000..64124f8 --- /dev/null +++ b/lib/docker-compose.logging.yml @@ -0,0 +1,6 @@ +--- +version: '2.2' +services: + sharelatex: + volumes: + - "${OVERLEAF_LOG_PATH}:${OVERLEAF_IN_CONTAINER_LOG_PATH}" From 8b2b82772699f0ec7abc7eb6888ec7dce7043ade Mon Sep 17 00:00:00 2001 From: Jakob Ackermann Date: Fri, 6 Sep 2024 15:03:47 +0200 Subject: [PATCH 2/2] Add section on selecting Server Pro to Quick Start Guide (#291) --- doc/quick-start-guide.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/quick-start-guide.md b/doc/quick-start-guide.md index 8cb0c3d..61a1496 100644 --- a/doc/quick-start-guide.md +++ b/doc/quick-start-guide.md @@ -74,6 +74,15 @@ These are the three configuration files you will interact with: - `variables.env` : environment variables loaded into the docker container - `version` : the version of the docker images to use +## Selecting Overleaf Community Edition or Server Pro + +By default, the Overleaf Toolkit uses the free Overleaf Community Edition. + +Overleaf Server Pro is a commercial version of Overleaf, with extra features and commercial support. +See https://www.overleaf.com/for/enterprises/features for more details about Server Pro and how to +buy a license. + +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. ## Starting Up