Permalink
Browse files

Added supervisord support

  • Loading branch information...
1 parent b535313 commit 3631a6b17bc1b80fbbd6a08313317540c9bbf40d @codeinthehole committed Aug 9, 2012
Showing with 72 additions and 11 deletions.
  1. +28 −2 README.rst
  2. +39 −9 manifests/init.pp
  3. +5 −0 templates/solr.conf
View
@@ -2,10 +2,36 @@
Solr puppet module
==================
-Simple puppet module for installing Solr.
+Simple puppet module for installing Solr and using Supervisord to run it.
This module:
- Downloads a specified tarball
- Unpacks the tarball
-- Creates a symlink to unpacked directory
+- Creates a symlink to unpacked directory
+- Install supervisord
+- Configures supervisord to run solr
+
+Install
+=======
+
+Clone the repo into your puppet modules directory.
+
+Usage
+=====
+
+Minimal::
+
+ class { "solr":
+ solr_home_dir => "/vagrant/www/deploy/solr",
+ }
+
+Maximal::
+
+ class { "solr":
+ package => "apache-solr-3.6.1",
+ source_url => "http://mirrors.enquira.co.uk/apache/lucene/solr/3.6.1/apache-solr-3.6.1.tgz",
+ install_dir => "/opt",
+ solr_home_dir => "/vagrant/www/deploy/solr",
+ solr_data_dir => "/opt/data",
+ }
View
@@ -1,24 +1,54 @@
-class solr ($source_url="http://mirrors.enquira.co.uk/apache/lucene/solr/3.6.1/apache-solr-3.6.1.tgz",
- $install_folder="/opt",
- $package="apache-solr-3.6.1") {
-) {
+class solr::install ($source_url, $install_dir, $package) {
$packages = ["curl", "default-jre"]
package { $packages:
ensure => present
}
- $destination = "$install_folder/$package.tgz"
+ $destination = "$install_dir/$package.tgz"
exec { "download-solr":
command => "curl -o $destination $source_url",
unless => "test -f $destination",
require => Package["curl"],
}
exec { "unpack-solr":
- command => "tar -xzf $destination --directory=$install_folder",
- unless => "test -f $install_folder/$package",
+ command => "tar -xzf $destination --directory=$install_dir",
+ unless => "test -d $install_dir/$package",
require => Exec["download-solr"],
}
- file { "/opt/apache-solr":
+ file { "$install_dir/apache-solr":
ensure => "link",
- target => "$install_folder/$package",
+ target => "$install_dir/$package",
+ }
+}
+
+class solr::supervisord ($install_dir, $solr_home_dir, $solr_data_dir) {
+ package { "supervisor":
+ ensure => present,
+ }
+ $start_dir = "$install_dir/apache-solr/example"
+ file { "/etc/supervisor/conf.d/solr.conf":
+ ensure => present,
+ content => template("solr/solr.conf"),
+ require => Package["supervisor"],
+ }
+ service { "supervisor":
+ ensure => "running",
+ require => [Package["supervisor"]]
+ }
+}
+
+class solr ($source_url="http://mirrors.enquira.co.uk/apache/lucene/solr/3.6.1/apache-solr-3.6.1.tgz",
+ $install_dir="/opt",
+ $package="apache-solr-3.6.1",
+ $solr_home_dir,
+ $solr_data_dir="/opt/data") {
+ class { "solr::install":
+ source_url => $source_url,
+ install_dir => $install_dir,
+ package => $package,
+ }
+ class { "solr::supervisord":
+ install_dir => $install_dir,
+ solr_home_dir => $solr_home_dir,
+ solr_data_dir => $solr_data_dir,
}
}
View
@@ -0,0 +1,5 @@
+[program:solr]
+directory = <%= @start_dir%>
+command = java -Dsolr.solr.home=<%= @solr_home_dir %> -Dsolr.data.dir=<%= @solr_data_dir %> -jar start.jar
+autostart = true
+autorestart = true

0 comments on commit 3631a6b

Please sign in to comment.