Top Banner
CIRCUIT – An Adobe Developer Event Presented by ICF Interactive AEM DevOps – AEM Infrastructure Automation with Chef Cookbooks Drew Glass Hero Digital AEM Practice Lead
50

CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Aug 19, 2015

Download

Technology

Circuit
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

CIRCUIT – An Adobe Developer Event Presented by ICF Interactive

AEM DevOps – AEM Infrastructure

Automation with Chef Cookbooks

Drew Glass Hero Digital

AEM Practice Lead

Page 2: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

•  Director, Engineering and AEM Practice Lead at Hero Digital http://herodigital.com/

•  San Francisco AEM Community Leader http://www.meetup.com/Adobe-Experience-Manager-Adobe-Marketing-Cloud/

•  MS in Computer Science from University of Illinois Urbana-Champaign

[email protected]

@drewglass

https://www.linkedin.com/in/drewglass1

Page 3: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Agenda

•  What is DevOps •  DevOps with Chef •  AEM Cookbook •  Deployment Scenarios with Chef

Page 4: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

What Is DevOps

•  Use code and automation to increase collaboration between development and operations

•  Consistent, testable, repeatable infrastructure

Page 5: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

The Value in DevOps

•  Reduce cost and risk •  Increase throughput and delivery speed

Page 6: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

DevOps with Chef

•  Tool to automate infrastructure provisioning through code

•  Thin Domain Specific Language built on top of Ruby

•  Provides abstraction for infrastructure •  https://www.chef.io/chef/

Page 7: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef Basics

•  Develop cookbooks on Chef workstation using ChefDK

•  Knife Cookbooks and Policies to Chef Server

•  Chef client provisions nodes using cookbooks and policies and records that information on Chef Server

Page 8: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef Basics Illustrated

Chef  Server  Nodes,  cookbooks,  

policies  

Worksta/on    ChefDK,  Knife,  cookbooks  

Node  Chef-­‐client  

Node  Chef-­‐client  

Node  Chef-­‐client  

Page 9: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef Workstation

Chef  Server  Nodes,  cookbooks,  

policies  

Worksta/on    ChefDK,  Knife,  cookbooks  

Node  Chef-­‐client  

Node  Chef-­‐client  

Node  Chef-­‐client  

Page 10: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef Workstation

•  Develop cookbooks and policies •  Store cookbooks in chef-repo which is synced

with version control •  ChefDK - development kit which includes Kitchen,

ChefSpec, Berkshelf https://downloads.chef.io/chef-dk/

•  Knife – used to upload items such as cookbooks to Chef server and interact with nodes

•  Kitchen - test cookbooks across different platforms

•  ChefSpec - simulate convergence of resources on a node

•  Berkshelf - manage cookbook dependencies

Page 11: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Cookbooks

•  Fundamental unit of configuration •  Contains attributes, recipes, templates,

files, providers, and resources •  Kinds of cookbooks: base and wrapper

Page 12: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

AEM Community Base Cookbook h6ps://github.com/tacitknowledge/aem-­‐cookbook    

Page 13: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

AEM Community Base Cookbook

Page 14: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

AEM Wrapper Cookbook

•  Depends on base cookbook •  Overrides base attributes and may include

new recipes, files, providers and templates

Example  metadata.rb  

Page 15: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Attributes in a Cookbook

•  Configuration data •  Defined in a cookbook and can override

attributes on a node •  When chef-client is run, attributes in

cookbook are compared against attributes on node

•  Attributes in default.rb are loaded first

Page 16: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Attributes in the AEM Cookbook default[:aem][:version] = nil default[:aem][:jvm_opts] = {} default[:aem][:jar_opts] = [] default[:aem][:enable_webdav] = false default[:aem][:jar_name] = nil default[:aem][:use_yum] = false default[:aem][:download_url] = nil default[:aem][:license_url] = nil default[:aem][:base_dir] = "/opt/aem" default[:aem][:cluster_name] = nil default[:aem][:author] = { :default_context => "/opt/aem/author", :port => "4502", :runnable_jar => "aem-author-p4502.jar", :base_dir => "/opt/aem/author/crx-quickstart", :jvm_opts => {}, :ldap => { :enabled => false, :options => {} },

:validation_urls => [ "http://localhost:4502/libs/cq/core/content/login.html", "http://localhost:4502/damadmin", "http://localhost:4502/miscadmin", "http://localhost:4502/system/console/bundles" ], :deploy_pkgs => [], #You changed these, right? :admin_user => "admin", :admin_password => "admin", :new_admin_password => nil, :replication_hosts => [], :find_replication_hosts_dynamically => false } default[:aem][:author][:startup][:max_attempts] = 20 default[:aem][:author][:startup][:wait_between_attempts] = 30

Page 17: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Attributes in the AEM Cookbook

Page 18: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Recipes in a Cookbook

•  Fundamental configuration element  •  Authored with Ruby and used to define

everything to configure part of system •  Executed in order specified in run list •  In AEM, we have recipes for author,

publish and dispatcher

Page 19: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Author Recipe in the AEM Cookbook

Page 20: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Author Recipe in an AEM Cookbook

Page 21: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Files and Templates in Cookbooks

•  Templates - file written in markup language to solve a more complex configuration scenario

•  Files - can be transferred from cookbooks to nodes

Page 22: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Dispatcher Attributes

Page 23: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Dispatcher Template in the AEM Cookbook

Page 24: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Dispatcher Template in the AEM Cookbook

Page 25: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Resources and Providers

•  Resources - package, service, etc. that tells chef-client which provider to use during a during a chef client run for various tasks

•  Provider  - defines steps to bring part of system into desired state

Page 26: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Author Recipe Calls Init Provider

Page 27: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Init Script Provider in the AEM Cookbook

Page 28: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Author Recipe Calls Replication Agent Provider

Page 29: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Replication Agent Provider in the AEM Cookbook

Page 30: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef Server

Chef  Server  Nodes,  cookbooks,  

policies  

Worksta/on    ChefDK,  Knife,  cookbooks  

Node  Chef-­‐client  

Node  Chef-­‐client  

Node  Chef-­‐client  

Page 31: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef Server

•  Hub of configuration data •  Stores cookbooks, node information and

policies •  Chef-client running on nodes queries Chef

server for configuration information like recipes

•  Chef-client does the actual configuration on the node

•  Allows for distribution of work •  Also includes search

Page 32: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef-client

Chef  Server  Nodes,  cookbooks,  

policies  

Worksta/on    ChefDK,  Knife,  cookbooks  

Node  Chef-­‐client  

Node  Chef-­‐client  

Node  Chef-­‐client  

Page 33: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef-client

•  Agent that runs on a node managed by Chef •  Chef-client is run to bring a node into a

desired state •  Typical chef-client run:

–  register and authenticate node with Chef server (RSA public key-pairs)

– builds the node object –  synchronizes cookbooks –  compiles resource collection by loading required

cookbooks (recipes, attributes, and all other dependencies)

– provisions node

Page 34: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef-client Run for Author Node in Dev Environment

Page 35: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Node

•  Physical, virtual or cloud machine that is configured and maintained by chef-client

•  Physical nodes are typically a server or virtual machine that has to have a network interface for chef-client to communicate with Chef server

•  Cloud node could be Amazon EC2, Google Compute Engine, Backspace, etc.

•  Chef-client can be used to deploy, configure and maintain

Page 36: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Nodes in AEM

AEM  Author  

AEM  Publish  

Apache  with  

Dispatcher  

Page 37: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Node Objects

•  Attributes – configuration data for a node – Describe the current state of a node – Can be defined by: cookbooks, roles,

environments •  Run List - ordered list of roles and/or

recipes that defines all of the information Chef needs to configure a node to a certain state

Page 38: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Runlist in AEM

Page 39: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Policy

•  Map business and operational requirements to settings and objects on Chef server

•  Roles - define server types – A role has zero or more attributes and  a run

list •  Environments

– Define attributes for environments - Integration, QA, Staging, Production

Page 40: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Roles in AEM

Page 41: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Environments in AEM

Page 42: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Deployment Scenarios

•  AEM sandbox using Vagrant, Chef and Berkshelf

•  Local AEM development environment using a AEM site wrapper cookbook

•  AEM demo environment in the cloud using Chef and Kitchen

•  Continuous delivery pipeline with Chef and Chef provisioning

Page 43: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Worksta/on  

Local Dev VM or Cloud Instance

VM  or  Cloud  Instance  

Vagrant  or    

Kitchen    

Cookbooks  and  Berkshelf  

Chef-­‐solo  

AEM  Author  

AEM  Publish  

Dispatcher  

Page 44: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Vagrant and Chef Demo

Page 45: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

AEM Environment with Chef

Chef  Server  

with  Nodes,  Cookbooks,  and  Policies  

Node  

AEM  Author  

Chef-­‐  client  

Node  

AEM  Publish  

Chef-­‐client  

Node  

Dispat-­‐cher  

Chef-­‐client  

Page 46: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Chef Provisioning

•  Allows clusters to be managed with chef-client and Chef server using recipes

•  Collection of resources to enable creation of machines using chef-client

•  Bootstrap operations that are done against an infrastructure like VirtualBox, Amazon EC2, Docker, etc. using drivers

•  Machines – Chef provisioning runs multiple machine processes in-parallel in most situations

Page 47: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Scaling with Chef Provisioning

Chef  Server  

with  Nodes,  Cookbooks,  and  Policies  

Node  

AEM  Author  

Chef-­‐  client  

Dispatcher  Node  

Publish    Node  

Dispatcher  Node  

Publish    Node  

Page 48: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Scaling with Chef Provisioning

Chef  Server  

with  Nodes,  Cookbooks,  and  Policies  

Node  

AEM  Author  

Chef-­‐  client  

Dispatcher  Node  

Publish    Node  

Dispatcher  Node  

Publish    Node  

Dispatcher  Node  

Publish    Node  

Dispatcher  Node  

Publish    Node  

Page 49: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Wrapping Up

•  Infrastructure as code •  AEM DevOps with Chef •  Deploying AEM with Chef

Page 50: CIRCUIT 2015 - AEM Infrastructure Automation with Chef Cookbooks

Q & A

Send any questions to [email protected]