diff --git a/default.env b/default.env index 7bff33df..832572cf 100644 --- a/default.env +++ b/default.env @@ -336,8 +336,12 @@ DEPCLI_DOCKER_TAG=nonesuch TRAEFIK_TAG=v3.1 DDNS_TAG=v2 +# The next two are updated by ethd on every run. If that breaks your workflow, please tell me in a github issue +# or on ethstaker Discord # For the Node Dashboard, define a regex of mount points to ignore for the diskspace check. NODE_EXPORTER_IGNORE_MOUNT_REGEX='^/(dev|proc|sys|run|var/lib/docker/.+)($|/)' +# And the Docker root so promtail scrapes logs from the right location +DOCKER_ROOT=/var/lib/docker # Used by ethd update - please do not adjust -ENV_VERSION=19 +ENV_VERSION=20 diff --git a/ethd b/ethd index 23e07203..399284c0 100755 --- a/ethd +++ b/ethd @@ -70,7 +70,7 @@ __determine_distro() { } -__handle_docker_sudo() { +__handle_docker() { set +e if [[ ( "$__distro" =~ "debian" || "$__distro" = "ubuntu" ) ]] && ! grep -qi microsoft /proc/version; then systemctl status docker >/dev/null @@ -101,6 +101,18 @@ __handle_docker_sudo() { echo "Will use sudo to access Docker" __docker_sudo="sudo" fi + if [[ ( "$__distro" =~ "debian" || "$__distro" = "ubuntu" ) ]] && ! grep -qi microsoft /proc/version; then +# This gets used, but shellcheck doesn't recognize that +# shellcheck disable=SC2034 + DOCKER_ROOT=$(__dodocker system info --format '{{.DockerRootDir}}') + __var=DOCKER_ROOT + __update_value_in_env "${__var}" "${!__var}" "${__env_file}" +# This gets used, but shellcheck doesn't recognize that +# shellcheck disable=SC2034 + NODE_EXPORTER_IGNORE_MOUNT_REGEX="'^/(dev|proc|sys|run|${DOCKER_ROOT#/}/.+)($|/)'" + __var=NODE_EXPORTER_IGNORE_MOUNT_REGEX + __update_value_in_env "${__var}" "${!__var}" "${__env_file}" + fi } @@ -1184,7 +1196,7 @@ __env_migrate() { DEPCLI_SRC_BUILD_TARGET DEPCLI_SRC_REPO DEPCLI_DOCKER_TAG W3S_DOCKER_TAG W3S_DOCKER_REPO \ PG_DOCKER_TAG RETH_SRC_BUILD_TARGET RETH_SRC_REPO RETH_DOCKER_TAG RETH_DOCKER_REPO RETH_DOCKERFILE \ GRANDINE_SRC_BUILD_TARGET GRANDINE_SRC_REPO GRANDINE_DOCKER_TAG GRANDINE_DOCKER_REPO GRANDINE_DOCKERFILE \ - SIREN_DOCKER_TAG SIREN_DOCKER_REPO SSV_DKG_TAG NODE_EXPORTER_IGNORE_MOUNT_REGEX ) + SIREN_DOCKER_TAG SIREN_DOCKER_REPO SSV_DKG_TAG ) __old_vars=( ) __new_vars=( ) @@ -4169,7 +4181,7 @@ if [ "$__command" = "install" ]; then exit "$?" fi -__handle_docker_sudo +__handle_docker __check_compose_version if [ "${__old_compose}" -eq 1 ]; then diff --git a/grafana-cloud.yml b/grafana-cloud.yml index a0591e3f..7454fbd5 100644 --- a/grafana-cloud.yml +++ b/grafana-cloud.yml @@ -115,7 +115,7 @@ services: - /:/rootfs:ro,rslave - /var/run:/var/run - /sys:/sys:ro,rslave - - /var/lib/docker:/var/lib/docker:ro,rslave + - ${DOCKER_ROOT:-/var/lib/docker}:/var/lib/docker:ro,rslave command: - --docker_only - --housekeeping_interval=30s @@ -134,7 +134,7 @@ services: - /etc/machine-id:/etc/machine-id:ro - ./promtail:/etc/promtail - promtail-data:/tmp - - /var/lib/docker/containers:/var/lib/docker/containers:ro,rslave + - ${DOCKER_ROOT:-/var/lib/docker}/containers:/var/lib/docker/containers:ro,rslave entrypoint: ./etc/promtail/entrypoint.sh command: ["/usr/bin/promtail"] environment: diff --git a/grafana.yml b/grafana.yml index 30dc9d03..6805f1fe 100644 --- a/grafana.yml +++ b/grafana.yml @@ -108,7 +108,7 @@ services: - /:/rootfs:ro,rslave - /var/run:/var/run - /sys:/sys:ro,rslave - - /var/lib/docker:/var/lib/docker:ro,rslave + - ${DOCKER_ROOT:-/var/lib/docker}:/var/lib/docker:ro,rslave command: - --docker_only - --housekeeping_interval=30s @@ -127,7 +127,7 @@ services: - /etc/machine-id:/etc/machine-id:ro - ./promtail:/etc/promtail - promtail-data:/tmp - - /var/lib/docker/containers:/var/lib/docker/containers:ro,rslave + - ${DOCKER_ROOT:-/var/lib/docker}/containers:/var/lib/docker/containers:ro,rslave entrypoint: ./etc/promtail/entrypoint.sh command: ["/usr/bin/promtail"] environment: