Skip to content

fix: ensure $LOGDIR exists at runtime for PVC-mounted deployments#68

Open
webdz9r wants to merge 1 commit intoOpenVoxProject:mainfrom
webdz9r:fix/create-logdir-for-pvc-mounts
Open

fix: ensure $LOGDIR exists at runtime for PVC-mounted deployments#68
webdz9r wants to merge 1 commit intoOpenVoxProject:mainfrom
webdz9r:fix/create-logdir-for-pvc-mounts

Conversation

@webdz9r
Copy link
Copy Markdown

@webdz9r webdz9r commented Feb 26, 2026

Summary

When deploying the openvoxdb container in Kubernetes with a PersistentVolumeClaim (PVC) mounted at /opt/puppetlabs/server/data/puppetdb/, the JVM fails to start on every fresh deployment because the $LOGDIR directory (/opt/puppetlabs/server/data/puppetdb/logs/) does not exist on the empty volume.

The Containerfile already creates $LOGDIR at build time:

mkdir -p "$LOGDIR" && \
chown puppetdb:puppetdb "$LOGDIR" && \

However, in Kubernetes, a PVC mount overlays the entire parent directory with an empty volume, erasing the logs/ subdirectory that was created during the image build.

Fix

Adds 35-create-logdir.sh to the container entrypoint scripts, which runs mkdir -p "$LOGDIR" before the JVM starts. This follows the existing numbered script convention (10-wait-for-hosts.sh, 20-configure-ssl.sh, 30-certificate-allowlist.sh) and is idempotent — if the directory already exists (no PVC, or subsequent boots), it's a no-op.

Affected Versions

Tested and confirmed on 8.9.0-main, 8.11.0-main, and 8.12.1-latest.

Error Without Fix

[0.001s][error][logging] Error opening log file '/opt/puppetlabs/server/data/puppetdb/logs/puppetdb_gc.log': No such file or directory
[0.001s][error][logging] Initialization of output 'file=/opt/puppetlabs/server/data/puppetdb/logs/puppetdb_gc.log' using options '(null)' failed.
Invalid -Xlog option '-Xlog:gc*:file=/opt/puppetlabs/server/data/puppetdb/logs/puppetdb_gc.log', see error log for details.
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

Workaround (Current)

Users can work around this with the Helm chart's extraInitContainers:

puppetdb:
  extraInitContainers:
    - name: create-log-dir
      image: busybox:1.37
      command: ["sh", "-c", "mkdir -p /data/logs && chown 999:999 /data/logs"]
      volumeMounts:
        - name: puppetdb-storage
          mountPath: /data

Environment

  • Helm chart: openvox/puppetserver v10.0.1
  • Kubernetes: GKE v1.33
  • Storage: standard-rwo (pd.csi.storage.gke.io), ReadWriteOnce PVCs
  • PostgreSQL: Cloud SQL PostgreSQL 16 (external, private IP)

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.
@webdz9r
Copy link
Copy Markdown
Author

webdz9r commented Feb 26, 2026

Fixes #69

@rwaffen
Copy link
Copy Markdown
Member

rwaffen commented Mar 6, 2026

@webdz9r may you please sign your commits? thx :)
https://docs.github.com/en/authentication/managing-commit-signature-verification/signing-commits

gpg or ssh is both okay

@corporate-gadfly
Copy link
Copy Markdown
Contributor

@webdz9r another reminder to kindly sign your commits, please.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants