I want to add this code in /usr/share/tomcat7/conf/context.xml :
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
sticky="true"
memcachedNodes="n1:<%= node['redis']['host']%>:<%= node['redis']['port']%>"
requestUriIgnorePattern=".*.(ico|png|gif|jpg|css|js)$"
/>
I'm using Chef 11.4, I've created custom cookbook and modify /opsworks_java/templates/default/webapp_context.xml.erb
But it doesnt work. It worked for other file: server.xml!
How can i do that?
thanks.
Finally I've found the solution I've created a template of the context.xml file: opsworks-cookbooks/opsworks_java/templates/default/context.xml.erb
<?xml version='1.0' encoding='utf-8'?>
<Context>
<!-- Default set of monitored resources -->
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<Manager className="de.javakaffee.web.msm.MemcachedBackupSessionManager"
sticky="true"
memcachedNodes="n1:<%= node['redis']['host']%>:<%= node['redis']['port']%>"
requestUriIgnorePattern=".*\.(ico|png|gif|jpg|css|js)$" />
</Context>
then i call it in opsworks-cookbooks/opsworks_java/recipes/tomcat_container_config.rb by adding the following lines:
template 'tomcat context configuration' do
path ::File.join(node['opsworks_java']['tomcat']['catalina_base_dir'], 'context.xml')
source 'context.xml.erb'
owner 'root'
group 'root'
mode 0644
backup false
notifies :restart, 'service[tomcat]'
end
And it works fine!