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

Add config option for making application logs available on docker host

This commit is contained in:
Jakob Ackermann 2024-09-03 11:29:18 +01:00
parent b7af392f9a
commit 5c2987acec
No known key found for this signature in database
GPG key ID: 30C56800FCA3828A
6 changed files with 45 additions and 1 deletions

View file

@ -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`

View file

@ -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")

View file

@ -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

View file

@ -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.

View file

@ -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.

View file

@ -0,0 +1,6 @@
---
version: '2.2'
services:
sharelatex:
volumes:
- "${OVERLEAF_LOG_PATH}:${OVERLEAF_IN_CONTAINER_LOG_PATH}"