Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Strong Practices for Rails
Applications Continuous Delivery
Robb Kidd | Developer, Community Engineering | robb@chef.io | @robbkidd
Nathan Smith | Developer, Core Engineering | smith...
Robb Kidd
• Developer, Community Engineering at Chef
• @robbkidd | robb@chef.io
Nathan Smith
• Developer, Core Engineering...
Quality and innovation, historically a tradeoffQUALITY/COMPLIANCE
RATE OF INNOVATION
Challenges
Manual processes
Weeks to setup new systems or software
Legacy systems and tools
Inflexible,hard-to-change hard...
Idea Value
Manual processes
Weeks to setup new systems or software
Legacy systems and tools
Inflexible,hard-to-change hard...
Idea Value
Manual processes
Weeks to setup new systems or software
Legacy systems and tools
Inflexible,hard-to-change hard...
Idea Value
Manual processes
Weeks to setup new systems or software
Legacy systems and tools
Inflexible,hard-to-change hard...
Idea Value
Manual processes
Weeks to setup new systems or software
Legacy systems and tools
Inflexible,hard-to-change hard...
Idea Value
Manual processes
Weeks to setup new systems or software
Legacy systems and tools
Inflexible,hard-to-change hard...
The game changer: rapid time to value
Innovation
Quality/
Compliance
Dynamic
Infrastructure
Infrastructure as Code
Automat...
DEVOPS
A cultural and professional movement,
focused on how we build and operate
high velocity organizations, born from
th...
PEOPLE
PRODUCTS
COMPANIES
DIVERSITY
WE ARE LEAN
• Eliminate non-value-added action (Waste/Muda)
• Pull over Push
• Kaizen (Continuous Improvement)
• Kaikaku (...
UBIQUITOUS
WORKFLOW
AUTOMATION
The rewards?*
*source: Dr. Nicole Forsgren research on DevOps
More deployments
Ship faster
Faster MTTR after issues
More p...
MANAGE RISK
• Small batches, near term hypothesis
• Validation comes from customers
• Introduce near-term volatility to ga...
CONTINUOUS INTEGRATION
• Always integrate branches to master
• They should be short lived, iterative branches
• Fix the bu...
THE FOUR-EYE RULE
WRITE TESTS
• Unit test (a single function)
• Integration tests (multiple classes/units)
• Functional tests (user-oriented...
ONE PATH FOR CHANGE
• The way change moves through your
organization is fixed
• Designed to re-enforce your principles and...
Testing a Rails app – Lint?
Rubocop
Testing a Rails app – Syntax?
Also, Rubocop
Testing a Rails app – Unit?
RSpec
Testing a Rails app – Security?
Bundler Audit & Brakeman
Testing a Rails app – Quality?
Maintain a Baseline measure with …
Code Climate?
Flay/Flog?
Chef Provides a Proven Approach to DevOps
...
...
...
Targets/Workloads
Collaborative Dev Production
Chef Server
Chef Serv...
Chef Provides a Proven Approach to DevOps
Collaborative DevAssessment
Deploy
Chef Delivery
Local Dev
Unified Pipeline Shape
The stages are fixed, and each stage has a fixed set of phases
APPROVE DELIVER
Submit
Change
Unified Pipeline Shape
The stages are fixed, and each stage has a fixed set of phases
APPROVE DELIVER
Lint
Syntax
Unit
Sub...
Rails App - Lint
execute 'bundle exec rubocop' do
cwd delivery_workspace_repo
environment({
"PATH" => '/usr/local/bin:/usr...
Rails App - Unit
execute 'bundle exec rake spec' do
cwd delivery_workspace_repo
environment({
"PATH" => '/usr/local/bin:/u...
Unified Pipeline Shape
The stages are fixed, and each stage has a fixed set of phases
APPROVE DELIVER
Lint
Syntax
Unit
Sub...
Unified Pipeline Shape
The stages are fixed, and each stage has a fixed set of phases
APPROVE DELIVER
Lint
Syntax
Unit
Sec...
Delivering a Rails app – Publish?
Build a release artifact that is
as complete as possible.
Delivering a Rails app – Publish?
bundle package
rake assets:precompile } tar czvf app_version.tar.gz
Delivering a Rails app – Publish?
app_version.tar.gz
Heroku source API
Heroku build API
Heroku slug
Delivering a Rails app – Publish?
app_version.tar.gz
source_escrow = heroku.source.create(heroku_build_app)
escrow_upload ...
Unified Pipeline Shape
The stages are fixed, and each stage has a fixed set of phases
APPROVE DELIVER
Lint
Syntax
Unit
Sec...
Delivering a Rails app – Provision & Deploy
Provision:
app_name = 'project_#{stage}'
heroku_app = heroku.app.create(
name:...
Unified Pipeline Shape
The stages are fixed, and each stage has a fixed set of phases
APPROVE DELIVER
Lint
Syntax
Unit
Sec...
Unified Pipeline Shape
The stages are fixed, and each stage has a fixed set of phases
APPROVE DELIVER
Lint
Syntax
Unit
Sec...
Unified Pipeline Shape
The stages are fixed, and each stage has a fixed set of phases
APPROVE DELIVER
Lint
Syntax
Unit
Sec...
Unified Pipeline Shape
The stages are fixed, and each stage has a fixed set of phases
APPROVE DELIVER
Lint
Syntax
Unit
Sec...
What questions can we answer for you?
1500 Attendees! 55+ Speakers! Registration Open! Community Celebration!CHEFCONF 2016 AT A GLANCE
Workshops & Chef Training...
Robb Kidd
• Developer, Community Engineering at Chef
• @robbkidd | robb@chef.io
Nathan Smith
• Developer, Core Engineering...
Strong practices for rails applications continuous delivery
Strong practices for rails applications continuous delivery
Strong practices for rails applications continuous delivery
Upcoming SlideShare
Loading in …5
×

Strong practices for rails applications continuous delivery

754 views

Published on

High-velocity organizations deliver change to their customers quickly in a repeatable and predictable way. This talk will explore some pre-requisites and best practices that will help your team move to safe, continuous delivery of your Rails applications. We will demonstrate the path from code commit, to packaged application, to an updated production environment. All of the necessary steps along the way will be fully automated using Chef Delivery. You will leave with some new ideas, practices, and techniques your team can adopt, continuously delivering value to your customers.

Published in: Technology
  • Be the first to comment

Strong practices for rails applications continuous delivery

  1. 1. Strong Practices for Rails Applications Continuous Delivery
  2. 2. Robb Kidd | Developer, Community Engineering | robb@chef.io | @robbkidd Nathan Smith | Developer, Core Engineering | smith@chef.io | @nlsmith
  3. 3. Robb Kidd • Developer, Community Engineering at Chef • @robbkidd | robb@chef.io Nathan Smith • Developer, Core Engineering at Chef • @nlsmith | smith@chef.io
  4. 4. Quality and innovation, historically a tradeoffQUALITY/COMPLIANCE RATE OF INNOVATION
  5. 5. Challenges Manual processes Weeks to setup new systems or software Legacy systems and tools Inflexible,hard-to-change hardware and software Organizational silos Unwieldy divisions of responsibility Infrequent, large releases Fear of deployment due to risk to SLAs Regulatory burdens Compliance bottleneck at the end of a project
  6. 6. Idea Value Manual processes Weeks to setup new systems or software Legacy systems and tools Inflexible,hard-to-change hardware and software Organizational silos Unwieldy divisions of responsibility Regulatory burdens Compliance bottleneck at the end of a project Infrequent, large releases Fear of deployment due to risk to SLAs Automation New systems and software updates deployed in minutes Solutions to the challenges
  7. 7. Idea Value Manual processes Weeks to setup new systems or software Legacy systems and tools Inflexible,hard-to-change hardware and software Organizational silos Unwieldy divisions of responsibility Regulatory burdens Compliance bottleneck at the end of a project Infrequent, large releases Fear of deployment due to risk to SLAs Dynamic infrastructure Easy migration to on-demand, cloud-based infrastructure and management of heterogeneous networks Automation New systems and software updates deployed in minutes Solutions to the challenges
  8. 8. Idea Value Manual processes Weeks to setup new systems or software Legacy systems and tools Inflexible,hard-to-change hardware and software Organizational silos Unwieldy divisions of responsibility Regulatory burdens Compliance bottleneck at the end of a project Infrequent, large releases Fear of deployment due to risk to SLAs Increased cooperation and trust Teams are aligned towards common goals Dynamic infrastructure Easy migration to on-demand, cloud-based infrastructure and management of heterogeneous networks Automation New systems and software updates deployed in minutes Solutions to the challenges
  9. 9. Idea Value Manual processes Weeks to setup new systems or software Legacy systems and tools Inflexible,hard-to-change hardware and software Organizational silos Unwieldy divisions of responsibility Regulatory burdens Compliance bottleneck at the end of a project Infrequent, large releases Fear of deployment due to risk to SLAs Increased cooperation and trust Teams are aligned towards common goals Dynamic infrastructure Easy migration to on-demand, cloud-based infrastructure and management of heterogeneous networks Automation New systems and software updates deployed in minutes Solutions to the challenges Continuous delivery of infrastructure and applications Safe,rapid delivery of incremental value
  10. 10. Idea Value Manual processes Weeks to setup new systems or software Legacy systems and tools Inflexible,hard-to-change hardware and software Organizational silos Unwieldy divisions of responsibility Regulatory burdens Compliance bottleneck at the end of a project Infrequent, large releases Fear of deployment due to risk to SLAs Compliance at velocity Integration of compliance into the workflow using automated tests Increased cooperation and trust Teams are aligned towards common goals Dynamic infrastructure Easy migration to on-demand, cloud-based infrastructure and management of heterogeneous networks Automation New systems and software updates deployed in minutes Continuous delivery of infrastructure and applications Safe,rapid delivery of incremental value Solutions to the challenges
  11. 11. The game changer: rapid time to value Innovation Quality/ Compliance Dynamic Infrastructure Infrastructure as Code Automate the Stack DevOps + +
  12. 12. DEVOPS A cultural and professional movement, focused on how we build and operate high velocity organizations, born from the experiences of its practitioners.
  13. 13. PEOPLE PRODUCTS COMPANIES
  14. 14. DIVERSITY
  15. 15. WE ARE LEAN • Eliminate non-value-added action (Waste/Muda) • Pull over Push • Kaizen (Continuous Improvement) • Kaikaku (Disruptive Change) • Small Batch + Experimentation
  16. 16. UBIQUITOUS WORKFLOW AUTOMATION
  17. 17. The rewards?* *source: Dr. Nicole Forsgren research on DevOps More deployments Ship faster Faster MTTR after issues More profits, market share, and productivity Market cap goes up
  18. 18. MANAGE RISK • Small batches, near term hypothesis • Validation comes from customers • Introduce near-term volatility to gain decreased long-term risk
  19. 19. CONTINUOUS INTEGRATION • Always integrate branches to master • They should be short lived, iterative branches • Fix the build when it goes red
  20. 20. THE FOUR-EYE RULE
  21. 21. WRITE TESTS • Unit test (a single function) • Integration tests (multiple classes/units) • Functional tests (user-oriented, high-level, full stack) • Smoke tests (quickly determine if the system is “working”)
  22. 22. ONE PATH FOR CHANGE • The way change moves through your organization is fixed • Designed to re-enforce your principles and aid flow • Flexible at the level of execution
  23. 23. Testing a Rails app – Lint? Rubocop
  24. 24. Testing a Rails app – Syntax? Also, Rubocop
  25. 25. Testing a Rails app – Unit? RSpec
  26. 26. Testing a Rails app – Security? Bundler Audit & Brakeman
  27. 27. Testing a Rails app – Quality? Maintain a Baseline measure with … Code Climate? Flay/Flog?
  28. 28. Chef Provides a Proven Approach to DevOps ... ... ... Targets/Workloads Collaborative Dev Production Chef Server Chef Server Chef Supermarket Assessment Chef Compliance Search Audit Discover Deploy Chef Delivery Local Dev Model Build Test Chef DK Chef Client & Cookbooks
  29. 29. Chef Provides a Proven Approach to DevOps Collaborative DevAssessment Deploy Chef Delivery Local Dev
  30. 30. Unified Pipeline Shape The stages are fixed, and each stage has a fixed set of phases APPROVE DELIVER Submit Change
  31. 31. Unified Pipeline Shape The stages are fixed, and each stage has a fixed set of phases APPROVE DELIVER Lint Syntax Unit Submit Change
  32. 32. Rails App - Lint execute 'bundle exec rubocop' do cwd delivery_workspace_repo environment({ "PATH" => '/usr/local/bin:/usr/bin:/bin', "GEM_HOME" => node[’fronty']['gem_cache'] }) user node['delivery']['workspace']['build_user'] end
  33. 33. Rails App - Unit execute 'bundle exec rake spec' do cwd delivery_workspace_repo environment({ "PATH" => '/usr/local/bin:/usr/bin:/bin', "GEM_HOME" => node[’fronty']['gem_cache'] }) user node['delivery']['workspace']['build_user'] end
  34. 34. Unified Pipeline Shape The stages are fixed, and each stage has a fixed set of phases APPROVE DELIVER Lint Syntax Unit Submit Change Does this code change look good?
  35. 35. Unified Pipeline Shape The stages are fixed, and each stage has a fixed set of phases APPROVE DELIVER Lint Syntax Unit Security Quality Publish Lint Syntax Unit Submit Change Does this code change look good?
  36. 36. Delivering a Rails app – Publish? Build a release artifact that is as complete as possible.
  37. 37. Delivering a Rails app – Publish? bundle package rake assets:precompile } tar czvf app_version.tar.gz
  38. 38. Delivering a Rails app – Publish? app_version.tar.gz Heroku source API Heroku build API Heroku slug
  39. 39. Delivering a Rails app – Publish? app_version.tar.gz source_escrow = heroku.source.create(heroku_build_app) escrow_upload = Excon.new(source_escrow['source_blob']['put_url']) escrow_upload.put(body: open(tarball).read) build = heroku.build.create(...) build_result = heroku.build.info(heroku_build_app, build['id']) heroku_slug_id = build_result['slug']['id']
  40. 40. Unified Pipeline Shape The stages are fixed, and each stage has a fixed set of phases APPROVE DELIVER Lint Syntax Unit Security Quality Publish Lint Syntax Unit Provision Deploy Smoke Functional Submit Change Does this code change look good?
  41. 41. Delivering a Rails app – Provision & Deploy Provision: app_name = 'project_#{stage}' heroku_app = heroku.app.create( name: app_name, region: 'us', stack: 'cedar-14’ ) Deploy: release = heroku.release.create( heroku_app['name'], slug: heroku_slug_id )
  42. 42. Unified Pipeline Shape The stages are fixed, and each stage has a fixed set of phases APPROVE DELIVER Lint Syntax Unit Security Quality Publish Lint Syntax Unit Provision Deploy Smoke Functional Submit Change Does this code change look good? Do we want to ship this?
  43. 43. Unified Pipeline Shape The stages are fixed, and each stage has a fixed set of phases APPROVE DELIVER Lint Syntax Unit Security Quality Publish Lint Syntax Unit Provision Deploy Smoke Functional Provision Deploy Smoke Functional Submit Change Does this code change look good? Do we want to ship this?
  44. 44. Unified Pipeline Shape The stages are fixed, and each stage has a fixed set of phases APPROVE DELIVER Lint Syntax Unit Security Quality Publish Lint Syntax Unit Provision Deploy Smoke Functional Provision Deploy Smoke Functional Provision Deploy Smoke Functional Submit Change Does this code change look good? Do we want to ship this?
  45. 45. Unified Pipeline Shape The stages are fixed, and each stage has a fixed set of phases APPROVE DELIVER Lint Syntax Unit Security Quality Publish Lint Syntax Unit Provision Deploy Smoke Functional Provision Deploy Smoke Functional Provision Deploy Smoke Functional Provision Deploy Smoke Functional Submit Change Does this code change look good? Do we want to ship this?
  46. 46. What questions can we answer for you?
  47. 47. 1500 Attendees! 55+ Speakers! Registration Open! Community Celebration!CHEFCONF 2016 AT A GLANCE Workshops & Chef Training Community Summit Partner Summit Welcome Reception Keynotes Technical Sessions Happy Hour Keynotes Technical Sessions Awesome Chef Awards Community Celebration DAY 1 // JULY 11 DAY 2 // JULY 12 DAY 3 // JULY 13 THREE DAYS OF OPPORTUNITY TO ENGAGE THE CHEF CUSTOMERS AND PARTNER ECOSYSTEM chefconf.chef.io DAY 1 // JULY 11 « Workshops & ChefTraining « Community Summit « Partner Summit « Welcome Reception DAY 2 // JULY 12 « Keynotes « Technical Sessions « Happy Hour DAY 3 // JULY 13 « Keynotes « Technical Sessions « Awesome Chef Awards « Community Celebration THREE DAYS OF OPPORTUNITY TO ENGAGE THE CHEF CUSTOMERS AND PARTNER ECOSYSTEM
  48. 48. Robb Kidd • Developer, Community Engineering at Chef • @robbkidd | robb@chef.io Nathan Smith • Developer, Core Engineering at Chef • @nlsmith | smith@chef.io

×