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

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubygems/rubygems-chef
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3981789ff8b1
Choose a base ref
...
head repository: rubygems/rubygems-chef
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: e4f51d0249cf
Choose a head ref
  • 2 commits
  • 5 files changed
  • 1 contributor

Commits on Nov 18, 2014

  1. Copy the full SHA
    4fe2f8a View commit details
  2. Copy the full SHA
    e4f51d0 View commit details
Showing with 60 additions and 5 deletions.
  1. +2 −1 Berksfile.lock
  2. +1 −0 Rakefile
  3. +2 −1 cookbooks/rubygems-redis/metadata.rb
  4. +5 −3 cookbooks/rubygems-redis/recipes/default.rb
  5. +50 −0 cookbooks/rubygems-redis/recipes/volume.rb
3 changes: 2 additions & 1 deletion Berksfile.lock
Original file line number Diff line number Diff line change
@@ -291,7 +291,8 @@ GRAPH
rubygems-people (0.0.29)
sudo (>= 0.0.0)
user (>= 0.0.0)
rubygems-redis (0.0.6)
rubygems-redis (0.1.6)
aws (>= 0.0.0)
redisio (>= 0.0.0)
rubygems (>= 0.0.0)
rubygems-backups (>= 0.0.0)
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ end
desc 'Refresh all chef vaults'
task :refresh_vaults do
[
'aws/credentials',
'certs/production',
'certs/staging',
'dnsimple/credentials',
3 changes: 2 additions & 1 deletion cookbooks/rubygems-redis/metadata.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name 'rubygems-redis'
maintainer 'RubyGems.org ops team'

version '0.0.6'
version '0.1.6'

depends 'aws'
depends 'redisio'
depends 'rubygems'
depends 'rubygems-backups'
8 changes: 5 additions & 3 deletions cookbooks/rubygems-redis/recipes/default.rb
Original file line number Diff line number Diff line change
@@ -5,13 +5,15 @@

include_recipe 'rubygems'

include_recipe 'rubygems-redis::volume'

node.default['sysctl']['params']['vm']['overcommit_memory'] = 1
include_recipe 'sysctl::apply'

node.default['redisio']['default_settings']['loglevel'] = 'notice'
node.default['redisio']['default_settings']['maxmemory'] = \
"#{(node['memory']['total'][0..-3].to_i / 1024) / 1.2}mb"
node.default['redisio']['default_settings']['maxmemorypolicy'] = 'volatile-lru'
# node.default['redisio']['default_settings']['maxmemory'] = \
# "#{(node['memory']['total'][0..-3].to_i / 1024) / 1.2}mb"
# node.default['redisio']['default_settings']['maxmemorypolicy'] = 'volatile-lru'

include_recipe 'redisio::install'
include_recipe 'redisio::enable'
50 changes: 50 additions & 0 deletions cookbooks/rubygems-redis/recipes/volume.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
# Cookbook Name:: rubygems-redis
# Recipe:: volume
#

if node['cloud'] && node['cloud']['provider'] == 'ec2'

device_id = '/dev/xvdf'
mount_point = '/var/lib/redis'

package 'xfsprogs'

creds = chef_vault_item('aws', 'credentials')
include_recipe 'aws'

aws_ebs_volume 'redis_data_volume' do
aws_access_key creds['access_key_id']
aws_secret_access_key creds['secret_access_key']
size 100
volume_type 'io1'
piops 3000
device device_id.gsub('xvd', 'sd')
action [:create, :attach]
end

ruby_block 'wait_for_redis_data_volume' do
block do
loop do
if File.blockdev?(device_id)
break
else
Chef::Log.info("device #{device_id} not ready - sleeping 10s")
sleep 10
end
end
end
end

# execute 'mkfs' do
# command "mkfs -t xfs #{device_id}"
# not_if "parted -l | grep -qs '#{device_id}'"
# end

# mount mount_point do
# device device_id
# fstype 'xfs'
# action [:enable, :mount]
# end

end