I'm trying to install/setup tomcat7 using puppet.
I haven't found a module that lets me set up the max heap memory.
So I've been trying to inject the line "CATALINA_OPTS=-Xmx2048m" into the catalina.sh file.
I'm not really sure what the best way to do this in though. I looked into the file_line resource, but I don't know how to make it insert in the middle of the catalina.sh file.
Any suggestions welcomed.
Update: Some people suggested templates, but I don't need to parameterize anything. I want to be able to take whatever catalina.sh that the tomcat install produces and inject a line into it. If I used templates, or replaced the file with a modified copy, then the next tomcat I install may have a different catalina.sh, and this would overwrite the new file format.
Maybe what I need is a way to insert a line AFTER another line. I believe I can insert "CATALINA_OPTS=" right after the #!/bin/bash line. Is this possible?
Use file_line's matches
parameter, so existing CATALINA_OPTS line in original file will be replaced with the new line.
file_line { "Tomcat Memory":
line => "CATALINA_OPTS=-Xmx2048m",
path=> "/route/to/catalina.sh",
notify =>Service['tomcat'],
match => "CATALINA_OPTS=.*",
}
I run to the same issue. I'm installing tomcat using puppetlabs/tomcat, but there is not a word about the way to manage the memory size.
However there is a way to manage the setenv.sh which let you set the JAVA
Here is an example that should do what you want:
include 'java'
class { 'tomcat':
install_from_source => true,
}
tomcat::instance{ 'default':
source_url => 'http://mirror.nexcess.net/apache/tomcat/tomcat-8/v8.0.23/bin/apache-tomcat-8.0.23.tar.gz',
} ->
tomcat::setenv::entry {'JAVA_OPTS':
value => "-Xmx256m",
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With