namespace :memcached do
namespace :centos do
desc <<-DESC
Install memcached.
- memcached_build_options
- Memcached build options.
-
set :memcached_build_options, {
:url => "http://www.danga.com/memcached/dist/memcached-1.2.4.tar.gz",
:configure_options => "--prefix=/usr/local"
}
- memcached_memory
- Memcached memory (in MB).
- @set :memcached_memory, 64@
- memcached_pid_path*
- Path to memcached pid file.
- Defaults to @/var/run/memcached.pid@
- @set :memcached_pid_path, "/var/run/memcached.pid"@
- memcached_port
- Memcached port
-
- Defaults to 11211.
- @set :memcached_port, 11211@
"Source":#{link_to_source(__FILE__)}
DESC
task :install do
# Settings
fetch_or_default(:memcached_pid_path, "/var/run/memcached.pid")
fetch_or_default(:memcached_port, 11211)
fetch(:memcached_memory)
fetch(:memcached_build_options)
# Build
build.make_install("memcached", memcached_build_options)
initscript
end
desc <<-DESC
Install memcached initscript.
- memcached_memory
- Memcached memory (in MB).
- @set :memcached_memory, 64@
- memcached_pid_path*
- Path to memcached pid file.
- Defaults to @/var/run/memcached.pid@
- @set :memcached_pid_path, "/var/run/memcached.pid"@
- memcached_port
- Memcached port
-
- Defaults to 11211.
- @set :memcached_port, 11211@
"Source":#{link_to_source(__FILE__)}
DESC
task :initscript do
fetch_or_default(:memcached_pid_path, "/var/run/memcached.pid")
fetch_or_default(:memcached_port, 11211)
fetch(:memcached_memory)
utils.install_template("memcached/memcached.initd.centos.erb", "/etc/init.d/memcached")
run_via "/sbin/chkconfig --level 345 memcached on"
end
end
end