Sha256: af1a5c6efc2e48148ee9f99b3bec6491b0cb4de200e4873d8f7833e0cf078c8d

Contents?: true

Size: 1.15 KB

Versions: 4

Compression:

Stored size: 1.15 KB

Contents

Standup.script :node do
  REDIS_VERSION = "2.2.8"

  def run
    file_name = "redis-#{REDIS_VERSION}"

    #TODO check version, specify it in standup config file
    unless installed?
      in_temp_dir do
        exec "wget http://redis.googlecode.com/files/#{file_name}.tar.gz"
        exec "tar xvfz #{file_name}.tar.gz"
        exec "cd #{file_name} && sudo mkdir /opt/redis"
        exec "cd #{file_name} && sudo make PREFIX=/opt/redis install"
      end

      sudo "ln -s /opt/redis/bin/redis-server /usr/local/bin/redis-server"
      sudo "ln -s /opt/redis/bin/redis-cli /usr/local/bin/redis-cli"
    end

    with_processed_file script_file('redis.conf') do |file|
      upload file, :to => '/etc/redis.conf', :sudo => true
    end

    upload script_file('redis-server'), :to => '/etc/init.d/redis-server', :sudo => true

    sudo 'chmod +x /etc/init.d/redis-server'
    sudo '/usr/sbin/update-rc.d -f redis-server defaults'

    with_processed_file script_file('redis_monit.conf') do |file|
      scripts.monit.add_watch file
    end

    restart
  end

  def installed?
    sudo('find /usr/local/bin/redis-server').match(/No such file or directory/).blank?
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
standup-0.5.4 scripts/redis.rb
standup-0.5.3 scripts/redis.rb
standup-0.5.1 scripts/redis.rb
standup-0.5.0 scripts/redis.rb