Skip to content

Commit

Permalink
Detected Docker root dir on startup
Browse files Browse the repository at this point in the history
  • Loading branch information
yorickdowne committed Nov 17, 2024
1 parent 04188dc commit 9e244dd
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
6 changes: 5 additions & 1 deletion default.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 15 additions & 3 deletions ethd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}


Expand Down Expand Up @@ -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=( )
Expand Down Expand Up @@ -4169,7 +4181,7 @@ if [ "$__command" = "install" ]; then
exit "$?"
fi

__handle_docker_sudo
__handle_docker
__check_compose_version

if [ "${__old_compose}" -eq 1 ]; then
Expand Down
4 changes: 2 additions & 2 deletions grafana-cloud.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions grafana.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down

0 comments on commit 9e244dd

Please sign in to comment.