I am trying to deploy Solr on Tomcat using Puppet. When the solr.war is copied to /var/lib/tomcat6/webapps/solr.war, Tomcat takes some time to notice the newly added file and deploy it. One of the deployment steps involve expanding the .war file into /var/lib/tomcat6/webapps/solr/ directory.
Problem: I am trying to add more files (like apache-solr-dataimporthandler-3.6.1.jar) into the /var/lib/tomcat6/webapps/solr/ after tomcat has deployed solr.war and created this structure. If I created the folder /var/lib/tomcat6/webapps/solr/ before tomcat does, which is what my manifest below is doing, tomcat will not deploy Solr.
Is it possible to make Puppet wait for tomcat to deploy solr, before adding files into the newly created directory?
Manifest
class solr {
file { '/var/lib/tomcat6/webapps/solr.war':
ensure => present,
owner => root,
group => root,
mode => 644,
source => 'puppet:///modules/solr/apache-solr-3.6.1.war',
notify => Service['tomcat'],
}
file { '/usr/share/solr':
ensure => present,
source => 'puppet:///modules/solr/solr',
recurse => true,
require => File['/var/lib/tomcat6/webapps/solr.war'],
notify => Service['tomcat'],
}
$solr_dirs = [ "/var/lib/tomcat6/webapps/solr/", "/var/lib/tomcat6/webapps/solr/WEB-INF/",
"/var/lib/tomcat6/webapps/solr/WEB-INF/lib/"]
file { $solr_dirs:
ensure => "directory",
}
file { '/var/lib/tomcat6/webapps/solr/WEB-INF/web.xml':
ensure => present,
owner => root,
group => root,
mode => 644,
source => 'puppet:///modules/solr/web.xml',
require => File[$solr_dirs],
}
file { '/var/lib/tomcat6/webapps/solr/WEB-INF/lib/apache-solr-dataimporthandler-3.6.1.jar':
ensure => present,
owner => root,
group => root,
mode => 644,
source => 'puppet:///modules/solr/apache-solr-dataimporthandler-3.6.1.jar',
require => File[$solr_dirs],
}
}
You don’t really need to add those additional files to the solr war file. Usually it’s better to leave the war as it is. Those files can be added to your solr_home, which is somewhere else outside of the application server as well. Since you mentioned a jar file, you can configure the path to your jars in your
solrconfig.xml. That way they will be loaded from Solr while starting up. Have a look at this page too.