diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-04-14 18:12:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-04-14 18:12:14 +0000 |
commit | bb50acdcb8073654ea667b8c0272e335bd43f844 (patch) | |
tree | 1e00c8a29871426f8182658928dcb62e42d57ce8 /packaging/docker | |
parent | Releasing debian version 1.33.1-1. (diff) | |
download | netdata-bb50acdcb8073654ea667b8c0272e335bd43f844.tar.xz netdata-bb50acdcb8073654ea667b8c0272e335bd43f844.zip |
Merging upstream version 1.34.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'packaging/docker')
-rw-r--r-- | packaging/docker/Dockerfile | 8 | ||||
-rw-r--r-- | packaging/docker/README.md | 2 | ||||
-rwxr-xr-x | packaging/docker/run.sh | 26 |
3 files changed, 26 insertions, 10 deletions
diff --git a/packaging/docker/Dockerfile b/packaging/docker/Dockerfile index d99d393a..89e723a4 100644 --- a/packaging/docker/Dockerfile +++ b/packaging/docker/Dockerfile @@ -65,8 +65,8 @@ ARG NETDATA_UID=201 ARG NETDATA_GID=201 ENV DOCKER_GRP netdata ENV DOCKER_USR netdata -# If DO_NOT_TRACK is set, it will disable anonymous stats collection and reporting -#ENV DO_NOT_TRACK=1 +# If DISABLE_TELEMETRY is set, it will disable anonymous stats collection and reporting +#ENV DISABLE_TELEMETRY=1 # Copy files over RUN mkdir -p /opt/src /var/log/netdata && \ @@ -80,6 +80,7 @@ RUN mkdir -p /opt/src /var/log/netdata && \ # Add netdata user addgroup -g ${NETDATA_GID} -S "${DOCKER_GRP}" && \ adduser -S -H -s /usr/sbin/nologin -u ${NETDATA_GID} -h /etc/netdata -G "${DOCKER_GRP}" "${DOCKER_USR}" + # Fix handling of config directory # Long-term this should leverage BuildKit’s mount option. COPY --from=builder /wheels /wheels @@ -110,7 +111,8 @@ RUN chown -R root:root \ find /var/lib/netdata /var/cache/netdata -type d -exec chmod 0770 {} \; && \ find /var/lib/netdata /var/cache/netdata -type f -exec chmod 0660 {} \; && \ pip --no-cache-dir install /wheels/* && \ - rm -rf /wheels + rm -rf /wheels && \ + cp -va /etc/netdata /etc/netdata.stock ENV NETDATA_LISTENER_PORT 19999 EXPOSE $NETDATA_LISTENER_PORT diff --git a/packaging/docker/README.md b/packaging/docker/README.md index 0052bebe..dcce9a4a 100644 --- a/packaging/docker/README.md +++ b/packaging/docker/README.md @@ -489,4 +489,4 @@ Once you have contacted the Netdata owners to setup you up on Github and Travis, Having followed these instructions, your forked repository should be all set up for integration with Travis CI. Happy testing! -[![analytics](https://www.google-analytics.com/collect?v=1&aip=1&t=pageview&_s=1&ds=github&dr=https%3A%2F%2Fgithub.com%2Fnetdata%2Fnetdata&dl=https%3A%2F%2Fmy-netdata.io%2Fgithub%2Fpackaging%2Fdocker%2FREADME&_u=MAC~&cid=5792dfd7-8dc4-476b-af31-da2fdb9f93d2&tid=UA-64295674-3)](<>) + diff --git a/packaging/docker/run.sh b/packaging/docker/run.sh index 3f05a170..1e001256 100755 --- a/packaging/docker/run.sh +++ b/packaging/docker/run.sh @@ -9,13 +9,20 @@ # Author : Austin S. Hemmelgarn <austin@netdata.cloud> set -e -if [ ! "${DO_NOT_TRACK:-0}" -eq 0 ] || [ -n "$DO_NOT_TRACK" ]; then - touch /etc/netdata/.opt-out-from-anonymous-statistics +if [ ! -w / ] && [ "${EUID}" -eq 0 ]; then + echo >&2 "WARNING: This Docker host appears to not properly support newer stat system calls. This is known to cause issues with Netdata (most notably, nodes running on such hosts **cannot be claimed**)." + echo >&2 "WARNING: For more information, see https://learn.netdata.cloud/docs/agent/claim#known-issues-on-older-hosts-with-seccomp-enabled" fi +if [ ! "${DISABLE_TELEMETRY:-0}" -eq 0 ] || + [ -n "$DISABLE_TELEMETRY" ] || + [ ! "${DO_NOT_TRACK:-0}" -eq 0 ] || + [ -n "$DO_NOT_TRACK" ]; then + touch /etc/netdata/.opt-out-from-anonymous-statistics +fi -BALENA_PGID=$(ls -nd /var/run/balena.sock | awk '{print $4}') -DOCKER_PGID=$(ls -nd /var/run/docker.sock | awk '{print $4}') +BALENA_PGID=$(stat -c %g /var/run/balena.sock 2>/dev/null || true) +DOCKER_PGID=$(stat -c %g /var/run/docker.sock 2>/dev/null || true) re='^[0-9]+$' if [[ $BALENA_PGID =~ $re ]]; then @@ -25,7 +32,7 @@ if [[ $BALENA_PGID =~ $re ]]; then elif [[ $DOCKER_PGID =~ $re ]]; then echo "Netdata detected docker.sock" DOCKER_HOST="/var/run/docker.sock" - PGID=$(ls -nd /var/run/docker.sock | awk '{print $4}') + PGID="$DOCKER_PGID" fi export PGID export DOCKER_HOST @@ -37,12 +44,19 @@ if [ -n "${PGID}" ]; then usermod -a -G "${PGID}" "${DOCKER_USR}" || echo >&2 "Could not add netdata user to group docker with ID ${PGID}" fi +if mountpoint -q /etc/netdata && [ -z "$(ls -A /etc/netdata)" ]; then + echo "Copying stock configuration to /etc/netdata" + cp -a /etc/netdata.stock/. /etc/netdata +fi + if [ -n "${NETDATA_CLAIM_URL}" ] && [ -n "${NETDATA_CLAIM_TOKEN}" ] && [ ! -f /var/lib/netdata/cloud.d/claimed_id ]; then + # shellcheck disable=SC2086 /usr/sbin/netdata-claim.sh -token="${NETDATA_CLAIM_TOKEN}" \ -url="${NETDATA_CLAIM_URL}" \ ${NETDATA_CLAIM_ROOMS:+-rooms="${NETDATA_CLAIM_ROOMS}"} \ ${NETDATA_CLAIM_PROXY:+-proxy="${NETDATA_CLAIM_PROXY}"} \ + ${NETDATA_EXTRA_CLAIM_OPTS} \ -daemon-not-running fi -exec /usr/sbin/netdata -u "${DOCKER_USR}" -D -s /host -p "${NETDATA_LISTENER_PORT}" -W set web "web files group" root -W set web "web files owner" root "$@" +exec /usr/sbin/netdata -u "${DOCKER_USR}" -D -s /host -p "${NETDATA_LISTENER_PORT}" "$@" |