DevOps Introduction



Ops' job is NOT to keep the site stable and fast 
       Ops' job is to enable the business
                 (this is dev's job too)
Who am i ?
Systems Administrator @ 
DevOps
Infrastructure as a code ”Puppet”
Cloud Computing
…
          @EslamElHusseiny
Dev or Ops ?



 6 days after a successful deployment, server 
experiences troubles ”high load, resources leak” 
Dev or Ops ?



There is an issue with build server.
       Code isn't building.
Dev or Ops ?



Software is deployed to the test environment.
       You can't login to application.
Dev vs. Ops
Dev says ...
Ops replies ...
”It's not my server, it's your code”
Role of Devs and Ops
Role of Devs and Ops
Dev
  Create changes
  Add  / modify features
Ops
  Maintain stability
  Create / enhance services
Role of Devs and Ops
Dev
  Create changes
  Add  / modify features
Ops
  Maintain stability
  Create / enhance services
So ?
The problem 
  Disconnect between groups
  Devs don't deploy consistent software
  Ops motivated to resist changes
  Devolpment process is Agile
  Operations process is Static
Our Goal



We are all here to ENABLE business
change
Is required for business
Doesn't mean outage
Should be exploited and not feared
Shouldn't mean fire fighting
Rescue
DevOps To The Rescue !
What is DevOps then ?
”DevOps is an approach to bridge the gap between 
 agile software development and operations” ­ 
 agileweboperations.com

Collaborative mindset of Devs and Ops
C.A.M.S
Culture
Culture
Relationships
  Engage early, engage often
  Be open
  Eradicate ”last­mile syndrome”
Culture
Communication
  Talk is cheap (get out of your chair)
  Involve each other in core proccesses and decisions
  Ask Questions 
  Don't say ”No”
Automation
Automation
What ca be automated ?
  Builds 
  Deployments
  Testing
  Monitoring
  Self­healing
  System configuration
Metrics
Metrics
Capture, learn, improve.
Assist in:
   Capacity planning 
   Trend analysis
   Fault finding
Metrics
Sharing
Sharing
Share ideas
Share metrics


Ops : Give devs shell access
Devs : see what technology ca be leveraged
DevOps life cycle
Before
Talk about functional requirements
Talk about non­functional requirements
  Security 
  Backups 
  Availability 
  Upgradeability 
  Configuration management 
  Monitoring / Metrics 
  Logging 
During
Communication
Source control
Automate builds
Automate tests
Automate deployments (Dev, Test, and Prod)
Collate App and System metrics
After
Release 
   Continue to run tests
   Monitor application and system
Issues (might happen)
   Post meetings
What are we doing ?
Puppet
Puppet
Configuration management tool
Open Source 
Infrastructure as a code
Puppet
Puppet
node default {
       include ssh
       include sudo
       include ntp
}

node product.dev inherits default {
       include nginx
       include tomcat5
}

node product.test inherits default{
       include nginx
       include tomcat6
}
class sudo {
   package {'sudo':
     ensure => latest,
   }

    file {'/etc/sudoers':
        owner => root,
        group => root,
        mode => '0440',
        source => 'puppet:///files/sudo/sudoers',
        require => Package['sudo'],
    }
}
Puppet
Let's get hands on




   It's deploymnt time
Monitoring
Monitoring
Problem ?
No one noticed
No one got alerted
No automatic recovery
Probelm ?
what is your application doing right now?
do you know when it fails?
failure means customers lose trust
failure means customers go elsewhere
failure means you lose money
application = providing value
Solution
Monitoring
Metrics
Logging
Monitoring means



 Is the application available?
Examples
Monitoring



  is this service currently providing value?
is this service consuming too many resources?
Examples
Monit
check process unicorn
  with pidfile /var/run/unicorn/unicorn.pid
  start program = "/etc/init.d/unicorn start"
  stop program = "/etc/init.d/unicorn stop"
  if mem is greater than 300.0 MB for 1 cycles then 
   restart
  if cpu is greater than 50% for 2 cycles then alert
  if cpu is greater than 80% for 3 cycles then restart
  group unicorn
Metrics
measurements
historical data
graphs
Metrics



     how many customers are on my site?
how many customers were on my site yesterday?
Metrics



     how slow is paypal's api?
how slow was paypal's api yesterday?
Metrics



   how much memory is available on my servers?
how much has memory usage grown over four weeks?
Metrics


number of open database connections
    number of redis commands
       number of 500 errors
       rate of HTTP requests
   number of HTTP connections
Metrics


         median response time
     number of failed resque jobs
      number of twitter followers
99th percentile github api response time
   95th percentile mysql query time
Examples
Munin
Graphite
Metrics as a service
Logging
Logstash



 log inputs
  process
  outputs
Graylog2
Graylog2
Summary


 own your monitoring
   own your metrics
   own your logging
none of them is optional
Dev ops
Dev ops

Dev ops