SlideShare uma empresa Scribd logo
1 de 68
Ruby
The Language of Devops
Who am I?
● Rob Kinyon
o @rkinyon
o rob.kinyon@gmail.com
● Devops lead for many years
What is Devops?
● The Cloud?
● Jenkins Automation?
● Continuous integration & deployment?
● A new title?
o with no extra pay . . .
● Developers doing Operations??
o And fire all the sysadmins? (NO-OPS!)
● Automating away your coworkers??!
The
Programming
of
Operations
The Programming of Operations
● Operations is:
o Build servers
o Packaging
o Monitoring
o Provisioning
o Virtualization
o Environment/Stack Management
o Many many many more things
The Programming of Operations
The Programming of Operations
● Lots of helpers
o Build this
o Package that
o Move things from here to there
The Programming of Operations
● Lots of helpers
o Build this
o Package that
o Move things from here to there
● Templating
o Homegrown templates for Nagios
The Programming of Operations
● Lots of helpers
o Build this
o Package that
o Move things from here to there
● Templating
o Homegrown templates for Nagios
● Lots of manual activities
The Programming of Operations
Manual
===
Broken
TARGET=${1:-"monitor-prod"}
for rule in /nagios/rules/*.tmpl; do
process_template.pl $rule $TARGET
mv ${rule##tmpl#cfg} /nagios/final
done
scp /nagios/final/*.cfg $TARGET.company.com:/var/nagios/
ssh $TARGET.company.com -c "sudo service nagios3 restart”
The Programming of Operations
The Programming of Operations
● As a single script, it's okay.
o Concise, clear - what else do you need?
The Programming of Operations
● As a single script, it's okay.
o Concise, clear - what else do you need?
● Problems:
o No tests (untestable!)
o No reusability or extensibility
o Inscrutable code
The Programming of Operations
● As a single script, it's okay.
o Concise, clear - what else do you need?
● Problems:
o No tests (untestable!)
o No reusability or extensibility
o Inscrutable code
● Bugs:
o Assumes the contents of $PWD and $PATH
o Assumes a human will know if it worked
The Programming of Operations
● Operations staff are not developers
The Programming of Operations
● Operations staff are not developers
● Operational focus is about maintenance
o Keep it on
o Keep it up
o Keep it responding
The Programming of Operations
The Programming of Operations
● Operations staff are not developers
● Operational focus is about maintenance
o Keep it on
o Keep it up
o Keep it responding
● Operations has to manage changes by those
pesky developers
o Right now. While something is on fire. (Really!)
The Programming of Operations
What is the perfect language?
● Multi-system
● Quick to boot
● Easy to learn
● Easy to maintain
● Large community / Lots of modules
● Easy to find good staff
Languages we won't discuss
● C/C++
● .NET (C#, F#, etc)
● JVM languages
● Functional languages
o Especially Erlang
● Node.JS
Bash/Shell scripts (Good and Bad)
● Easy to write
● Everyone has written Bash scripts
● Horrible control structures
● Horrible variable structures
● Non-existent code structuring
● “Libraries” don’t exist
● Only really works on *nix
o Git-Bash doesn't count
Perl (the Good)
● What most sysadmins use other than Bash
● Great variable structures
● Great control structures
● Excellent reusability
o CPAN is the largest single-language repository
● Works everywhere (literally)
● Good programmers can manage 500kLOC
Perl (the Bad)
● Everyone thinks they know Perl
o Bad Perl is really really bad.
Perl (the Bad)
● Everyone thinks they know Perl
o Bad Perl is really really bad.
● Standard language facilities require
libraries
o Exceptions, objects, case statements
Perl (the Bad)
● Everyone thinks they know Perl
o Bad Perl is really really bad.
● Standard language facilities require
libraries
o Exceptions, objects, case statements
● CPAN is 80%+ useless
Perl (the Bad)
● Everyone thinks they know Perl
o Bad Perl is really really bad.
● Standard language facilities require
libraries
o Exceptions, objects, case statements
● CPAN is 80%+ useless
● Really old Perls are installed everywhere
o 5.005_003 (March, 1998)
Perl (the Ugly)
● Solving a problem with regular expressions
means you have two problems.
Perl (the Ugly)
● Solving a problem with regular expressions
means you have two problems.
● Sigils ($, @, %, etc) make code hard to read
o Ironically, the idea was to make code easier to
read
Perl (the Ugly)
● Solving a problem with regular expressions
means you have two problems.
● Sigils ($, @, %, etc) make code hard to read
o Ironically, the idea was to make code easier to
read
● Too many places where hidden globals
make you cry.
o E.g., namespaces aren't namespaced.
Python (Strengths)
● Great variable structures
Python (Strengths)
● Great variable structures
● Great control structures
Python (Strengths)
● Great variable structures
● Great control structures
● All the advanced features
o Exceptions
o Objects
o Case statements
Python (Strengths)
● Great variable structures
● Great control structures
● All the advanced features
o Exceptions
o Objects
o Case statements
● Runs everywhere that we care about
Python (Weaknesses)
● Significant whitespace is difficult for non-
developers.
Python (Weaknesses)
● Significant whitespace is difficult for non-
developers.
● System programming libraries aren't mature
Python (Weaknesses)
● Significant whitespace is difficult for non-
developers.
● System programming libraries aren't mature
● Writing libraries isn't self-evident
o Tutorials and scaffolding also immature
Ruby (Strengths)
● Great variable structures
Ruby (Strengths)
● Great variable structures
● Great control structures
Ruby (Strengths)
● Great variable structures
● Great control structures
● All the advanced features
o Exceptions
o Objects
o Case statements
Ruby (Strengths)
● Great variable structures
● Great control structures
● All the advanced features
o Exceptions
o Objects
o Case statements
● Runs everywhere that we care about
Ruby (Strengths)
● Great variable structures
● Great control structures
● All the advanced features
o Exceptions
o Objects
o Case statements
● Runs everywhere that we care about
● Already used as a sysadmin language
Ruby (Weaknesses)
● Minor versions changing syntax
o 1.8.7 vs. 1.9.3 vs 2.x
Ruby (Weaknesses)
● Minor versions changing syntax
o 1.8.7 vs. 1.9.3 vs 2.x
● Ruby is not Rails
o Really!
Ruby (Superpowers)
1. Install multiple versions of same library
2. Newbies are a way of life
3. Blocks
Multiple library versions
● Sysadmins are pessimistic
o Foo-bar 1.3.9 works, so don't change it!!
Multiple library versions
● Sysadmins are pessimistic
o Foo-bar 1.3.9 works, so don't change it!!
● Not everyone can use the same version
o Something needs a feature in Foo-bar 2.1.5
Multiple library versions
● Sysadmins are pessimistic
o Foo-bar 1.3.9 works, so don't change it!!
● Not everyone can use the same version
o Something needs a feature in Foo-bar 2.1.5
● So install both and specify at runtime
gem 'Foo-bar', '=1.3.9'
require 'foobar'
Newbie friendly
● Rails is how many new web-developers start
Newbie friendly
● Rails is how many new web-developers start
● Rails is Ruby (plus, but still)
Newbie friendly
● Rails is how many new web-developers start
● Rails is Ruby (plus, but still)
● Thousands of great tutorials, skeletons, and
communities.
o Google "ruby tutorial XYZ" for all values of XYZ)
Newbie friendly
● Rails is how many new web-developers start
● Rails is Ruby (plus, but still)
● Thousands of great tutorials, skeletons, and
communities.
o Google "ruby tutorial XYZ" for all values of XYZ
● Syntax is very easy to read and write
o Reading code is very hard
o Anything that makes it easier is a "Good Thing"(tm)
Blocks (Temporary File)
require 'tempfile'
Tempfile.open('some-prefix') do |tmp|
tmp.write "Some text"
# Do something with tmp here
end
Blocks (Reading from a file)
File.foreach('/some/file') do |line|
puts “Line read: #{line}”
do_something(line)
end
Blocks (Writing to a file)
File.open('/some/file') do |file|
file.puts 'first line'
file.puts 'second line'
end
Blocks (Writing to a file)
File.open '/some/file' { |file|
file.puts 'first line'
file.puts 'second line'
}
Blocks (Changing Directory)
Dir.chdir('/some/place') do |dir|
do_something_in_some_place(dir)
end
do_something_in_original_dir()
Blocks (Nested blocks)
Dir.chdir('/some/dir') do
%w{sub1 sub2}.each do |subdir|
Dir.chdir(subdir) do
# In /some/dir/sub[12]
end
end
end
Why blocks?
● Same construct for iteration and closures
o A logical new lexical scope
Why blocks?
● Same construct for iteration and closures
o A logical new lexical scope
● Automatic cleanup
o (Not necessarily guaranteed in all cases)
Why blocks?
● Same construct for iteration and closures
o A logical new lexical scope
● Automatic cleanup
o (Not necessarily guaranteed in all cases)
● Clean delination of concerns
o Relevant code is in one place
Why blocks? (as a sysadmin)
Because my job isn't where I can faff about
until everything is perfectly just-so and my
HammerFactoryFactoryFactory has 103% test
coverage in Jenkins.
I need to be done yesterday and I need to be
sure it works by looking at it.
Why blocks? (as a devops)
Because it's the easiest way to convert a
sysadmin into a developer.
Tooling
● Vagrant
● Chef / Puppet
● Logstash
● fpm
● Cucumber
● AWS / Rackspace clients
● Rake / Capistrano
Tooling (why do I care it's in Ruby?)
Three reasons:
1. Plugins
Tooling (why do I care it's in Ruby?)
Three reasons:
1. Plugins
2. Plugins
Tooling (why do I care it's in Ruby?)
Three reasons:
1. Plugins
2. Plugins
3. Plugins
Tooling (why do I care it's in Ruby?)
Three reasons:
1. Plugins
2. Plugins
3. Plugins
4. Some of them require Ruby (Vagrant)
Questions?

Mais conteúdo relacionado

Mais procurados

Making CLI app in ruby
Making CLI app in rubyMaking CLI app in ruby
Making CLI app in rubyHuy Do
 
Automating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and PerlAutomating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and Perlnohuhu
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptnohuhu
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLBarry Jones
 
Jslab rssh: JS as language platform
Jslab rssh:  JS as language platformJslab rssh:  JS as language platform
Jslab rssh: JS as language platformRuslan Shevchenko
 
Why don't you Groovy?
Why don't you Groovy?Why don't you Groovy?
Why don't you Groovy?Orest Ivasiv
 
PharoDAYS 2015: On Relational Databases by Guille Polito
PharoDAYS 2015: On Relational Databases by Guille PolitoPharoDAYS 2015: On Relational Databases by Guille Polito
PharoDAYS 2015: On Relational Databases by Guille PolitoPharo
 
A Static Type Analyzer of Untyped Ruby Code for Ruby 3
A Static Type Analyzer of Untyped Ruby Code for Ruby 3A Static Type Analyzer of Untyped Ruby Code for Ruby 3
A Static Type Analyzer of Untyped Ruby Code for Ruby 3mametter
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in ClojureTroy Miles
 
Go: What's Different ?
Go: What's Different ?Go: What's Different ?
Go: What's Different ?Tarun Vashisth
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript FundamentalsSunny Sharma
 
Ruby eventmachine pres at rubybdx
Ruby eventmachine pres at rubybdxRuby eventmachine pres at rubybdx
Ruby eventmachine pres at rubybdxMathieu Elie
 
PSR-7 - Middleware - Zend Expressive
PSR-7 - Middleware - Zend ExpressivePSR-7 - Middleware - Zend Expressive
PSR-7 - Middleware - Zend ExpressiveMilad Arabi
 
Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScriptOffirmo
 
Web development basics (Part-7)
Web development basics (Part-7)Web development basics (Part-7)
Web development basics (Part-7)Rajat Pratap Singh
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutinesRoman Elizarov
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code baseRobert Munteanu
 
Pengantar Ruby on Rails
Pengantar Ruby on RailsPengantar Ruby on Rails
Pengantar Ruby on RailsAshari Juang
 

Mais procurados (20)

Making CLI app in ruby
Making CLI app in rubyMaking CLI app in ruby
Making CLI app in ruby
 
Automating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and PerlAutomating JavaScript testing with Jasmine and Perl
Automating JavaScript testing with Jasmine and Perl
 
Developing Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScriptDeveloping Rich Internet Applications with Perl and JavaScript
Developing Rich Internet Applications with Perl and JavaScript
 
Exploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQLExploring Ruby on Rails and PostgreSQL
Exploring Ruby on Rails and PostgreSQL
 
Jslab rssh: JS as language platform
Jslab rssh:  JS as language platformJslab rssh:  JS as language platform
Jslab rssh: JS as language platform
 
Why don't you Groovy?
Why don't you Groovy?Why don't you Groovy?
Why don't you Groovy?
 
Ruby and Security
Ruby and SecurityRuby and Security
Ruby and Security
 
PharoDAYS 2015: On Relational Databases by Guille Polito
PharoDAYS 2015: On Relational Databases by Guille PolitoPharoDAYS 2015: On Relational Databases by Guille Polito
PharoDAYS 2015: On Relational Databases by Guille Polito
 
Ruby programming
Ruby programmingRuby programming
Ruby programming
 
A Static Type Analyzer of Untyped Ruby Code for Ruby 3
A Static Type Analyzer of Untyped Ruby Code for Ruby 3A Static Type Analyzer of Untyped Ruby Code for Ruby 3
A Static Type Analyzer of Untyped Ruby Code for Ruby 3
 
Functional Programming in Clojure
Functional Programming in ClojureFunctional Programming in Clojure
Functional Programming in Clojure
 
Go: What's Different ?
Go: What's Different ?Go: What's Different ?
Go: What's Different ?
 
Typescript Fundamentals
Typescript FundamentalsTypescript Fundamentals
Typescript Fundamentals
 
Ruby eventmachine pres at rubybdx
Ruby eventmachine pres at rubybdxRuby eventmachine pres at rubybdx
Ruby eventmachine pres at rubybdx
 
PSR-7 - Middleware - Zend Expressive
PSR-7 - Middleware - Zend ExpressivePSR-7 - Middleware - Zend Expressive
PSR-7 - Middleware - Zend Expressive
 
Power Leveling your TypeScript
Power Leveling your TypeScriptPower Leveling your TypeScript
Power Leveling your TypeScript
 
Web development basics (Part-7)
Web development basics (Part-7)Web development basics (Part-7)
Web development basics (Part-7)
 
Introduction to Kotlin coroutines
Introduction to Kotlin coroutinesIntroduction to Kotlin coroutines
Introduction to Kotlin coroutines
 
Scaling up development of a modular code base
Scaling up development of a modular code baseScaling up development of a modular code base
Scaling up development of a modular code base
 
Pengantar Ruby on Rails
Pengantar Ruby on RailsPengantar Ruby on Rails
Pengantar Ruby on Rails
 

Semelhante a Ruby, the language of devops

Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
Cassandra: Not Just NoSQL, It's MoSQL
Cassandra: Not Just NoSQL, It's MoSQLCassandra: Not Just NoSQL, It's MoSQL
Cassandra: Not Just NoSQL, It's MoSQLEric Evans
 
NoSQL Yes, But YesCQL, No?
NoSQL Yes, But YesCQL, No?NoSQL Yes, But YesCQL, No?
NoSQL Yes, But YesCQL, No?Eric Evans
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Michał Konarski
 
Modern web dev_taxonomy
Modern web dev_taxonomyModern web dev_taxonomy
Modern web dev_taxonomykevin_donovan
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyBozhidar Bozhanov
 
Sheffield_R_ July meeting - Interacting with R - IDEs, Git and workflow
Sheffield_R_ July meeting - Interacting with R - IDEs, Git and workflowSheffield_R_ July meeting - Interacting with R - IDEs, Git and workflow
Sheffield_R_ July meeting - Interacting with R - IDEs, Git and workflowPaul Richards
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go langAmal Mohan N
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talkReuven Lerner
 
Go language presentation
Go language presentationGo language presentation
Go language presentationparamisoft
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Espen Brækken
 
Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?Hernan Wilkinson
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golangBasil N G
 
Devopsdays se-2011
Devopsdays se-2011Devopsdays se-2011
Devopsdays se-2011lusis
 

Semelhante a Ruby, the language of devops (20)

Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
Cassandra: Not Just NoSQL, It's MoSQL
Cassandra: Not Just NoSQL, It's MoSQLCassandra: Not Just NoSQL, It's MoSQL
Cassandra: Not Just NoSQL, It's MoSQL
 
Go fundamentals
Go fundamentalsGo fundamentals
Go fundamentals
 
Python overview
Python overviewPython overview
Python overview
 
Ruby
RubyRuby
Ruby
 
NoSQL Yes, But YesCQL, No?
NoSQL Yes, But YesCQL, No?NoSQL Yes, But YesCQL, No?
NoSQL Yes, But YesCQL, No?
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?Ruby is dying. What languages are cool now?
Ruby is dying. What languages are cool now?
 
Modern web dev_taxonomy
Modern web dev_taxonomyModern web dev_taxonomy
Modern web dev_taxonomy
 
Scala - the good, the bad and the very ugly
Scala - the good, the bad and the very uglyScala - the good, the bad and the very ugly
Scala - the good, the bad and the very ugly
 
Sheffield_R_ July meeting - Interacting with R - IDEs, Git and workflow
Sheffield_R_ July meeting - Interacting with R - IDEs, Git and workflowSheffield_R_ July meeting - Interacting with R - IDEs, Git and workflow
Sheffield_R_ July meeting - Interacting with R - IDEs, Git and workflow
 
Introduction to go lang
Introduction to go langIntroduction to go lang
Introduction to go lang
 
Rails development environment talk
Rails development environment talkRails development environment talk
Rails development environment talk
 
Go language presentation
Go language presentationGo language presentation
Go language presentation
 
Go lang
Go langGo lang
Go lang
 
Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex Ruby on Rails (RoR) as a back-end processor for Apex
Ruby on Rails (RoR) as a back-end processor for Apex
 
Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?Go/Ruby/Java: What's next?
Go/Ruby/Java: What's next?
 
Go Programming language, golang
Go Programming language, golangGo Programming language, golang
Go Programming language, golang
 
Deluxe techperl
Deluxe techperlDeluxe techperl
Deluxe techperl
 
Devopsdays se-2011
Devopsdays se-2011Devopsdays se-2011
Devopsdays se-2011
 

Último

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...masabamasaba
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024VictoriaMetrics
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...masabamasaba
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastPapp Krisztián
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benonimasabamasaba
 

Último (20)

%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
%+27788225528 love spells in Knoxville Psychic Readings, Attraction spells,Br...
 
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
Abortion Pill Prices Tembisa [(+27832195400*)] 🏥 Women's Abortion Clinic in T...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni%in Benoni+277-882-255-28 abortion pills for sale in Benoni
%in Benoni+277-882-255-28 abortion pills for sale in Benoni
 

Ruby, the language of devops

  • 2. Who am I? ● Rob Kinyon o @rkinyon o rob.kinyon@gmail.com ● Devops lead for many years
  • 3. What is Devops? ● The Cloud? ● Jenkins Automation? ● Continuous integration & deployment? ● A new title? o with no extra pay . . . ● Developers doing Operations?? o And fire all the sysadmins? (NO-OPS!) ● Automating away your coworkers??!
  • 5. The Programming of Operations ● Operations is: o Build servers o Packaging o Monitoring o Provisioning o Virtualization o Environment/Stack Management o Many many many more things
  • 6. The Programming of Operations
  • 7. The Programming of Operations ● Lots of helpers o Build this o Package that o Move things from here to there
  • 8. The Programming of Operations ● Lots of helpers o Build this o Package that o Move things from here to there ● Templating o Homegrown templates for Nagios
  • 9. The Programming of Operations ● Lots of helpers o Build this o Package that o Move things from here to there ● Templating o Homegrown templates for Nagios ● Lots of manual activities
  • 10. The Programming of Operations Manual === Broken
  • 11. TARGET=${1:-"monitor-prod"} for rule in /nagios/rules/*.tmpl; do process_template.pl $rule $TARGET mv ${rule##tmpl#cfg} /nagios/final done scp /nagios/final/*.cfg $TARGET.company.com:/var/nagios/ ssh $TARGET.company.com -c "sudo service nagios3 restart” The Programming of Operations
  • 12. The Programming of Operations ● As a single script, it's okay. o Concise, clear - what else do you need?
  • 13. The Programming of Operations ● As a single script, it's okay. o Concise, clear - what else do you need? ● Problems: o No tests (untestable!) o No reusability or extensibility o Inscrutable code
  • 14. The Programming of Operations ● As a single script, it's okay. o Concise, clear - what else do you need? ● Problems: o No tests (untestable!) o No reusability or extensibility o Inscrutable code ● Bugs: o Assumes the contents of $PWD and $PATH o Assumes a human will know if it worked
  • 15. The Programming of Operations ● Operations staff are not developers
  • 16. The Programming of Operations ● Operations staff are not developers ● Operational focus is about maintenance o Keep it on o Keep it up o Keep it responding
  • 17. The Programming of Operations
  • 18. The Programming of Operations ● Operations staff are not developers ● Operational focus is about maintenance o Keep it on o Keep it up o Keep it responding ● Operations has to manage changes by those pesky developers o Right now. While something is on fire. (Really!)
  • 19. The Programming of Operations What is the perfect language? ● Multi-system ● Quick to boot ● Easy to learn ● Easy to maintain ● Large community / Lots of modules ● Easy to find good staff
  • 20. Languages we won't discuss ● C/C++ ● .NET (C#, F#, etc) ● JVM languages ● Functional languages o Especially Erlang ● Node.JS
  • 21. Bash/Shell scripts (Good and Bad) ● Easy to write ● Everyone has written Bash scripts ● Horrible control structures ● Horrible variable structures ● Non-existent code structuring ● “Libraries” don’t exist ● Only really works on *nix o Git-Bash doesn't count
  • 22. Perl (the Good) ● What most sysadmins use other than Bash ● Great variable structures ● Great control structures ● Excellent reusability o CPAN is the largest single-language repository ● Works everywhere (literally) ● Good programmers can manage 500kLOC
  • 23. Perl (the Bad) ● Everyone thinks they know Perl o Bad Perl is really really bad.
  • 24. Perl (the Bad) ● Everyone thinks they know Perl o Bad Perl is really really bad. ● Standard language facilities require libraries o Exceptions, objects, case statements
  • 25. Perl (the Bad) ● Everyone thinks they know Perl o Bad Perl is really really bad. ● Standard language facilities require libraries o Exceptions, objects, case statements ● CPAN is 80%+ useless
  • 26. Perl (the Bad) ● Everyone thinks they know Perl o Bad Perl is really really bad. ● Standard language facilities require libraries o Exceptions, objects, case statements ● CPAN is 80%+ useless ● Really old Perls are installed everywhere o 5.005_003 (March, 1998)
  • 27. Perl (the Ugly) ● Solving a problem with regular expressions means you have two problems.
  • 28. Perl (the Ugly) ● Solving a problem with regular expressions means you have two problems. ● Sigils ($, @, %, etc) make code hard to read o Ironically, the idea was to make code easier to read
  • 29. Perl (the Ugly) ● Solving a problem with regular expressions means you have two problems. ● Sigils ($, @, %, etc) make code hard to read o Ironically, the idea was to make code easier to read ● Too many places where hidden globals make you cry. o E.g., namespaces aren't namespaced.
  • 30. Python (Strengths) ● Great variable structures
  • 31. Python (Strengths) ● Great variable structures ● Great control structures
  • 32. Python (Strengths) ● Great variable structures ● Great control structures ● All the advanced features o Exceptions o Objects o Case statements
  • 33. Python (Strengths) ● Great variable structures ● Great control structures ● All the advanced features o Exceptions o Objects o Case statements ● Runs everywhere that we care about
  • 34. Python (Weaknesses) ● Significant whitespace is difficult for non- developers.
  • 35. Python (Weaknesses) ● Significant whitespace is difficult for non- developers. ● System programming libraries aren't mature
  • 36. Python (Weaknesses) ● Significant whitespace is difficult for non- developers. ● System programming libraries aren't mature ● Writing libraries isn't self-evident o Tutorials and scaffolding also immature
  • 37. Ruby (Strengths) ● Great variable structures
  • 38. Ruby (Strengths) ● Great variable structures ● Great control structures
  • 39. Ruby (Strengths) ● Great variable structures ● Great control structures ● All the advanced features o Exceptions o Objects o Case statements
  • 40. Ruby (Strengths) ● Great variable structures ● Great control structures ● All the advanced features o Exceptions o Objects o Case statements ● Runs everywhere that we care about
  • 41. Ruby (Strengths) ● Great variable structures ● Great control structures ● All the advanced features o Exceptions o Objects o Case statements ● Runs everywhere that we care about ● Already used as a sysadmin language
  • 42. Ruby (Weaknesses) ● Minor versions changing syntax o 1.8.7 vs. 1.9.3 vs 2.x
  • 43. Ruby (Weaknesses) ● Minor versions changing syntax o 1.8.7 vs. 1.9.3 vs 2.x ● Ruby is not Rails o Really!
  • 44. Ruby (Superpowers) 1. Install multiple versions of same library 2. Newbies are a way of life 3. Blocks
  • 45. Multiple library versions ● Sysadmins are pessimistic o Foo-bar 1.3.9 works, so don't change it!!
  • 46. Multiple library versions ● Sysadmins are pessimistic o Foo-bar 1.3.9 works, so don't change it!! ● Not everyone can use the same version o Something needs a feature in Foo-bar 2.1.5
  • 47. Multiple library versions ● Sysadmins are pessimistic o Foo-bar 1.3.9 works, so don't change it!! ● Not everyone can use the same version o Something needs a feature in Foo-bar 2.1.5 ● So install both and specify at runtime gem 'Foo-bar', '=1.3.9' require 'foobar'
  • 48. Newbie friendly ● Rails is how many new web-developers start
  • 49. Newbie friendly ● Rails is how many new web-developers start ● Rails is Ruby (plus, but still)
  • 50. Newbie friendly ● Rails is how many new web-developers start ● Rails is Ruby (plus, but still) ● Thousands of great tutorials, skeletons, and communities. o Google "ruby tutorial XYZ" for all values of XYZ)
  • 51. Newbie friendly ● Rails is how many new web-developers start ● Rails is Ruby (plus, but still) ● Thousands of great tutorials, skeletons, and communities. o Google "ruby tutorial XYZ" for all values of XYZ ● Syntax is very easy to read and write o Reading code is very hard o Anything that makes it easier is a "Good Thing"(tm)
  • 52. Blocks (Temporary File) require 'tempfile' Tempfile.open('some-prefix') do |tmp| tmp.write "Some text" # Do something with tmp here end
  • 53. Blocks (Reading from a file) File.foreach('/some/file') do |line| puts “Line read: #{line}” do_something(line) end
  • 54. Blocks (Writing to a file) File.open('/some/file') do |file| file.puts 'first line' file.puts 'second line' end
  • 55. Blocks (Writing to a file) File.open '/some/file' { |file| file.puts 'first line' file.puts 'second line' }
  • 56. Blocks (Changing Directory) Dir.chdir('/some/place') do |dir| do_something_in_some_place(dir) end do_something_in_original_dir()
  • 57. Blocks (Nested blocks) Dir.chdir('/some/dir') do %w{sub1 sub2}.each do |subdir| Dir.chdir(subdir) do # In /some/dir/sub[12] end end end
  • 58. Why blocks? ● Same construct for iteration and closures o A logical new lexical scope
  • 59. Why blocks? ● Same construct for iteration and closures o A logical new lexical scope ● Automatic cleanup o (Not necessarily guaranteed in all cases)
  • 60. Why blocks? ● Same construct for iteration and closures o A logical new lexical scope ● Automatic cleanup o (Not necessarily guaranteed in all cases) ● Clean delination of concerns o Relevant code is in one place
  • 61. Why blocks? (as a sysadmin) Because my job isn't where I can faff about until everything is perfectly just-so and my HammerFactoryFactoryFactory has 103% test coverage in Jenkins. I need to be done yesterday and I need to be sure it works by looking at it.
  • 62. Why blocks? (as a devops) Because it's the easiest way to convert a sysadmin into a developer.
  • 63. Tooling ● Vagrant ● Chef / Puppet ● Logstash ● fpm ● Cucumber ● AWS / Rackspace clients ● Rake / Capistrano
  • 64. Tooling (why do I care it's in Ruby?) Three reasons: 1. Plugins
  • 65. Tooling (why do I care it's in Ruby?) Three reasons: 1. Plugins 2. Plugins
  • 66. Tooling (why do I care it's in Ruby?) Three reasons: 1. Plugins 2. Plugins 3. Plugins
  • 67. Tooling (why do I care it's in Ruby?) Three reasons: 1. Plugins 2. Plugins 3. Plugins 4. Some of them require Ruby (Vagrant)