Skip to content
This repository
Browse code

adds redis-yml to ey-cloud-recipes

  • Loading branch information...
commit 9e53839e289d526df4a8ca3f1b7d5880121b84de 1 parent cb3a6ff
Edward Chiu edwardchiu38 authored
3  cookbooks/main/recipes/default.rb
@@ -40,6 +40,9 @@
40 40 #uncomment to run the resque recipe
41 41 # require_recipe "resque"
42 42
  43 +#uncomment to run redis.yml recipe
  44 +# require_recipe "redis-yml"
  45 +
43 46 #uncomment to run the resque-scheduler recipe
44 47 # require_recipe "resque-scheduler"
45 48
12 cookbooks/redis-yml/README.md
Source Rendered
... ... @@ -0,0 +1,12 @@
  1 +Chef recipe to write redis.yml on Engine Yard Cloud
  2 +=========
  3 +
  4 +[Redis][1] Redis is an open source, advanced key-value store. It is often referred to as a data structure server since keys can contain [strings][7], [hashes][6], [lists][5], [sets][4] and [sorted sets][3]. Learn More at the [introduction][7].
  5 +
  6 +Overview
  7 +--------
  8 +
  9 +Redis.yml will help you connect to Redis on the utility instance from your Rails application
  10 +
  11 +Currently in the default.rb file under Recipes you utility instance is specified based on the first one it finds, if you have multiple utility instances you can specify it by removing "node['utility_instances'].first" and replace it with the commented out code. You can change the name of the instance based on whatever name you have chosen for your instance.
  12 +
24 cookbooks/redis-yml/recipes/default.rb
... ... @@ -0,0 +1,24 @@
  1 +if ['app_master', 'app'].include?(node[:instance_role])
  2 +
  3 + # If you have only one utility instance uncomment the line below
  4 + #redis_instance = node['utility_instances'].first
  5 + # Otherwise, if you have multiple utility instances you can specify it by uncommenting the line below
  6 + # You can change the name of the instance based on whatever name you have chosen for your instance.
  7 + #redis_instance = node['utility_instances'].find { |instance| instance['name'] == 'redis' }
  8 +
  9 + if redis_instance
  10 + node[:applications].each do |app, data|
  11 + template "/data/#{app}/shared/config/redis.yml"do
  12 + source 'redis.yml.erb'
  13 + owner node[:owner_name]
  14 + group node[:owner_name]
  15 + mode 0655
  16 + backup 0
  17 + variables({
  18 + :environment => node[:environment][:framework_env],
  19 + :hostname => redis_instance[:hostname]
  20 + })
  21 + end
  22 + end
  23 + end
  24 +end
3  cookbooks/redis-yml/templates/default/redis.yml.erb
... ... @@ -0,0 +1,3 @@
  1 +<%= @environment %>:
  2 + host: <%= @hostname %>
  3 + port: 6379

0 comments on commit 9e53839

Please sign in to comment.
Something went wrong with that request. Please try again.