Created
July 8, 2011 14:14
-
-
Save mocoso/1071929 to your computer and use it in GitHub Desktop.
Audit recipe to keep an eye on EngineYard's cloud updates
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you use EngineYard cloud you will be aware that they change their 'main' | |
# recipes on a regular basis and that EngineYard provide no information about | |
# what they have changed. | |
# | |
# This can make it difficult to keep your application's environment stable. | |
# | |
# Add a personalised version of this recipe to your custom recipes and your | |
# custom recipes will fail if EngineYard have changed the versions of (or removed) | |
# any of software you've told your audit recipe to check. | |
# | |
# | |
# Installation instructions | |
# | |
# 1. Create a 'cookbooks/ey_audit' directory in your custom recipes and add this | |
# file to it. | |
# | |
# 2. Update this file to reflect the versions and packages that you expect | |
# EngineYard to have installed on your instances. | |
# | |
# 3. Add the line | |
# | |
# require_recipe "ey_audit" | |
# | |
# to the top of cookbooks/main/recipes/default.rb | |
# | |
# 4. Upload and apply your new custom recipes | |
# | |
# 5. Sleep easier | |
RUBY_VERSION = 'Ruby Enterprise Edition 2011.03' | |
RUBY_GEMS_VERSION = '1.5.2' | |
BUNDLER_VERSION = '1.0.10' | |
NGINX_VERSION = '0.8.54' | |
UNICORN_VERSION = '1.1.5' | |
GIT_VERSION = '1.7.3.5' | |
MEMCACHED_VERSION = '1.4.5' | |
MYSQL_VERSION = 'Ver 14.12 Distrib 5.0.51' | |
LIBXML_VERSION = '2.7.3' | |
ey_cloud_report "ey_audit" do | |
message "checking versions of software installed by EngineYard" | |
end | |
if ['solo', 'app', 'app_master', 'util'].include?(node[:instance_role]) | |
execute 'check-ruby-version' do | |
command "ruby -v | grep '#{RUBY_VERSION}'" | |
returns 0 | |
end | |
execute 'check-ruby-gems-version' do | |
command "gem -v | grep '#{RUBY_GEMS_VERSION}'" | |
returns 0 | |
end | |
execute 'check-bundler-version' do | |
command "bundle -v | grep 'Bundler version #{BUNDLER_VERSION}'" | |
returns 0 | |
end | |
execute 'check-git-version' do | |
command "git --version | grep 'git version #{GIT_VERSION}'" | |
returns 0 | |
end | |
execute 'check-memcached-version' do | |
command "memcached -h | grep 'memcached #{MEMCACHED_VERSION}'" | |
returns 0 | |
end | |
execute 'check-libxml-version' do | |
# We care about this because our nokogiri gem will need to be reinstalled | |
# if the version changes | |
command "xml2-config --version | grep '#{LIBXML_VERSION}'" | |
returns 0 | |
end | |
end | |
if ['solo', 'app', 'app_master'].include?(node[:instance_role]) | |
execute 'check-nginx-version' do | |
command "sudo nginx -v 2>&1 | grep 'nginx version: nginx/#{NGINX_VERSION}'" | |
returns 0 | |
end | |
execute 'check-unicorn-version' do | |
command "unicorn -v | grep 'unicorn v#{UNICORN_VERSION}'" | |
returns 0 | |
end | |
end | |
if node[:instance_role] == 'db_master' | |
execute 'check-mysql-version' do | |
command "mysql --version | grep '#{MYSQL_VERSION}'" | |
returns 0 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment