Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting java_opts only #343

Merged
merged 11 commits into from
Oct 29, 2024
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* [to 1.2.0](#to-120)
* [to 2.0.0](#to-200)
* [to 2.1.0](#to-210)
* [to 4.0.0](#to-400)
5. [Usage - Configuration options and additional functionality](#usage)
* [Wildfly 25.0.0](#wildfly-2500)
* [Wildfly 23.0.2](#wildfly-2302)
Expand Down Expand Up @@ -122,6 +123,40 @@ class { 'wildfly':

`users_mgmt` was replaced by `mgmt_user`, and additional users should be managed by `wildfly::config::mgtm_user` defined type. The hash format and default value also changed.

## to 4.0.0

### wildfly class

The parameters `java_xms`, `java_xmx` and `java_maxmetaspace_size` are now optional and default to `undef`.
There are now two options to specify `java_opts`:

1. specify each of the mentioned parameters or
1. add all parameters to java\_opts parameter

Example using specific values for undef parameters:

```puppet
class { 'wildfly':
java_xms => '2G',
java_xmx => '2G',
java_maxmetaspace_size => '2G',
java_opts => '-XX:Foo=4',
}
```

Example using the `java_opts` parameter only:

```puppet
class { 'wildfly':
java_opts => [
'-Xms 2G',
'-Xmx 2G',
'-XX:MaxMetaspaceSize=2G',
'-XX:Foo=4',
],
}
```

### New dependency

`jethrocarr/initfact` module.
Expand Down
12 changes: 6 additions & 6 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,27 +299,27 @@ Default value: `undef`

##### <a name="-wildfly--java_xmx"></a>`java_xmx`

Data type: `String`
Data type: `Optional[String[1]]`

Sets Java's `-Xmx` parameter.

Default value: `'512m'`
Default value: `undef`

##### <a name="-wildfly--java_xms"></a>`java_xms`

Data type: `String`
Data type: `Optional[String[1]]`

Sets Java's `-Xms` parameter.

Default value: `'256m'`
Default value: `undef`

##### <a name="-wildfly--java_maxmetaspace_size"></a>`java_maxmetaspace_size`

Data type: `String`
Data type: `Optional[String[1]]`

Sets Java's `-XX:MaxMetaspaceSize` parameter.

Default value: `'128m'`
Default value: `undef`

##### <a name="-wildfly--jboss_opts"></a>`jboss_opts`

Expand Down
6 changes: 3 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@
Wildfly::Config_file $config = 'standalone.xml',
Wildfly::Config_file $domain_config = 'domain.xml',
Wildfly::Config_file $host_config = 'host.xml',
String $java_xmx = '512m',
tuxmea marked this conversation as resolved.
Show resolved Hide resolved
String $java_xms = '256m',
String $java_maxmetaspace_size = '128m',
String $package_ensure = 'present',
Boolean $service_ensure = true,
Boolean $service_manage = true,
Expand Down Expand Up @@ -121,6 +118,9 @@
Optional[String] $remote_username = undef,
Optional[String] $package_name = undef,
Optional[String] $package_version = undef,
Optional[String[1]] $java_xmx = undef,
Optional[String[1]] $java_xms = undef,
Optional[String[1]] $java_maxmetaspace_size = undef,
Variant[Undef, String, Array] $java_opts = undef,
Variant[Undef, String, Array] $process_controller_java_opts = undef,
Variant[Undef, String, Array] $host_controller_java_opts = undef,
Expand Down
11 changes: 10 additions & 1 deletion templates/domain.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ fi
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms<%= $wildfly::java_xms %> -Xmx<%= $wildfly::java_xmx %> -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>"
JAVA_OPTS=$JAVA_OPTS"
<%- if $wildfly::java_xms { -%>
JAVA_OPTS="$JAVA_OPTS -Xms <%= $wildfly::java_xms %>"
<%- } -%>
<%- if $wildfly::java_xmx { -%>
JAVA_OPTS="$JAVA_OPTS -Xmx <%= $wildfly::java_xmx %>"
<%- } -%>
<%- if $wildfly::java_maxmetaspace_size { -%>
JAVA_OPTS="$JAVA_OPTS -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>"
<%- } -%>
JAVA_OPTS="$JAVA_OPTS <% if $wildfly::java_opts =~ Array { -%>
<%= $wildfly::java_opts.join(" ") -%>
<% } elsif $wildfly::java_opts =~ String { -%>
Expand Down
17 changes: 15 additions & 2 deletions templates/standalone.conf.epp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,21 @@ fi
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms<%= $wildfly::java_xms %> -Xmx<%= $wildfly::java_xmx %> -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>"
JAVA_OPTS="$JAVA_OPTS <%= $wildfly::java_opts %>"
JAVA_OPTS="$JAVA_OPTS"
<%- if $wildfly::java_xms { -%>
JAVA_OPTS="$JAVA_OPTS -Xms<%= $wildfly::java_xms %>"
<%- } -%>
<%- if $wildfly::java_xmx { -%>
JAVA_OPTS="$JAVA_OPTS -Xmx<%= $wildfly::java_xmx %>"
<%- } -%>
<%- if $wildfly::java_maxmetaspace_size { -%>
JAVA_OPTS="$JAVA_OPTS -XX:MaxMetaspaceSize=<%= $wildfly::java_maxmetaspace_size %>"
<%- } -%>
JAVA_OPTS="$JAVA_OPTS <% if $wildfly::java_opts =~ Array { -%>
<%= $wildfly::java_opts.join(" ") -%>
<% } elsif $wildfly::java_opts =~ String { -%>
<%= $wildfly::java_opts -%>
<% } -%>"
else
echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi
Expand Down