A bit of history, frustration-driven development, and why and how we started looking into Puppet at Opera Software. What we're doing, successes, pain points and what we're going to do with Puppet and Config Management next.
6. # LVS main config file
#
# Last modified:
# 2012-12-10 Commented out all wlb servers, as they haven't been in use …
# 2012-XX-XX Tons of shifting around servers, upgrading and problems (Everyone)
# 2011-04-01 Removed all old b#-servers (N.....)
# 2010-03-24 Bye bye bigma. (M..../Cosimo)
# 2010-03-03 Restore pre Feb 26th config that seems to ensure stability (Cosimo)
# When adding bigboy/bigcat, bad site lockups happen
# 2010-03-03 Reducing weight on b12 as it is less powerfull (M....)
# 2010-02-26 re-adding bigdog, and lowering bigunc, also vamping up b12 to 100%
# 2010-02-26 Bigdog is crashing, removing from lvs (M......)
# 2010-02-03 Enabled f8 and b7, first b7, then some hours later f8 … (N......)
# 2010-01-19 Bigant ready to rock and roll! (Cosimo)
# 2010-01-13 Removed bigpa, fatgirl from database pool (Cosimo)
# 2010-01-07 Added b8 to backend pool (Cosimo)
# 2010-01-05 Added bigant to the My Opera databases (Cosimo)
# 2009-11-22 Added bigdog to the My Opera databases (Cosimo)
# 2009-11-18 Added b7 and f8 as back-end servers (M.....)
# 2009-11-18 Removed p23-02 backend, moved to auth (Cosimo)
# 2009-11-12 Removing b7 and f8 from Mysql Load balancers (Cosimo)
# 2009-11-11 Added Lenny backend p23-02 (Cosimo)
# 2009-10-11 phased-in InnoDB-powered bigma in production (Cosimo)
# 2009-09-23 phased-in InnoDB-powered bigma in production (Cosimo)
# 2009-06-27 switched master from bigma to bigsis (w-mlb) o/ (N.....)
# 2009-06-23 shifting load away from bigbro. it's dying? (Cosimo)
# 2009-03-18 pushing bigbro as much as we can, to test it out (Cosimo)
global_defs {
lvs_id MY_LVS
…
}
11. The very beginning...
commit 9c54321f51bf969940b63b48d055743ac504035e
Author: Cosimo Streppone <cosimo@opera.com>
Date: Thu Jan 14 13:21:40 2010 +0000
Generic puppet recipes. To be continued.
13. A “conservative” approach, surely
• Keep it simple. No concat/append/modify
• As few dependencies as possible
• Stability and reliability is critical
• No pulls from github or external URLs
• We don't use puppet for deployment
• Even realize() gets me into panic mode
14. Three Years In
• Modules repository, with 60+ mods
• Some custom facter plugins
• Shared projects conventions & structure
• Shared deployment procedures and libs
• Good server baseline configuration
• Our team, ~200 nodes
• Opera Mini Ops team, thousands of nodes
24. Facter – custom plugins
facter/datacenter.rb
Facter.add("datacenter") do
setcode do
datacenter = "unknown"
# Get current ip address from Facter's own db
ipaddr = Facter.value(:ipaddress)
if ipaddr.match("^1.2.3.")
datacenter = "dc1"
elsif ipaddr.match(...)
…
end
end
end
25. Facter – custom plugins
case $datacenter {
"dc1" : { include opera::datacenters::dc1 }
"dc2" : { include opera::datacenters::dc2 }
"dc3" : { include opera::datacenters::dc3 }
…
default: { include opera::datacenters::base }
}
26. Basenode class
class basenode {
include opera
# Opera-specific data-center based settings
case $datacenter {
"dc1" : { include opera::datacenters::dc1 }
…
default: { include opera::datacenters::base }
}
include apt-opera
include base_packages
include locales
include logcheck
include munin
include nagios
include cron
include perl
include python
include puppet
include ntp
include timezone
…
}
27. Bootstrap script
autosign
+ some preinstalled packages
+ internal apt repository
+ a bit of shell scripting
28. Real world examples – 1 Project
class geodns::backend {
include opera::admins::devops
include security-upgrades
include powerdns
include geoip::city
include memcache
package { [ 'libjson-xs-perl', … ]:
ensure => 'present'
}
bash::prompt { '/root/.bashrc':
description => 'geodns', color => 'red',
}
munin::plugin::custom { 'geodns_': }
munin::plugin {
[ 'geodns_country', 'geodns_errors', … ]:
plugin_name => 'geodns_',
}
}
29. Real world examples – 2 Varnish
varnish::config { "project-varnish-config":
vcl_conf => "tvstore.vcl",
storage_type => "malloc",
storage_size => "512M",
listen_port => 8100,
sess_workspace => 131072,
ttl => 60,
thread_pools => 2,
thread_min => 400,
thread_max => 3000,
# Needed for GeoIP support in varnish:
# http://stackoverflow.com/questions/5906603/
cc_command => "exec cc -fpic -shared -Wl,-x
-L/usr/include/GeoIP.h -lGeoIP -o %o %s"
}
30. Real world examples – 3 Munin
include munin::server
file { '/etc/munin/munin-conf.d/project-settings.conf':
…
}