The document discusses the use of configuration management at DramaFever, a streaming media company. It describes how they transitioned from hand-crafted server configurations to using Chef for configuration management. This provided benefits like a single source of truth for building AMIs, consistent configurations across instances, and easier reproduction of instances. It also summarizes some of their Chef workflow including using ChefDK, Test Kitchen, Jenkins, and GitHub for development and deployment.
10. Why did we need CM?
● Single source of truth to build AMIs and
provision AWS instances.
● Consistent configuration across ephemeral
instances.
● Hand-crafted, longer-lived instances are
hard to reproduce.
@bridgetkromhout @pietroshannon
29. #!/bin/bash
cat <<EOF > /etc/init/django.conf
description "Run Django containers for www"
start on started docker-reg
stop on runlevel [!2345] or stopped docker
respawn limit 5 30
[...]
replacing 100s of lines of userdata...
@bridgetkromhout @pietroshannon
30. #!/bin/bash
# upstart configs are now created by chef
rm /etc/chef/client.pem
mkdir -p /var/log/chef
chef-client -r 'role[rolename]' -E 'environment' -L
/var/log/chef/chef-client.log
...with a chef-client run.
@bridgetkromhout @pietroshannon
32. deregistering nodes (rc script)
template '/etc/init.d/unregister_chef_instance' do
source 'default/unregister_chef_instance.erb'
end
link '/etc/rc0.d/K99unregister_chef_instance' do
to '/etc/init.d/unregister_chef_instance'
end
@bridgetkromhout @pietroshannon
38. docker run
<% if @docker_rm == true -%>
--rm
<% end %>
<% @docker_env.each do |k, v| -%>
-e <%= k %>=<%= v %>
<% end %>
<% @docker_port.each do |p| -%>
-p <%= p %>
<% end %>
@bridgetkromhout @pietroshannon
upstart
template
43. recipe using LWRP
base_docker node['www']['django']['name'] do
command node['www']['django']['command']
env node['www'][service]['django'][env]['env']
image node['www']['django']['image']
port node['www'][service]['django'][env]['port']
tag node['www'][service]['django'][env]['tag']
type node['www']['django']['type']
end
@bridgetkromhout @pietroshannon
45. wrapper cookbook - leroy
● depends on community cookbooks (jenkins,
etc)
● recipes include: builds, packer, plugins
● fun with FC001
● variations on our base (fstab, docker registry)
@bridgetkromhout @pietroshannon
46. private docker registry
# this goes in /etc/default/docker to control
docker's upstart config
DOCKER_OPTS="--graph=/mnt/docker --insecure-
registry=localhost-alias.com:5000"
● localhost-alias.com in DNS with A record to 127.0.0.1
● OS X /etc/hosts: use the boot2docker host-only network IP
@bridgetkromhout @pietroshannon