Inline
On 02/11/2011 08:06 AM, jprovazn(a)redhat.com wrote:
From: Jan Provaznik<jprovazn(a)redhat.com>
---
recipes/deltacloud_recipe/manifests/aggregator.pp | 24 ++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
diff --git a/recipes/deltacloud_recipe/manifests/aggregator.pp
b/recipes/deltacloud_recipe/manifests/aggregator.pp
index 8ffe3ea..4ea56bf 100644
--- a/recipes/deltacloud_recipe/manifests/aggregator.pp
+++ b/recipes/deltacloud_recipe/manifests/aggregator.pp
@@ -93,7 +93,7 @@ class deltacloud::aggregator inherits deltacloud {
rails::migrate::db{"migrate_deltacloud_database":
cwd => "/usr/share/deltacloud-aggregator",
rails_env => "production",
- require => [Rails::Create::Db[create_deltacloud_database],
Service['solr']]}
+ require => [Rails::Create::Db[create_deltacloud_database],
Service['solr'], Service['delayed_job']]}
rails::seed::db{"seed_deltacloud_database":
cwd => "/usr/share/deltacloud-aggregator",
rails_env => "production",
@@ -122,6 +122,17 @@ class deltacloud::aggregator inherits deltacloud {
} else{
apache::site{"deltacloud-aggregator": source =>
'puppet:///modules/deltacloud_recipe/aggregator-httpd.conf'}
}
+
+ ### Start delayed_job service
+ service{"delayed_job":
+ start => "RAILS_ENV=production
/usr/share/deltacloud-aggregator/script/delayed_job start",
+ stop => "RAILS_ENV=production
/usr/share/deltacloud-aggregator/script/delayed_job stop",
+ hasstatus => "false",
+ pattern => "delayed_job",
+ ensure => 'running',
+ require => [Package['deltacloud-aggregator'],
Rails::Create::Db['create_deltacloud_database']]}
+
+
}
This is how I initially did the solr service because there is some magic
in rake and the ruby wrapper around solr itself.
Ian Main correctly pointed out that the doing things this way bypasses
the ability to set up things in chkconfig to allow the service to be set
to restart on reboots.
At a minimum, I'd recommend that we wrap the start/stop in init scripts,
remove the explicit declaration of start/stop methods. I haven't had a
chance to look at the delayed job rpm & scripts themselves, but wanted
to point this out since I was patching to create service scripts
yesterday and you wouldn't have had a chance to see a better sample.
class deltacloud::aggregator::disabled {
@@ -141,6 +152,7 @@ class deltacloud::aggregator::disabled {
require => [Package['deltacloud-aggregator-daemons',
'deltacloud-aggregator-doc'],
Service['solr'],
+ Service['delayed_job'],
Rails::Drop::Db["drop_deltacloud_database"]] }
}
@@ -188,6 +200,16 @@ class deltacloud::aggregator::disabled {
pattern => "solr",
ensure => 'stopped',
require => Service['deltacloud-aggregator']}
+
+ ### stop delayed_job service
+ service{"delayed_job":
+ stop => "RAILS_ENV=production
/usr/share/deltacloud-aggregator/script/delayed_job stop",
+ hasstatus => "false",
+ pattern => "delayed_job",
+ ensure => 'running',
+ require => [Package['deltacloud-aggregator']]}
+
Same here. If we can avoid the use of pattern it would be helpful but
that may not be possible.
+
}
# Create a new site admin aggregator web user