From 8b265f87a6bc27eea7774e68c6836426d6e2469d Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Thu, 26 Feb 2026 12:08:14 -0700 Subject: [PATCH] fix: ensure $LOGDIR exists at runtime for PVC-mounted deployments When a PVC is mounted at /opt/puppetlabs/server/data/puppetdb/ in Kubernetes, the mount overlays the entire directory with an empty volume, erasing the logs/ subdirectory that the Containerfile creates at build time. This causes a fatal JVM startup error because the GC log file path does not exist. Add a new entrypoint script that creates $LOGDIR before the JVM starts. This is idempotent and has no effect when the directory already exists. --- .../container-entrypoint.d/35-create-logdir.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 openvoxdb/container-entrypoint.d/35-create-logdir.sh diff --git a/openvoxdb/container-entrypoint.d/35-create-logdir.sh b/openvoxdb/container-entrypoint.d/35-create-logdir.sh new file mode 100755 index 0000000..db7894b --- /dev/null +++ b/openvoxdb/container-entrypoint.d/35-create-logdir.sh @@ -0,0 +1,15 @@ +#!/bin/bash +# Ensure the log directory exists at runtime. +# +# The Containerfile creates $LOGDIR during the image build, but when a +# PersistentVolumeClaim (PVC) is mounted at the parent path +# /opt/puppetlabs/server/data/puppetdb/ (common in Kubernetes), the mount +# overlays the entire directory with an empty volume — erasing the logs/ +# subdirectory that was created at build time. +# +# Without this, the JVM fails fatally on startup: +# Error opening log file '$LOGDIR/puppetdb_gc.log': No such file or directory +# Error: Could not create the Java Virtual Machine. + +mkdir -p "${LOGDIR}" +chown puppetdb:puppetdb "${LOGDIR}"