Permalink
Browse files

adds redis-yml to ey-cloud-recipes

  • Loading branch information...
1 parent cb3a6ff commit 9e53839e289d526df4a8ca3f1b7d5880121b84de @ededdeddie38 ededdeddie38 committed Aug 22, 2012
View
3 cookbooks/main/recipes/default.rb
@@ -40,6 +40,9 @@
#uncomment to run the resque recipe
# require_recipe "resque"
+#uncomment to run redis.yml recipe
+# require_recipe "redis-yml"
+
#uncomment to run the resque-scheduler recipe
# require_recipe "resque-scheduler"
View
12 cookbooks/redis-yml/README.md
@@ -0,0 +1,12 @@
+Chef recipe to write redis.yml on Engine Yard Cloud
+=========
+
+[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].
+
+Overview
+--------
+
+Redis.yml will help you connect to Redis on the utility instance from your Rails application
+
+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.
+
View
24 cookbooks/redis-yml/recipes/default.rb
@@ -0,0 +1,24 @@
+if ['app_master', 'app'].include?(node[:instance_role])
+
+ # If you have only one utility instance uncomment the line below
+ #redis_instance = node['utility_instances'].first
+ # Otherwise, if you have multiple utility instances you can specify it by uncommenting the line below
+ # You can change the name of the instance based on whatever name you have chosen for your instance.
+ #redis_instance = node['utility_instances'].find { |instance| instance['name'] == 'redis' }
+
+ if redis_instance
+ node[:applications].each do |app, data|
+ template "/data/#{app}/shared/config/redis.yml"do
+ source 'redis.yml.erb'
+ owner node[:owner_name]
+ group node[:owner_name]
+ mode 0655
+ backup 0
+ variables({
+ :environment => node[:environment][:framework_env],
+ :hostname => redis_instance[:hostname]
+ })
+ end
+ end
+ end
+end
View
3 cookbooks/redis-yml/templates/default/redis.yml.erb
@@ -0,0 +1,3 @@
+<%= @environment %>:
+ host: <%= @hostname %>
+ port: 6379

0 comments on commit 9e53839

Please sign in to comment.