Sha256: 190ffe502388aedae5631db6d496c81b3ef1ddb745e58b23347e6d86e6b179a6

Contents?: true

Size: 1.21 KB

Versions: 19

Compression:

Stored size: 1.21 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

  def restart
    scripts.monit.restart_watch 'redis'
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
standup-0.6.9 scripts/redis.rb
standup-0.6.8 scripts/redis.rb
standup-0.6.7 scripts/redis.rb
standup-0.6.6 scripts/redis.rb
standup-0.6.5 scripts/redis.rb
standup-0.6.4 scripts/redis.rb
standup-0.6.3 scripts/redis.rb
standup-0.6.2 scripts/redis.rb
standup-0.6.1 scripts/redis.rb
standup-0.6.0 scripts/redis.rb
standup-0.5.14 scripts/redis.rb
standup-0.5.13 scripts/redis.rb
standup-0.5.11 scripts/redis.rb
standup-0.5.10 scripts/redis.rb
standup-0.5.9 scripts/redis.rb
standup-0.5.8 scripts/redis.rb
standup-0.5.7 scripts/redis.rb
standup-0.5.6 scripts/redis.rb
standup-0.5.5 scripts/redis.rb