This allows solr to be controlled through chkconfig so that it
can restart on reboot.
---
recipes/deltacloud_recipe/files/solr.conf | 3 +
recipes/deltacloud_recipe/files/solr.init | 75 +++++++++++++++++++++
recipes/deltacloud_recipe/manifests/aggregator.pp | 18 ++++-
3 files changed, 92 insertions(+), 4 deletions(-)
create mode 100644 recipes/deltacloud_recipe/files/solr.conf
create mode 100644 recipes/deltacloud_recipe/files/solr.init
diff --git a/recipes/deltacloud_recipe/files/solr.conf
b/recipes/deltacloud_recipe/files/solr.conf
new file mode 100644
index 0000000..3830292
--- /dev/null
+++ b/recipes/deltacloud_recipe/files/solr.conf
@@ -0,0 +1,3 @@
+#Provide a spot for overrides
+#RAILS_ENV=production
+
diff --git a/recipes/deltacloud_recipe/files/solr.init
b/recipes/deltacloud_recipe/files/solr.init
new file mode 100644
index 0000000..9a6b4f2
--- /dev/null
+++ b/recipes/deltacloud_recipe/files/solr.init
@@ -0,0 +1,75 @@
+#!/bin/bash
+#
+#
+# solr startup script for solr server
+#
+# chkconfig: - 40 60
+# description: solr is primary server process for the \
+# solr component.
+#
+
+[ -r /etc/sysconfig/solr ] && . /etc/sysconfig/solr
+
+LOCKFILE="${LOCKFILE:-/var/lock/subsys/solr}"
+RAILS_ENV="${RAILS_ENV:-production}"
+
+PROG=/usr/bin/rake
+
+. /etc/init.d/functions
+
+start() {
+ echo -n "Starting solr: "
+
+ cd /usr/share/deltacloud-aggregator; RAILS_ENV=$RAILS_ENV $PROG sunspot:solr:start
+ RETVAL=$?
+ if [ $RETVAL -eq 0 ] && touch $LOCKFILE ; then
+ echo_success
+ echo
+ else
+ echo_failure
+ echo
+ fi
+}
+
+stop() {
+ echo -n "Shutting down solr: "
+ RETVAL=$?
+ cd /usr/share/deltacloud-aggregator; RAILS_ENV=$RAILS_ENV $PROG sunspot:solr:stop
+
+ if [ $RETVAL -eq 0 ] && rm -f $LOCKFILE ; then
+ echo_success
+ echo
+ else
+ echo_failure
+ echo
+ fi
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ stop
+ start
+ ;;
+ reload)
+ ;;
+ force-reload)
+ restart
+ ;;
+ status)
+ status $PROG
+ RETVAL=$?
+ ;;
+ *)
+ echo "Usage: solr {start|stop|restart|status}"
+ exit 1
+ ;;
+esac
+
+exit $RETVAL
+
diff --git a/recipes/deltacloud_recipe/manifests/aggregator.pp
b/recipes/deltacloud_recipe/manifests/aggregator.pp
index 8ffe3ea..3b61dc5 100644
--- a/recipes/deltacloud_recipe/manifests/aggregator.pp
+++ b/recipes/deltacloud_recipe/manifests/aggregator.pp
@@ -101,13 +101,23 @@ class deltacloud::aggregator inherits deltacloud {
### Setup/start solr search service
+ file{"/etc/init.d/solr":
+ source => 'puppet:///modules/deltacloud_recipe/solr.init',
+ mode => 755
+ }
+
+ file{"/etc/sysconfig/solr":
+ source => 'puppet:///modules/deltacloud_recipe/solr.conf',
+ mode => 755
+ }
service{"solr":
- start => "cd /usr/share/deltacloud-aggregator;
RAILS_ENV=production /usr/bin/rake sunspot:solr:start",
- stop => "cd /usr/share/deltacloud-aggregator;
RAILS_ENV=production /usr/bin/rake sunspot:solr:stop",
hasstatus => "false",
- pattern => "solr",
+ pattern => "jetty.port=8983",
ensure => 'running',
- require => [return_if($enable_packages,
Package['deltacloud-aggregator']),
Rails::Create::Db['create_deltacloud_database']]}
+ enable => 'true',
+ require => [File['/etc/init.d/solr',
'/etc/init.d/solr'],
+ return_if($enable_packages,
Package['deltacloud-aggregator']),
+ Rails::Create::Db['create_deltacloud_database']]}
exec{"build_solr_index":
cwd => "/usr/share/deltacloud-aggregator",
--
1.7.4
Show replies by date