From 9345c30a61811ebe237dea0ce2083fee5ed592a3 Mon Sep 17 00:00:00 2001 From: timdeluxe <5765175+timdeluxe@users.noreply.github.com> Date: Thu, 4 Nov 2021 18:52:40 +0100 Subject: [PATCH] Adding option to include additional java_opts (#52) --- README.md | 4 ++++ manifests/allinone.pp | 1 + manifests/params.pp | 1 + manifests/server.pp | 7 +++++-- templates/server/environment.epp | 5 ++++- tests/vagrant.pp | 1 + 6 files changed, 16 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 942a275..bf44849 100644 --- a/README.md +++ b/README.md @@ -277,6 +277,10 @@ Sets the initial Java heap size (-Xms) for Graylog. Defaults to `1g`. Sets the maximum Java heap size (-Xmx) for Graylog. Defaults to `1g`. +##### `java_opts` + +Additional java options for Graylog. Defaults to ``. + ##### `restart_on_package_upgrade` This setting restarts the `graylog-server` service if the os package is upgraded. diff --git a/manifests/allinone.pp b/manifests/allinone.pp index 45fbd9f..07447ee 100644 --- a/manifests/allinone.pp +++ b/manifests/allinone.pp @@ -47,5 +47,6 @@ config => $graylog['config'], java_initial_heap_size => $graylog['java_initial_heap_size'], java_max_heap_size => $graylog['java_max_heap_size'], + java_opts => $graylog['java_opts'], } } diff --git a/manifests/params.pp b/manifests/params.pp index 5b0290b..96a4540 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -17,4 +17,5 @@ $java_initial_heap_size = '1g' $java_max_heap_size = '1g' + $java_opts = '' } diff --git a/manifests/server.pp b/manifests/server.pp index 66b1145..4541edb 100644 --- a/manifests/server.pp +++ b/manifests/server.pp @@ -7,6 +7,7 @@ $enable = true, $java_initial_heap_size = $graylog::params::java_initial_heap_size, $java_max_heap_size = $graylog::params::java_max_heap_size, + $java_opts = $graylog::params::java_opts, Boolean $restart_on_package_upgrade = false, ) inherits graylog::params { if $config == undef { @@ -61,7 +62,8 @@ content => epp("${module_name}/server/environment.epp", { 'java_initial_heap_size' => $java_initial_heap_size, - 'java_max_heap_size' => $java_max_heap_size + 'java_max_heap_size' => $java_max_heap_size, + 'java_opts' => $java_opts }), } } @@ -74,7 +76,8 @@ content => epp("${module_name}/server/environment.epp", { 'java_initial_heap_size' => $java_initial_heap_size, - 'java_max_heap_size' => $java_max_heap_size + 'java_max_heap_size' => $java_max_heap_size, + 'java_opts' => $java_opts }), } } diff --git a/templates/server/environment.epp b/templates/server/environment.epp index 519864b..7a10d5d 100644 --- a/templates/server/environment.epp +++ b/templates/server/environment.epp @@ -1,4 +1,4 @@ -<%- | String $java_initial_heap_size = '1g', String $java_max_heap_size = '1g' | -%> +<%- | String $java_initial_heap_size = '1g', String $java_max_heap_size = '1g', String $java_opts = "" | -%> # Path to the java executable. JAVA=/usr/bin/java @@ -8,6 +8,9 @@ GRAYLOG_SERVER_JAVA_OPTS="-Xms<%= $java_initial_heap_size %> -Xmx<%= $java_max_h # Avoid endless loop with some TLSv1.3 implementations. GRAYLOG_SERVER_JAVA_OPTS="$GRAYLOG_SERVER_JAVA_OPTS -Djdk.tls.acknowledgeCloseNotify=true" +# Additional java opts +GRAYLOG_SERVER_JAVA_OPTS="$GRAYLOG_SERVER_JAVA_OPTS <%= $java_opts %>" + # Pass some extra args to graylog-server. (i.e. "-d" to enable debug mode) GRAYLOG_SERVER_ARGS="" diff --git a/tests/vagrant.pp b/tests/vagrant.pp index 36d7569..307b23b 100644 --- a/tests/vagrant.pp +++ b/tests/vagrant.pp @@ -19,5 +19,6 @@ }, java_initial_heap_size => '2g', java_max_heap_size => '2g', + java_opts => '-Dcom.sun.management.jmxremote', } }