summaryrefslogtreecommitdiffstats
path: root/packaging/docker/run.sh
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2023-10-20 17:29:09 +0300
committerGitHub <noreply@github.com>2023-10-20 17:29:09 +0300
commit3a3ce98db4f525f723e8cd2383fd924b43b5490e (patch)
treec0482a139003bab3a6cf585fc89df11d61f80b89 /packaging/docker/run.sh
parent8f17bbc1594da3a6516ac93ce5750c495ae2b29e (diff)
docker install: support for Proxmox vms/containers name resolution (#16193)
Diffstat (limited to 'packaging/docker/run.sh')
-rwxr-xr-xpackaging/docker/run.sh27
1 files changed, 27 insertions, 0 deletions
diff --git a/packaging/docker/run.sh b/packaging/docker/run.sh
index 1b6ce7c661..fd5e44b81d 100755
--- a/packaging/docker/run.sh
+++ b/packaging/docker/run.sh
@@ -46,6 +46,33 @@ if [ -n "${PGID}" ]; then
usermod -a -G "${PGID}" "${DOCKER_USR}" || echo >&2 "Could not add netdata user to group docker with ID ${PGID}"
fi
+# Needed to read Proxmox VMs and (LXC) containers configuration files (name resolution + CPU and memory limits)
+function add_netdata_to_proxmox_conf_files_group() {
+ group_guid="$(stat -c %g /host/etc/pve 2>/dev/null || true)"
+ [ -z "${group_guid}" ] && return
+
+ if ! getent group "${group_guid}" >/dev/null; then
+ echo "Creating proxmox-etc-pve group with GID ${group_guid}"
+ if ! addgroup -g "${group_guid}" "proxmox-etc-pve"; then
+ echo >&2 "Failed to add group proxmox-etc-pve with GID ${group_guid}."
+ return
+ fi
+ fi
+
+ if ! getent group "${group_guid}" | grep -q netdata; then
+ echo "Assign netdata user to group ${group_guid}"
+ if ! usermod -a -G "${group_guid}" "${DOCKER_USR}"; then
+ echo >&2 "Failed to add netdata user to group with GID ${group_guid}."
+ return
+ fi
+ fi
+}
+
+if [ -d "/host/etc/pve" ]; then
+ add_netdata_to_proxmox_conf_files_group || true
+fi
+
+
if mountpoint -q /etc/netdata; then
echo "Copying stock configuration to /etc/netdata"
cp -an /etc/netdata.stock/* /etc/netdata