Skip to content
This repository has been archived by the owner on Nov 24, 2020. It is now read-only.

Commit

Permalink
Made all services (except migeld) use bundle exec
Browse files Browse the repository at this point in the history
  • Loading branch information
ngiger committed Nov 13, 2013
1 parent 4584cbc commit 14bd73f
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 279 deletions.
Empty file modified static-modules/oddb_org/files/install_mod_ruby.sh 100644 → 100755
Empty file.
Empty file modified static-modules/oddb_org/files/install_yus.sh 100644 → 100755
Empty file.
20 changes: 19 additions & 1 deletion static-modules/oddb_org/manifests/init.pp
Expand Up @@ -56,7 +56,25 @@
package{'librarian-puppet':
provider => gem,
}

define oddb_org::add_service($svc_path = $oddb_org::service_path, $working_dir, $user, $exec, $arguments) {
file {"$svc_path/$title":
ensure => directory
}
file{"$svc_path/$title/run":
ensure => present,
mode => 0754,
content => template('oddb_org/service_run.erb'),
require => File["$svc_path/$title"],
}
service{"$title":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => File["$svc_path/$title/run"],
require => File["$svc_path/$title/run"],
}
}
$rc_svscan = '/etc/init.d/svscan'
exec{ "$rc_svscan":
command => "/sbin/rc-update add svscan && $rc_svscan restart",
Expand Down
33 changes: 9 additions & 24 deletions static-modules/oddb_org/manifests/migel.pp
Expand Up @@ -8,6 +8,7 @@
$mail_to = hiera('::oddb_org::mail_to', 'put mail_to into hiera-data/private/config.yaml'),
) inherits oddb_org {
include oddb_org::pg
include oddb_org::yus

# we need to install migel
$migel_git = '/var/www/migel'
Expand Down Expand Up @@ -43,21 +44,6 @@
timeout => 15*160, # max wait time in seconds, took just above default 5 minutes on my machine
}

$migel_name = "migeld"
$migel_run = "/var/lib/service/$migel_name/run"
exec{ "$migel_run":
command => "$create_service_script $oddb_user $migel_name '$migel_git/bin/migeld'",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
Vcsrepo["$migel_git"],
User["$oddb_user"],
Package['daemontools'],
],
creates => "$migel_run",
user => 'root', # need to be root to (re-)start yus
}

$migel_yml = '/etc/migel/migel.yml'
file{'/etc/migel':
ensure => directory,
Expand All @@ -69,15 +55,14 @@
group => 'root',
mode => '0644',
require => [ Vcsrepo["$migel_git"], File['/etc/migel'] ]
}
}

service{"$migel_name":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => [ Exec["$migel_run"] ],
require => [ User['apache'], Exec["$migel_run"], ],
oddb_org::add_service{"migeld":
working_dir => "$migel_git",
user => "$oddb_user",
exec => 'ruby',
arguments => 'bin/migeld',
require => [Service['yus'], Vcsrepo["$migel_git"], File["$migel_yml"], User['apache'], Exec["$pg_migel_db_load_script"], ],
subscribe => Service['yus'], # , 'oddb'
}

}
27 changes: 7 additions & 20 deletions static-modules/oddb_org/manifests/oddb_git.pp
Expand Up @@ -94,25 +94,12 @@
require => [Package['apache'], ],
}

$service_location = "$ODDB_HOME/bin/oddbd"
$oddb_run = "/var/lib/service/oddb/run"
exec{ "$oddb_run":
command => "$create_service_script $oddb_user oddb $ODDB_HOME/bin/oddbd",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
User["$oddb_user"],
Package['daemontools'],
],
creates => "$oddb_run",
user => 'root', # need to be root to (re-)start yus
}

service{"oddb":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
require => [User['apache'], Exec["$oddb_setup_run", "$oddb_run"], ],
oddb_org::add_service{"oddb":
working_dir => "$ODDB_HOME",
user => "$oddb_user",
exec => 'bundle exec ruby',
arguments => 'bin/oddbd',
require => [Service['yus'], User['apache'], Exec["$oddb_setup_run"], ],
subscribe => Service['yus'], # , 'oddb'
}
}
239 changes: 58 additions & 181 deletions static-modules/oddb_org/manifests/services.pp
Expand Up @@ -3,7 +3,7 @@

class oddb_org::services(
) inherits oddb_org {

require oddb_org::yus
# not active anymore
# * analysisparse
# * readonly
Expand Down Expand Up @@ -31,198 +31,75 @@
creates => "/usr/lib64/ruby/site_ruby/1.9.1/x86_64-linux/rwv2.so",
}

$crawler_name = "oddb_crawler"
$crawler_run = "/var/lib/service/$crawler_name/run"
exec{ "$crawler_run":
command => "$create_service_script $oddb_user $crawler_name '$ODDB_HOME/bin/oddbd crawler'",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
User["$oddb_user"],
Package['daemontools'],
],
creates => "$crawler_run",
user => 'root', # need to be root to (re-)start yus
}

service{"$crawler_name":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => Exec["$crawler_run"],
require => [Service['yus'], User['apache'], Exec["$crawler_run"], ],
oddb_org::add_service{"oddb_crawler":
working_dir => "$ODDB_HOME",
user => "$oddb_user",
exec => 'bundle exec ruby',
arguments => 'bin/oddbd crawler',
require => [Service['yus'], User['apache'], ],
subscribe => Service['yus'], # , 'oddb'
}

$export_name = "ch.oddb-export"
$export_run = "/var/lib/service/$export_name/run"
exec{ "$export_run":
command => "$create_service_script $oddb_user $export_name '$ODDB_HOME/ext/export/bin/exportd'",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
User["$oddb_user"],
Package['daemontools'],
],
creates => "$export_run",
user => 'root', # need to be root to (re-)start yus
}

service{"$export_name":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => Exec["$export_run"],
require => [Service['yus'], User['apache'], Exec["$export_run"], ],
oddb_org::add_service{"ch.oddb-export":
working_dir => "$ODDB_HOME",
user => "$oddb_user",
exec => 'bundle exec ruby',
arguments => 'ext/export/bin/exportd',
require => [Service['yus'], User['apache'], ],
subscribe => Service['yus'], # , 'oddb'
}

$fiparse_name = "ch.oddb-fiparse"
$fiparse_run = "/var/lib/service/$fiparse_name/run"
package{'app-text/wv2': }

exec{ "$fiparse_run":
command => "$create_service_script $oddb_user $fiparse_name '$ODDB_HOME/ext/fiparse/bin/fiparsed'",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
Exec["install_rwv2"],
User["$oddb_user"],
Package['daemontools', 'app-text/wv2', 'rwv2', 'ydocx', 'rpdf2txt'],
],
creates => "$fiparse_run",
user => 'root', # need to be root to (re-)start yus
}

file {"$ODDB_HOME/ext/fiparse/bin/fiparsed":
ensure => present,
mode => 0755,
owner => "$oddb_user",
group => "$oddb_group",
}

service{"$fiparse_name":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => Exec["$fiparse_run", "install_rwv2"],
require => [Service['yus'], User['apache'], Exec["$fiparse_run"], ],
oddb_org::add_service{"ch.oddb-fiparse":
working_dir => "$ODDB_HOME",
user => "$oddb_user",
exec => 'bundle exec ruby',
arguments => 'ext/fiparse/bin/fiparsed',
require => [Service['yus'], User['apache'], Package['daemontools', 'ydocx', 'rpdf2txt'], ],
subscribe => Service['yus'], # , 'oddb'
}

$google_crawler_name = "oddb_google_crawler"
$google_crawler_run = "/var/lib/service/$google_crawler_name/run"
exec{ "$google_crawler_run":
command => "$create_service_script $oddb_user $google_crawler_name '$ODDB_HOME/bin/oddbd google_crawler'",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
User["$oddb_user"],
Package['daemontools'],
],
creates => "$google_crawler_run",
user => 'root', # need to be root to (re-)start yus
oddb_org::add_service{"oddb_google_crawler":
working_dir => "$ODDB_HOME",
user => "$oddb_user",
exec => 'bundle exec ruby',
arguments => 'bin/oddbd google_crawler',
require => [Service['yus'], User['apache'], ],
subscribe => Service['yus'], # , 'oddb'
}

service{"$google_crawler_name":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => Exec["$google_crawler_run"],
require => [Service['yus'], User['apache'], Exec["$google_crawler_run"], ],
}

$meddata_name = "ch.oddb-meddata"
$meddata_run = "/var/lib/service/$meddata_name/run"
exec{ "$meddata_run":
command => "$create_service_script $oddb_user $meddata_name '$ODDB_HOME/ext/meddata/bin/meddatad'",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
User["$oddb_user"],
Package['daemontools'],
],
creates => "$meddata_run",
user => 'root', # need to be root to (re-)start yus
}

service{"$meddata_name":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => Exec["$meddata_run"],
require => [Service['yus'], User['apache'], Exec["$meddata_run"], ],
oddb_org::add_service{"ch.oddb-meddata":
working_dir => "$ODDB_HOME",
user => "$oddb_user",
exec => 'bundle exec ruby',
arguments => 'ext/meddata/bin/meddatad',
require => [Service['yus'], User['apache'], ],
subscribe => Service['yus'], # , 'oddb'
}

$swissindex_nonpharma_name = "ch.oddb-swissindex_nonpharma"
$swissindex_nonpharma_run = "/var/lib/service/$swissindex_nonpharma_name/run"
exec{ "$swissindex_nonpharma_run":
command => "$create_service_script $oddb_user $swissindex_nonpharma_name '$ODDB_HOME/ext/swissindex/bin/swissindex_nonpharmad'",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
User["$oddb_user"],
Package['daemontools'],
],
creates => "$swissindex_nonpharma_run",
user => 'root', # need to be root to (re-)start yus
oddb_org::add_service{"ch.oddb-swissindex_nonpharma":
working_dir => "$ODDB_HOME",
user => "$oddb_user",
exec => 'bundle exec ruby',
arguments => 'ext/swissindex/bin/swissindex_nonpharmad',
require => [Service['yus'], User['apache'], ],
subscribe => Service['yus'], # , 'oddb'
}

service{"$swissindex_nonpharma_name":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => Exec["$swissindex_nonpharma_run"],
require => [Service['yus'], User['apache'], Exec["$swissindex_nonpharma_run"], ],
}

$swissindex_pharma_name = "ch.oddb-swissindex_pharma"
$swissindex_pharma_run = "/var/lib/service/$swissindex_pharma_name/run"
exec{ "$swissindex_pharma_run":
command => "$create_service_script $oddb_user $swissindex_pharma_name '$ODDB_HOME/ext/swissindex/bin/swissindex_pharmad'",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
User["$oddb_user"],
Package['daemontools'],
],
creates => "$swissindex_pharma_run",
user => 'root', # need to be root to (re-)start yus
}

service{"$swissindex_pharma_name":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => Exec["$swissindex_pharma_run"],
require => [Service['yus'], User['apache'], Exec["$swissindex_pharma_run"], ],
}

$swissreg_name = "ch.oddb-swissreg"
$swissreg_run = "/var/lib/service/$swissreg_name/run"
exec{ "$swissreg_run":
command => "$create_service_script $oddb_user $swissreg_name '$ODDB_HOME/ext/swissreg/bin/swissregd'",
path => '/usr/local/bin:/usr/bin:/bin',
require => [
File["$create_service_script"],
User["$oddb_user"],
Package['daemontools'],
],
creates => "$swissreg_run",
user => 'root', # need to be root to (re-)start yus

oddb_org::add_service{"ch.oddb-swissindex_pharma":
working_dir => "$ODDB_HOME",
user => "$oddb_user",
exec => 'bundle exec ruby',
arguments => 'ext/swissindex/bin/swissindex_pharmad',
require => [Service['yus'], User['apache'], ],
subscribe => Service['yus'], # , 'oddb'
}

service{"$swissreg_name":
ensure => running,
provider => "daemontools",
path => "$service_path",
hasrestart => true,
subscribe => Exec["$swissreg_run"],
require => [Service['yus'], User['apache'], Exec["$swissreg_run"], ],
oddb_org::add_service{"ch.oddb-swissreg":
working_dir => "$ODDB_HOME",
user => "$oddb_user",
exec => 'bundle exec ruby',
arguments => 'ext/swissreg/bin/swissregd',
require => [Service['yus'], User['apache'], ],
subscribe => Service['yus'], # , 'oddb'
}

}

0 comments on commit 14bd73f

Please sign in to comment.