Skip to content

Commit

Permalink
Support memcached server in puppet-sedue. fixes #5023
Browse files Browse the repository at this point in the history
  • Loading branch information
Masahiro Nakagawa committed Sep 16, 2011
1 parent 8fc2b2a commit 88a7e15
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 0 deletions.
15 changes: 15 additions & 0 deletions manifests/memcached.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
define sedue::memcached($user, $instance, $port, $run, $options) {
sedue::memcached_script { "sedue::${instance}::memcached::script":
user => $user,
instance => $instance,
port => $port,
options => $options
}

sedue::server_process { "sedue::${instance}::memcached::process":
instance => $instance,
server_type => 'memcached',
run => $run,
require => Sedue::Memcached_script["sedue::${instance}::memcached::script"]
}
}
40 changes: 40 additions & 0 deletions manifests/memcached_script.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
define sedue::memcached_script($user, $instance, $port, $options) {
$port_option = "-p ${port}"

file { "${instance}_memcached_run_file":
path => "${sedue_home}/etc/serve/${instance}/memcached.run",
owner => $user,
group => $user,
mode => '0755',
content => template("sedue/memcached.run.erb"),
require => File["${instance}_serve_directory"]
}

file { "${instance}_memcached_run_directory":
path => "${sedue_home}/etc/serve/${instance}/memcached",
owner => $user,
group => $user,
mode => '0755',
ensure => 'directory',
require => File["${instance}_serve_directory"]
}

file { "${instance}_memcached_run_symlink":
path => "${sedue_home}/etc/serve/${instance}/memcached/run",
ensure => 'link',
target => "${sedue_home}/etc/serve/${instance}/memcached.run",
require => [File["${instance}_memcached_run_file"], File["${instance}_memcached_run_directory"]]
}

$server_type = 'memcached'
$server_script_name = 'memcached'
$server_sleep_interval = 3
$server_name = '' # TODO
file { "${instance}_memcached_init_script":
path => "${sedue_home}/etc/init.d/memcached-${instance}",
owner => $user,
group => $user,
mode => 0755,
content => template("sedue/server.init.d.erb") # same one as Sedue servers
}
}
4 changes: 4 additions & 0 deletions manifests/server_process.pp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
$server_bin_name = 'sedue_proxy'
$server_script_name = 'sedue_proxy'
}
'memcached': {
$server_bin_name = 'memcached'
$server_script_name = 'memcached'
}
}

if $run {
Expand Down
10 changes: 10 additions & 0 deletions templates/memcached.run.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
. <%= sedue_home -%>/sedue-env.sh

sleep 10
export SEDUE_HOME=<%= sedue_home %>
export INSTANCE=<%= instance %>

export BTLOG="$SEDUE_HOME/log/$INSTANCE/memcached.log"

exec $SEDUE_HOME/bin/memcached <%= port_option -%> -c 65536 -m 1024 >>$BTLOG 2>&1

0 comments on commit 88a7e15

Please sign in to comment.