diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bc1ee1..f151d92 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 - Add loud warning to `bin/doctor` when not using Sandboxed Compiles/`SIBLING_CONTAINERS_ENABLED=true` diff --git a/bin/docker-compose b/bin/docker-compose index 7515772..e7ccb49 100755 --- a/bin/docker-compose +++ b/bin/docker-compose @@ -41,6 +41,9 @@ function build_environment() { fi fi fi + if [[ "${OVERLEAF_LOG_PATH:-null}" != "null" ]]; then + set_logging_vars + fi if [[ $NGINX_ENABLED == "true" ]]; then set_nginx_vars fi @@ -56,6 +59,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") @@ -159,6 +165,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 e255035..00e6693 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" print_point 2 "SIBLING_CONTAINERS_ENABLED: $SIBLING_CONTAINERS_ENABLED" 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/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 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}"