Ramp Up Weekend 5

Winnipeg Agile Group

Job

Looking for a self-motivated remote freelance developer (bonus points for angularjs experience!)

Contact Nathan Bertram <nbertram@gmail.com>

Brian Bowman

Launch event, May 14 @ 5pm, WAG

http://www.bowmanforwinnipeg.ca/may_14_meet_brian_event

Brian's running for mayor and is a technology & open data focussed candidate

Chef by example

Managing lots of systems with less work

Sean Walberg, P.Eng.

DevOps

Tries

To

Prevent

This

Chef

Tries

To

Solve

This

By doing this

Other parts

Demo

Dynamic configuration based on other nodes

       # Recipe
       personalization_server = search(:node, "chef_environment:#{node.chef_environment} AND recipe:personalization").first
       template "#{node[:nginx][:dir]}/sites-available/example.com" do
         source "site.erb"
         variables({
           personalization: personalization_server
         })
       end

       # Template
       proxy_pass http://<%= @personalization %>:8080;
      

Automatically add nodes to the load balancer

      name 'load_balancer'
      description 'haproxy load balancer'
      run_list('recipe[haproxy::app_lb]')
      override_attributes(
        'haproxy' => {
          'app_server_role' => 'webserver'
        }
      )
      

Monitor all nodes with Nagios

(From the nagios cookbook)

      if node['nagios']['multi_environment_monitoring']
        nodes = search(:node, 'name:*')
      else
        nodes = search(:node, "name:* AND chef_environment:#{node.chef_environment}")
      end
      

Configure based on memory

      if node[:hazelcast][:memory].nil?
        system_memory_mb = node['memory']['total'].split('kB')[0].to_i / 1024
        node.default[:hazelcast][:memory] = "%dM" % [1024, system_memory_mb - 512].max
      end
      

Configure based on number of CPUs

      default[:nginx][:worker_processes] = node[:cpu].size * 2
      

Boostrap an existing node

      knife bootstrap myhost -r 'role[base]'
      

Clone VM, configure, and bootstrap

Uses https://github.com/ezrapagel/knife-vsphere

      SERVER=xxxprehazeldb01 IP=10.0.0.96 ENVIRONMENT=preview 
       RUNLIST="recipe[hazelcast::database],role[base]" new_node.sh
      

Search the database

      sean.walberg~$ knife search node -i 'recipe:hazelcast'
      10 items found

      xxxdevhazel03.dmz.example.com
      xxxqathazel02.example.com
      xxxstghazel03.example.com
      ...
      

Run a command on certain servers in parallel

      knife ssh 'recipes:hazelcast' chef-client
      

Resources

/