Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Optional heap and permgen args for java VM #1

Merged
merged 2 commits into from

2 participants

@toolbear

Allow optional $jenkins_max_heap_size and $jenkins_max_perm_size vars to control heap and permgen sizes in Jenkins Java VM via java command line args.

Usage:

$jenkins_max_heap_size = "6G"
$jenkins_max_perm_size = "512M"
include jenkins

Both variables are optional. Arguments to java are only added if the corresponding variable is set.

@bilke
Owner

Thanks for your contribution! I tried a few things but I also was not able to set the variables (I am a puppet noob in fact...).

@toolbear

Noob also. I'll see if I can get help on IRC. Also reading puppet tutorial and have one more idea to try. If I figure it out, I'll update and re-open this PR.

@toolbear toolbear closed this
@toolbear toolbear reopened this
@toolbear

Figured it out. Updated the PR.

@bilke bilke merged commit b104022 into bilke:master
@bilke
Owner

@toolbear Where do you define the variables? For me they seem to be out of scope in config.pp (with a value of undef) no matter where I define them (I tried in my personal config under modules/people/manifests and also in manifests/site.pp).

@toolbear

Sorry for late reply. I noticed that it was merged, but missed your comment asking about it.

For me, defining them in a node block in manifests/site.pp works:

node 'vendacious.local' {
  # core modules, needed for most things
  include dnsmasq
  …

  # jenkins
  $jenkins_max_heap_size = "6G"
  $jenkins_max_perm_size = "512M"
  include java
  include jenkins

  …
}

The values had to be assigned prior to include jenkins. I didn't try setting them in modules/people/manifests. My (limited) understanding of variable scoping in puppet is that these have to be defined in the block, or containing block, of the include jenkins for it to work.

I'm not particularly pleased how this works, but that it works at all is a step forward, I feel.

@bilke
Owner

Yes I also assigned the values prior to include jenkins.

Thanks, defining it in a node block works for me too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 7, 2013
  1. @toolbear
  2. @toolbear

    consistent indentation

    toolbear authored
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 3 deletions.
  1. +2 −0  manifests/config.pp
  2. +9 −3 templates/dev.jenkins.plist.erb
View
2  manifests/config.pp
@@ -13,4 +13,6 @@
$accesslogfile = "${nginx::config::logdir}/jenkins.access.log"
$errorlogfile = "${nginx::config::logdir}/jenkins.error.log"
$port = 18080
+ $max_heap_size = $jenkins_max_heap_size
+ $max_perm_size = $jenkins_max_perm_size
}
View
12 templates/dev.jenkins.plist.erb
@@ -16,13 +16,19 @@
<key>EnvironmentVariables</key>
<dict>
- <key>JENKINS_HOME</key>
- <string><%= scope.lookupvar "jenkins::config::datadir" %></string>
+ <key>JENKINS_HOME</key>
+ <string><%= scope.lookupvar "jenkins::config::datadir" %></string>
</dict>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/java</string>
+ <%- if scope.lookupvar "jenkins::config::max_heap_size" -%>
+ <string>-Xmx<%= scope.lookupvar "jenkins::config::max_heap_size" %></string>
+ <%- end -%>
+ <%- if scope.lookupvar "jenkins::config::max_perm_size" -%>
+ <string>-XX:MaxPermSize=<%= scope.lookupvar "jenkins::config::max_perm_size" %></string>
+ <%- end -%>
<string>-jar</string>
<string><%= scope.lookupvar "jenkins::config::warfile" %></string>
<string>--httpListenAddress=127.0.0.1</string>
@@ -45,4 +51,4 @@
<key>StandardOutPath</key>
<string><%= scope.lookupvar "jenkins::config::consolefile" %></string>
</dict>
-</plist>
+</plist>
Something went wrong with that request. Please try again.