6. Chef Setup in OpsWorks
• Supported Chef versions: 0.9, 11.4 or 11.10
• Built-in convenience cookbooks / bring your own
• Chef run is triggered by life cycle event firing
• Event comes with stack state JSON
7. Why run Docker on OpsWorks?
• Full control of Docker version & install
• Full control of mapping container to instance
• Automation of AWS resources
• Resource discovery, e.g. other containers
11. Layers
Group of instances with common behavior & settings
– Chef recipes / run_list
– Settings / attributes
– Similar to a Chef role
12. Built-in Layers
Open Source at http://github.com/aws/opsworks-cookbooks
Rails MySQL
PHP HAProxy
Node.js Memcached
Java Ganglia
13. Custom Layers
Define your own layers and their Chef run_list
– Erlang app server
– Cassandra DB cluster
– C daemon
– Custom PHP install
– …
– Docker!
25. Setup Event
• Sent when instance boots
• Includes deploy event
• Use for initial installation
of software & services
• Install Docker
26. Configure Event
• Sent to all instances when
any instance enters or
leaves online state
• Use for making sure the
configuration is up-to-date
• Update etcd config
27. Deploy Event
• Sent when you deploy via UI/API
also part of each setup
• Use for custom deployment
• Deploy Dockerfiles / images
28. Undeploy Event
• Sent via UI/API when
apps are deleted
• Use to remove apps from
running instances
• Stop containers
29. Shutdown Event
• Sent when an instance
is shut down
• ~45s to execute
• Use for clean shutdown
30. Stack State JSON
Each event gets JSON / attributes that define the
current stack state:
node[:opsworks] search(:node, "role:db-master")
node[:opsworks][:layers] search(:node, "*")
node[:opsworks][:instance]
node[:opsworks][:stack]
34. Setup – Install Docker
recipe[docker::default]
• Installs Docker from source or package
• Handles dependencies like lxc, aufs or cgroups
• Docker service and /etc/init/docker.conf
35. Deploy – Manage Containers
docker_image 'shipyard/shipyard' do
action :pull
notifies :redeploy,'docker_container[shipyard]', :immediately
end
docker_container 'shipyard' do
action :run
end
36. Configure – Update etcd
if db_server = search(:node, "role:db-master").first
execute "Publish database IP" do
command "etcdctl set /db-ip #{db_server[:private_ip]}"
end
end
40. AWS OpsWorks
• Life cycle automation framework
• Highly customizable –
in the end everything is a Chef run
• Takes care of AWS integration
41. Docker on OpsWorks
• Automate install & configuration of Docker
• Fleet management
• Dynamic configuration
42. More information about AWS OpsWorks
• Follow us on twitter @AWSOpsWorks
• Find us on YouTube
• Docs: http://aws.amazon.com/documentation/opsworks
• Blog: http://blogs.aws.amazon.com/application-management