Vous êtes sur la page 1sur 6

brought to you by...

#149
Get More Refcardz! Visit refcardz.com

Chef
CONTENTS INCLUDE:
n
Components of Chef
n 
OHAI
Run List
An Open Source Tool for Scalable
n

n
Cookbooks
n
Writing a Cookbook Cloud and Data Center Automation
n
Roles
By Jeffrey Hulten
Information about bootstrapping your own Chef server can be found at http://
INTRODUCTION wiki.opscode.com/display/chef/Bootstrap+Chef+RubyGems+Installation

If you need to setup your Chef server on a different platform, check out http://
Systems administrators have always tried to automate repetitive tasks. Some wiki.opscode.com/display/chef/Manual+Chef+Server+Configuration.
use BASH and Perl with SSH to loop through a list of servers one at a time.
This has some limitations and doesn’t scale particularly well, especially in a Hosted Chef
medium to large datacenter or cloud deployment. Hosted Chef is a service provided by Opscode, the makers of Chef, which
frees you from configuring your own Chef server. You can find out more at
So what is a forward-thinking system administrator to do? Let’s take a look at a
http://www.opscode.com/hosted-chef/.
tool called Chef.

What is Chef?
Chef (http://www.opscode.com/chef) is one of a new breed of open-source COMPONENTS OF CHEF
“infrastructure as code” tools to manage infrastructures of any size. It provides
administrators with the capability to define “cookbooks” that can be applied When using Chef as a client-server application, either with a local Chef server
repeatedly and consistently to server and application configurations. or the Hosted Chef, there are a few moving parts to keep track of.
Unlike some other “infrastructure as code” tools, Chef was designed from
the beginning with systems integration in mind. This allows Chef to gather Knife
the information a server needs to configure itself. For instance, if you were Knife is the tool you will use as a system administrator to interact with
to configure Apache httpd as a proxy for a farm of Tomcat instances, your the server most often, especially taking cookbooks and other custom
configuration could ask the Chef server for a list of all the installations of configurations and loading them into the server for distribution to clients.
Tomcat, their hostnames, and port number. You can also bootstrap new servers with the Chef client components, start
new instances on the major cloud providers (AWS, Rackspace, SliceHost, and
Common Terminology Terremark), and search for nodes or other data. Running knife --help will give
The following are some Chef terms that will be helpful to know before we you a list of supported commands.
start.
Chef Client
Node: A managed machine. When the Chef client runs, it executes the The Chef client runs on the servers you are managing. It gathers information
configuration for a node. about itself using Ohai, synchronizes the cookbooks it needs from the Chef
Client: An authorized user of the Chef API. In most cases, every machine you server, compiles the collection of resources that make up the configuration,
manage will be represented by: a) a client for logging into the API and b) a and then “converges” the resources it has compiled with the state of the
node configuration to apply. Administrators and the web interface are also current machine
clients.
Web-UI
Cookbook: A collection of attributes, recipes, custom resources, and Chef includes a web interface that lets you browse cookbooks and browse and
definitions to configure a certain application or service. For instance you will edit nodes, roles, and clients.
find shared cookbooks available on the web for NTP, Apache httpd, MySQL,
nginx, and other common services. Server/API
The Chef server sits at the center of the system. The Chef server exposes
Recipe: A list of resources that should be applied to a node. Recipes are a RESTful API, which is used by the other components in the system. Your
written in normal Ruby extended by the Chef resource domain-specific managed nodes, knife, and the web interface are all clients of the API. While
language. This gives you the power of anything you can do in Ruby
(conditionals, using gems, etc.) while not having to be verbose in managing
the resources that make up your configuration.

Three Ways to Slice It


There is more than one way to bring Chef to your environment. You can
use a local set of cookbooks with the Chef client (Chef Solo), a central set of
cookbooks on a local Chef server, or a central set of cookbooks on the Hosted
Chef

Chef Solo
If you are thinking this is too complicated, check out chef-solo (http://
wiki.opscode.com/display/chef/Chef+Solo). It allows you to pass a set of
cookbooks (either in a local directory or in a tarball on a server) and a JSON
file to configure your system. While this is the simplest thing that could
possibly work, you give up the ability to search for other nodes or look up
items in data bags to configure your nodes.

Local Chef Server


Setting up your own Chef server has been streamlined by a cookbook
provided by Opscode. The cookbook can set up the Chef server on Ubuntu
Chef

8.10+, Debian 6, and CentOS 5.

DZone, Inc. | www.dzone.com


2 Chef: An Open Source Tool for Scalable Cloud and Data Center Automation

you will probably not need to access the API directly, it is good to know that all dependencies, and other properties of the cookbook.
of your data and more advanced automation are available using the API.

name “myservice”
maintainer “My Name”
OHAI
maintainer_email “me@sample.com”
license “Apache v2.0”
Knowing the current state of your machine is a big part of any configuration description “Installs/Configures myservice”
management system. Ohai is a Ruby library that gathers information about long_description IO.read(File.join(File.dirname(__FILE__), ‘
your system and formats it as JSON for use by the Chef client and for storage README.rdoc’))
on the Chef server. To see for yourself, type ohai at the command prompt. This version “0.0.2”
information is exposed in your recipes through the node object. For instance if
depends “ntpd”
a particular piece of a recipe should only be called when the node is on a
depends “java”, “~> 1.1”
specific network you can use the ipaddress property as follows:

if node[:ipaddress] =~ /^10\.10\./ Much of the information in the metadata.rb file is for human consumption and
# do something is displayed in the Chef web interface. The main pieces that influence the chef-
end client behavior as of 0.10 are the version and depends statements.

The version field is important with the introduction of environments in 0.10.


This would check to see if the IP address of the node was a part of the It allows you to pin an environment to a specific version of a cookbook. This
10.10.0.0 network before attempting the steps inside the block. way your production environment can remain on a tested version of your
Ohai also allows you to write custom plug-ins for your specific environment or configuration while you are improving your development version.
equipment. See: http://wiki.opscode.com/display/chef/Writing+Ohai+Plugins Versions have to be managed by hand right now. When you use knife to
upload a cookbook to the Chef server it will replace any files or recipes it finds
that were uploaded with the same version number. You can prevent yourself
RUN LIST and others from overwriting a given version of a cookbook by passing knife the
--freeze flag.

Each node has a run list, which provides the recipes and roles for a node in The depends property specifies what other cookbooks are required on the
the order they should be applied. This is a key difference from some other client for this cookbook to work. The second depends clause in the example
configuration management tools, which attempt to have you define the includes a version number. This is optional but will allow you to keep major
relationship between every resource. While both approaches have their changes to your cookbooks from breaking others if you manage your version
strengths and weaknesses, the ordered run list is easiest for most people to numbers well.
understand.
NOTE: Cookbook versions are supported as of Chef 0.10
As of 0.10, the knife command produces cleaner output for human
consumption by default. You can use the knife command to get information README.rdoc
about a node, including its run list, as follows: If you look again at the long_description property of the metadata.
rb file you will see some Ruby code reading a file called README.rdoc.
$ knife node show s1.mydomain.com The README.rdoc file is the place for your documentation on how to use
Node Name: s1.mydomain.com your cookbook and is especially important if you are sharing your cookbooks
Environment: _default with others, either inside your company or on the Internet. While RDoc is the
FQDN: s1.mydomain.com default for the README, Markdown is supported and will probably become
IP: 1.2.3.4 the default in a future release.
Run List: role[common]
Roles: common
Borrowing and Sharing Cookbooks
One of the greatest assets of any open-source project is the way the
Recipes: chef-client, users::sysadmins, sudo
community shares knowledge. Chef helps you take advantage of other
Platform: ubuntu 10.10 people’s work and share your work with the community, using the http://
community.opscode.com/ site and a set of knife commands.
As you can see, the server in question had a run list that includes one role
(common) that expands to the recipes chef-client, users::sysadmins, and sudo. $ knife cookbook site --help
If we want to add a new role to the node, we can use knife again:
Available cookbook site subcommands: (for details, knife SUB-COMMAND

--help)
$ knife node run_list add s1.mydomain.com “role[profit]”
run_list:
** COOKBOOK SITE COMMANDS **
role[common]
knife cookbook site install COOKBOOK [VERSION] (options)
role[profit]
knife cookbook site share COOKBOOK CATEGORY (options)
knife cookbook site search QUERY (options)
The run list is immediately modified and will be applied to the node the next
knife cookbook site show COOKBOOK [VERSION] (options)
time chef-client runs.
knife cookbook site unshare COOKBOOK
knife cookbook site list (options)
knife cookbook site download COOKBOOK [VERSION] (options)
COOKBOOKS
As you can see, knife supports downloading cookbooks and sharing your
Anatomy of a Cookbook cookbooks with others. The knife commands use the Opscode community
When you run knife cookbook create [NAME], a new directory structure site at http://community.opscode.com/ to store, rate, and search shared
is created with some sane defaults for your new cookbook. Most of the cookbooks.
directories will be addressed in later sections, but there are two files created in
Much of the community uses Git as version control for their Chef repository,
the top-level directory for your cookbook that are important.
so knife provides the knife cookbook site install command that downloads
metadata.rb the cookbook and places it in a vendor branch within your Git repository and
The metadata.rb file is converted to JSON when the cookbook is uploaded then merges it into the master branch. This allows local modifications to persist
to the Chef server. It provides critical information about the name, version, even if you upgrade the underlying cookbook.

DZone, Inc. | www.dzone.com


3 Chef: An Open Source Tool for Scalable Cloud and Data Center Automation

For those who use Subversion or other version control system, you can use the package “cucumber” do
knife cookbook site download command to bring down a tarball that you can
version “0.9.4”
unpack where you wish.Likewise you may spend hours building a cookbook
provider Chef::Provider::Package::Rubygems
and want to share it with the community. Please do! You can either make a tgz
action :install
file of your cookbooks directory or use the knife cookbook site share command
to upload it to the community site. end

There are also shortcut resources that force a particular package provider to be
When you develop an interesting cookbook, consider sharing it with
Hot the community. Also consider placing the source on GitHub or a
used. For instance, the Ruby gem example above is the same as saying:
Tip similar public service so that others can contribute.
gem_package “cucumber” do
version “0.9.4”
File Specificity action :install
http://wiki.opscode.com/display/chef/File+Distribution end

Chef provides a way to place different versions of files and templates to


specific hosts or platforms. The default/ folder under files/ and templates/ As always, you have the full power of Ruby to handle edge cases, such as the
is created for you if you if you used `knife` to create your cookbook. You can package name to use when installing Apache httpd.
override a file in this default directory with a version that is host specific, OS
and version specific, or just OS specific. package “apache2” do
case node[‘platform’]
The utility versus the complexity of the file specificity system is in
when “centos”,”redhat”,”fedora”,”suse”
discussion in the community at the moment. There are clearer ways
to specify template and file resources (like in the resource itself), so package_name “httpd”
I caution users to not make heavy use of this functionality. It is more when “debian”,”ubuntu”
likely to confuse those that come after you. Just remember to place package_name “apache2”
your files and templates in the default/ directory. end
action :install
end

RESOURCES
In the example above, we use a Ruby case statement to look at the node
object, which represents the system we are currently configuring. The node
http://wiki.opscode.com/display/chef/Resources object includes all the data discovered by the Ohai application. Ohai sets the
platform element to the name of the distribution.
When you start composing your configuration, you will declare resources,
which are essentially Ruby objects with the code behind them to configure Files, Directories and Templates
your system. Behind each resource are one or more providers that tell Chef Configuration on Linux and *NIX systems often starts with managing files
how to execute the actions you require against a certain type of system. For and directories. Chef provides the file, remote_file, and cookbook_file
instance, the package resource has providers for yum, apt, gems, and more. resources to manage static files and a directory resource for managing
directories.
Log
The Log resource is the simplest resource there is. All it does is print a logging Directory
message at the level you provide (defaulting to INFO). The directory resource lets us create, remove, and manage the permissions on
directories. If you need a temporary directory, you can create one as follows:
log “This is a message from chef”

This will generate the following message amidst the rest of the output when directory “/tmp/mydirectory” do
chef-client runs. action :create
end
INFO: This is a message from chef

You can specify the level you want the message to be logged at with the level The owner and group of the directory will be the defaults for the user running
parameter. the Chef client, usually root. The create action is the default, so that could be
rewritten as:
log “Bad stuff happened” do
level :error directory “/tmp/mydirectory”
end

Packages Hot Using the defaults can make your cookbooks more concise, but make
Chef includes providers for most major package management systems. These
multiple providers allow the single package resource to be used on most
Tip sure they aren’t more confusing for your future self and your team.

major UNIX-based operating systems. Since the default action for a package is
“install”, the simplest use is as follows:
In defining your resources, you have the full power of Ruby available to you.
For instance, this allows you to loop through entries in an array to build a set of
package “autoconf”
directories.

This is equivalent to: [“site1”, “site2”, “site3”].each do |dir|


directory “/srv/vhosts/#{dir}” do
package “autoconf” do
mode 0775
action :install
owner “root”
end
group “root”
action :create
You can even specify the version you want and the provider that should be
recursive true
used (such as YUM, rubygems, etc.):
end
end

DZone, Inc. | www.dzone.com


4 Chef: An Open Source Tool for Scalable Cloud and Data Center Automation

In the example above, three directories will be created under /srv/vhosts. domain <%= node[‘domain’] %>
In this case we used the recursive true property of the directories to ensure that
search <%= node[‘domain’] %>
the base directories (/srv and /srv/vhosts) are created if they do not
<% @nameservers.each do |server_ip| -%>
exist.
nameserver <%= server_ip %>
File <% end -%>
The file resource allows you to manage the permissions and ownership of
files on the node, with the option to pass content from inside your recipe. You can see that the domain and search lines are adding the value returned
To retrieve a file from a URL or the cookbook, use the remote_file or by node[‘domain’] to the end of their lines. This shows the first way Chef
cookbook_file resources respectively. makes templating a little easier. The node object with its extensive hashmap of
attributes and Ohai values is injected into your template’s namespace.
The parameters for a file are the same as a directory with a couple of
exceptions. Files have a touch action that updates the modified time The second piece is a loop over each item in an array called @nameservers.
and last accessed time of the file, they don’t have a recursive attribute The template resource has a variables attribute that you can pass other data to
so the target directory must exist, and they have a backup attribute for use in your templates without inserting it into the node object itself.
that defines how many backup versions of the file should be kept if the
You may have noticed that the each do and end statements have an extra
contents change.
hyphen attached to the end tag. This prevents the newline character outside
NOTE: Backups are saved to the directory specified by file_backup_path in the tag from being printed, keeping you from having extra blank lines in your
your client.rb file. This defaults to /var/chef/backup. template.

Lets take a quick look at how to declare the template resource for the file
file “/etc/nologin” do
above. Remember that templates respect File Specificity, so we will need to
backups false put it in template/default/resolv.conf.erb.
owner “root”
group “root” template “/etc/resolv.conf” do
mode “0755” source “resolv.conf.erb”
action :create mode “0644”
end variables( :nameservers => [‘8.8.8.8’, ‘8.8.4.4’] )
end
The resource above creates a file called /etc/banner with the content set
to the string provided. It will not back up the file if it changes.
We set the source and mode, just like a cookbook_file resource. Then we
Remote File add a variables attribute that assigns an array to the symbol nameservers.
The remote_file resource is identical to the file resource, except instead of This array will be made available, as you saw in our template, as the variable @
having a content parameter, remote_file has a source parameter that is the nameservers.
URL of the file to transfer. It also has an optional checksum parameter that, if For more on ERB, see the documentation at http://www.ruby-doc.org/stdlib/
the managed file’s checksum matches, will prevent Chef from downloading the libdoc/erb/rdoc/.
file an extra time. Chef uses SHA-256 for its checksums, but only the first 5-10
characters of the hash are usually needed to ensure consistency. Services
Once the package is installed and you have put your configurations (either as
Also, the actions on a remote_file are limited to create and create_if_ files or templates) in place, it is time to manage the services you intend to
missing. To delete a file created by remote_file, change it to a standard file provide. Again, Chef providers are available for most of the major service
resource. management schemes.
Cookbook File
service “ntpd” do
A cookbook_file resource is largely the same as a remote_file resource,
with the exception that files will be retrieved from the files/ directory structure action [:start, :enable]
(respecting File Specificity) of the cookbook. An additional cookbook attribute end
is available to fetch files from cookbooks other than the one you are currently
running. This will start the service (if it is not running) and make sure it will restart when
the node is rebooted.

If it appears that Chef is attempting to start your service every time it runs,
Hot As a rule, do not store large binaries in Chef. It can handle it, but the
side effects (larger database size, slower repository checkouts) make check the resources wiki page for the `supports`, `pattern`, and `status_
Tip it less desirable than many alternatives such as a package repository, command` attributes.

Execute
Templates So far we can manage files, install packages, and restart services. But
http://wiki.opscode.com/display/chef/Templates sometimes you just need to run a real command. Perhaps it is an installer for
your monitoring system or to add records to an LDAP server.
Chef supports templating text based configuration files using ERB. In its
simplest form, Ruby code is wrapped in special brackets. execute “bundle install --deployment” do
cwd “/srv/app”
<% x = “This is Ruby code” %>
environment ({‘HOME’ => ‘/home/myhome’})
user “appuser”
Things that are not wrapped in the tags are not parsed as Ruby code. A similar
group “appgroup”
tag is used to put a value into the resulting file.
end

The value of x is: <%= x %>


In the example above, the Chef client will switch to the user and group
Notice the equals sign after the opening tag. ERB will parse the statement provided, add HOME to the environment variables, and change directories
included in that tag and replace the tag with the return value. to “/srv/app” before running the command provided as the name of the
resource.
By combining these elements with regular Ruby conditionals and flow control,
we can create templates for even complex configuration. Let us stick with the Script (bash, csh, perl, python, ruby)
simple case for now, a resolv.conf file used by *NIX systems to define their The script resource is an extension of the execute resource, supporting all of
DNS servers. parameters of the latter, while allowing you to pass a block of commands
inside the resource. This works well for running a custom compile of an

DZone, Inc. | www.dzone.com


5 Chef: An Open Source Tool for Scalable Cloud and Data Center Automation

application that you do not have a package for or for running a set of tasks In this case, we are trying to run the same script, but we aren’t going to do it if
every time the Chef client runs. the file /etc/passwd exists. Since we are using Ruby we can call the exists?
static method on the File class.
script “git update and garbage collection” do
Notifications
interpreter “bash” Sometimes you want an action to be applied to a resource if something
user “root” changes. For example, if your httpd.conf file changed you would want to
cwd “/srv/app” restart Apache. All resources support the notifies attribute that takes an action,
code <<-EOH a service, and optional timing.
git pull stage
template “/etc/httpd/conf/httpd.conf” do
git gc
source “httpd.conf.erb”
EOH
notifies :restart, “service[apache2]”, :delayed
end
end

You can see the added code block with the Ruby specific <<- annotation to
create a string out of everything it sees until the pattern provided (EOH in this In the example above we declare a template resource that, when it changes,
case) is reached. will tell the apache2 service to restart. The last parameter tells Chef to delay
the restart to the end of the client run, which keeps you from restarting a
service over and over if multiple configuration files change during one client
run.
WRITING A COOKBOOK
Putting it Together
So lets string together the things we have covered and create a simple
Attributes cookbook for managing the NTP daemon on our servers.
Other than Ohai, we really haven’t talked about variables and how you provide
different values to different machines depending on location, purpose or other First lets create a couple of attributes, specifically an array of servers to poll for
metadata. time changes and if we want to enable statistics on our ntpd server.
Attributes extend the node model just like Ohai does but are set or changed
attributes/default.db
inside of cookbooks and roles. Cookbook attributes will generally go in the
default[‘ntpd’][‘servers’] = [‘tick.ucla.edu’,
attributes/default.rb file.Once again, the attributes file is just Ruby with some
shortcuts built in. You can use Ohai information to make decisions about the ‘tick.uh.edu’]
values you want to assign to your attributes. default[‘ntpd’][‘stats_enabled’] = false

Default, Normal and Override By defining these as default attributes, they can be overridden later with
Chef allows us to set defaults and provide overrides for attributes at the servers that are closer, based on role or environment.
cookbook, environment, role, and node level. Of course if there is more than
one value for an attribute we need to know which one wins. That brings us to… Now lets create a recipe with three resources in it: a package, a template, and
a service.
Precedence
Attribute precedence can get tricky. Not only do override attributes take recipes/default.rb
precedence over normal attributes (which beat out default attributes), package “ntpd” do
but where an attribute is declared matters as well. As you explore more action :install
complicated infrastructure, you will need to become comfortable with attribute
end
precedence. Instead of trying to explain it here, check out http://wiki.opscode.
template “/etc/ntpd.conf” do
com/display/chef/Setting+Attributes+%28Examples%29 and try some
experimentation. source “ntpd.conf.erb”
owner “0755”
Conditional Execution notifies :restart, “service[ntpd]”
There will be many cases where you want a resource to execute its action only end
if certain conditions are met. While some resources cover the simple cases service “ntpd” do
of this (the execute resource has a property called creates that prevents the action [:start, :enable]
command from running if a given file already exists), you will come up with end
other cases in modeling your configuration that aren’t covered.

Chef provides two conditional execution attributes on every resource: not_if The package resource installs the NTP, while the template and service make
and only_if. Both will take either a string, which will be executed as a shell sure it is configured and running. When the template is updated it notifies the
command, or a Ruby block. A return code of 0 from the shell command is service to restart.
treated like a value of true from the Ruby block. For instance, you might only
want a particular script to run if the /etc/hosts file contains the right The only thing we need now is our NTP configuration template (snipped for
machine name. length).

templates/default/ntpd.conf.erb
execute “run the script” do
driftfile /var/lib/ntp/ntp.drift
command “runme --now”
<% if node[‘ntpd’][‘stats_enabled’] -%>
only_if “grep myserver /etc/hosts”
statsdir /var/log/ntpstats/
end
<% end -%>
statistics loopstats peerstats clockstats
An experienced BASH scripter knows that the grep command returns 0 if it
filegen loopstats file loopstats type day enable
finds what you were looking for. The resource above will execute the command
filegen peerstats file peerstats type day enable
runme --now only when the /etc/hosts file contains the string “myserver”.
filegen clockstats file clockstats type day enable
Passing a Ruby block is similar but gives you the full power of the Ruby
language as part of your conditional. <% node[‘ntpd’][‘servers’].each do |srv| -%>
server <%= srv %>
execute “run the script again” do <% end -%>
command “runme --now” --- SNIP ---
not_if { File.exists?(“/etc/passwd”) }
end

DZone, Inc. | www.dzone.com


6 Chef: An Open Source Tool for Scalable Cloud and Data Center Automation

ADVANCED CHEF
ROLES
So now you have an idea how to build your cookbooks. There are other pieces
to make your life easier and your automation cleaner. Since I cannot cover
http://wiki.opscode.com/display/chef/Roles them all, here is a quick list so you know what you can look for.
The run list of a node either contains recipes or roles. Roles have their own run Data Bags: http://wiki.opscode.com/display/chef/Data+Bags
list, allowing you to group common functions or service types together and not
repeating yourself with a long run list on each of your application servers. Search: http://wiki.opscode.com/display/chef/Search

Environments: http://wiki.opscode.com/display/chef/Environments
name “webservers”
description “HTTP server role” Definitions: http://wiki.opscode.com/display/chef/Definitions
run_list “recipe[apache2]”, “recipe[ntpd]”
Lightweight Resources and Providers: http://wiki.opscode.com/display/
default_attributes “ntpd” => { “stats_enabled” => true }
chef/Lightweight+Resources+and+Providers+%28LWRP%29
--- SNIP ---

This role applies the apache2 and ntpd recipes and changes the value of the
stats_enabled attribute to true. Roles can contain other roles as well as
recipes in their run list, which allows you to build a hierarchy of roles to model
your environment. Most environments start with a base or common role that
holds the pieces that apply to every node and then grow to include individual
application.

ABOUT THE AUTHOR RECOMMENDED BOOK


Jeffrey recently started his own consultancy Test-Driven Infrastructure with Chef demonstrates a
to help companies automate infrastructure, radical approach to developing web infrastructure
increase application performance, and bring an that combines the powerful Chef configuration
experimental mindset to adding value. Prior to management framework with Cucumber, the leading
hanging his own shingle, he spent over 15 years Behavior-driven development (BDD) tool. Learn
writing software and managing systems for various how to deliver real business value by developing
industries including telecommunications and infrastructure code test-first.
finance.
Infrastructure consultant Stephen Nelson-Smith shows
A long-time supporter of open-source solutions, he has presented his you how this unique approach allows you to make significant changes
ideas at user groups across the country and co-founded the Seattle without the fear of unexpected side effects—a great benefit when
DevOps interest group. He can be reached at jeffh@automatedlabs you’re developing code to control your production infrastructures.
com. By using the test-first approach introduced in this book, you gain
increased security, code quality, and peace of mind.

#82

Browse our collection of over 100 Free Cheat Sheets


Get More Refcardz! Visit refcardz.com

CONTENTS INCLUDE:


About Cloud Computing
Usage Scenarios Getting Started with

Aldon Cloud#64Computing

Underlying Concepts
Cost
by...

Upcoming Refcardz
youTechnologies ®

Data
t toTier
brough Comply.
Platform Management and more... borate.

Chan
ge. Colla By Daniel Rubio

on:
dz. com

grati s
also minimizes the need to make design changes to support
CON
ABOUT CLOUD COMPUTING one time events. TEN TS
INC

s Inte -Patternvall

HTML LUD E:
Basics
Automated growthHTM
ref car

& scalable
L vs XHT technologies

Java EE 6
Web applications have always been deployed on servers

nuou d AntiBy Paul M. Du



Valid
ation one time events, cloud ML
connected to what is now deemed the ‘cloud’. Having the capability to support
Usef

ContiPatterns an

computing platforms alsoulfacilitate


Open the gradual growth curves
Page Source

Vis it

However, the demands and technology used on such servers faced by web applications.Structure Tools

Core
Key ■

Structur Elem
E: has changed substantially in recent years, especially with al Elem ents
INC LUD gration the entrance of service providers like Amazon, Google and Large scale growth scenarios involvingents
specialized
NTS and mor equipment
rdz !

ous Inte Change

HTML
CO NTE es e... away by

MySQL 5.5
Continu at Every Microsoft. e chang (e.g. load balancers and clusters) are all but abstracted
About ns to isolat
relying on a cloud computing platform’s technology.
Software i-patter

n space
fca

e Work
Build
riptio
and Ant These companies Desc have a Privat
are in long deployed trol repos
itory
webmana applications
ge HTM
L BAS

Patterns Control lop softw n-con to


ing and making them ICSplatforms support data
re Re


that adapt and scale
Deve
les toto large user
a versio bases, In addition, several cloud computing
ment ize merg
rn
Version e... Patte it all fi minim le HTM
r

Manage s and mor e Work knowledgeable in amany ine to


mainl aspects related tos multip
cloud computing. tier technologies that Lexceed the precedent set by Relational
space Comm and XHT

ref ca

Build tice Privat lop on that utilize HTML


Database Systems (RDBMS): MLReduce,
is usedMap are web service APIs,

Prac Deve code lines a system


Build as thescalethe By An
sitory of work prog foundati
Ge t Mo

Repo
This Refcard active
will introduce are withinto you to cloud riente computing, with an
d units
RATION etc. Some platforms ram

HTML 5 Canvas
support large grapRDBMS deployments.

The src
dy Ha
softw
e ine loping and Java s written in hical on of
INTEG attribute
task-o it all
softwar emphasis onDeve es by
Mainl these ines providers, so youComm can better understand
also rece JavaScri user interfac web develop and the rris
Vis it

OUS codel chang desc


ding e code Task Level as the
w ww.dzone.com

NTINU of buil trol what it is a cloudnize


line Policy sourc es as aplatform
computing can offer your ut web output ive data pt. Server-s e in clien ment. the ima alt attribute ribes whe
T CO cess ion con Code Orga it chang e witho likew mec ide lang t-side ge is describe re the ima
ABOU the pro ject’s vers applications. and subm uniqu
e name
are from
sourc CLOUD COMPUTING ise hanism. fromAND
PLATFORMS web unavaila
was onc use HTML The eme pages and uages like ge file
is it with s alte
Nested
rd z!

(CI) a pro evel Comm the build build


softw um
UNDERLYING CONCEPTS ble. rnate can be
gration ed to blem Task-L Label
activit
ies to
the bare
minim e
standard a very loos
and XHT rging use HTM PHP Tags tags text that found,
ous Inte committ to a pro USAGE SCENARIOS ate all
Autom configurat
ion cies to t
ization, ely-defi
ML as
thei
Ajax
tech L can is disp
tinu cannot be (and freq
nden ymen layed
nge tion ned lang r visual eng nologies
Re fca

Con Build al depe need


a solu ineffective
cha deplo t
d tool but as if
every
Label manu

Android
the same for stan
(i.e., ) nmen overlap
, Build stalle
t, use target enviro Amazon EC2: Industry standard it has
software and uag
virtualization ine. HTM uen
with terns ns (i.e. problem ated ce pre-in whether dards e with b></ , so <a>< tly are) nest
has bec become
Autom Redu ymen a> is
ory. via pat ticular d deploEAR) in each very little L
reposit -patter s that Pay only what you consume
tagge or Amazon’s cloud
the curr you cho platform
computing is heavily mor
based on fine. b></ ed insid
the par solution duce
cies
lained ) and anti nden For each (e.g. WAR es t
ent stan ose to writ
ome
more e importa a></ e
not lega each othe
b> is
be exp text “fi x” ns are
al Depeapplication deployment
Web ge until
nden a few years
t librari agonmen
t enviro was similar that will software
industry standard and virtualization app
e HTM technology. nt,
d to to pro Minim packa
dard
Mo re

CI can ticular con all depe all targe


L or XHT arent. Reg the HTM r. Tags
es use Anti-patter they tend es, but can l, but
rity s will
a par etim s. ,
to
Binar most phone services:
y Integ Centr
alizeplans with le that
late fialloted resources, ts with an and XHT simplify all help ML, ardless L VS
XH <a><
ctic temp you TML b></
hes som proces in the end bad pra enting your
in nt nmen
incurred cost whether e a single based on MLaare prov to be underst of
Creatsuchareresources were consumed orthenot.
geme t enviro othe
Virtualization
muchallows physical piece ofr hardware HTML
approac ed with the cial, but, implem
cy Mana nt targe es to actually web cod ide a solid anding
essarily of the has
nden rties
d to Depe prope into differe chang
utilized by multiple operating simplerThis allows
function systems. ing.resourcesfoundati job adm been arou
efi not nec compare
itting
associat to be ben
er
Ge t

late Verifi te builds e comm commo than Fortuna


are n Cloud computing asRun remo
it’s known etoday beforhas changed this. ality on irab nd
They they for
etc. ly, that
elem CPU) tohas
(e.g. bandwidth,nmemory, be mov
allocated exclusively totely expecte
Temp
job has some time
Build
lts whe
ually,
appear effects. rm a
Privat y, contin nt team Every entsinstances. ed to CSS
used
to be, HTML d. Earl
ed resu gration
The various resourcesPerfo consumed by webperio applications
dicall (e.g.
opme pag
individual operating system because Brow
ser man y HTML expand . Whi
adverse unintend Inte Stage
bandwidth,
d Builds
memory, Repo
CPU)
sitory
are tallied
Build
ration on a per-unit r to devel
basis common e (HTML .
had ed le it has
e ous Integ CI serve or XHT web dev ufac very limit far done
produc Continu Refcard
e Build rm an ack from extensio .) All are elopers turers add
more
e.com

ML shar its
tern. term
Privat
(starting from zero) by Perfo all majorated cloud
feedb computing platforms. on As a user of Amazon’s
n. HTM EC2 essecloud
ntiallycomputing platform, you are
es cert result ed man ed layout
than
anybody
the pat gration of the e, this as autom as they
occur based proc is came
” cycl such Build Send builds
assigned esso
an operating L system
files shouin theplai
same wayain elem
as on allents
hosting The late a lack of stan up with clev y competi
supp
ous Inte tional use and test concepts
soon n text ort.
ration ors as ion with r
Integ entat
ld not in st web dar er wor ng stan
Continu conven “build include oper
docum
be cr standar kar dar
While
the s to the of CI to
efer Gene
rate devel
ion
Cloud Computing

the not
s on
expand

DZone, Inc.
140 Preston Executive Dr.
Suite 100
Cary, NC 27513
DZone communities deliver over 6 million pages each month to 888.678.0399
more than 3.3 million software developers, architects and decision 919.678.0300
makers. DZone offers something for everyone, including news,
Refcardz Feedback Welcome
$7.95

tutorials, cheat sheets, blogs, feature articles, source code and more.
refcardz@dzone.com
“DZone is a developer’s dream,” says PC Magazine.
Sponsorship Opportunities
Copyright © 2011 DZone, Inc. All rights reserved. No part of this publication may be reproduced, stored in a
retrieval system, or transmitted, in any form or by means electronic, mechanical, photocopying, or otherwise, sales@dzone.com Version 1.0
without prior written permission of the publisher.

Vous aimerez peut-être aussi