Your SlideShare is downloading. ×
0
Continuous Deliveryin RubySrushti Ambekallu    Brian Guthrie@srshti              @bguthriegithub.com/srushti   github.com/...
Delivering great software
Continuous Integration
1.Unit and integration tests
RSpec or Test::Unit
Tests of specific units of code      Tests of multiple layersTests of external integration points
Receive              new             commitReset testdatabase schema                  Run tests                           ...
Receive              new             commitReset testdatabase schema                  Run tests                           ...
1.Unit and integration tests2.Automated acceptance tests
Cucumber or the test runner of your choice
Selenium or Sahi    Capybara
Receive                new               commitReset test                    Run                                        Re...
1.Unit and integration tests2.Automated acceptance tests3.User acceptance tests
type              click         click       click     click
type              click         click       click     click                   click                  click    click       ...
type                    click          click        click        click                          click                     ...
type                    click          click        click        click                          click           click     ...
click type                    click                               type          click                          click click...
click type                    click                              type          click                         click click  ...
1.Unit and integration tests2.Automated acceptance tests3.User acceptance tests
1.Unit and integration tests2.Automated acceptance tests2a.Deploy3.User acceptance tests
Deployment
Super easy in Ruby(those Java guys are suckers)
$ ssh root@production.com
$ ssh root@production.comprod:~ root# cd /var/www/site
$ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2
$ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2prod:~ root# bundle install
$ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2prod:~ root# bundle installprod:~...
$ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2prod:~ root# bundle installprod:~...
$ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2prod:~ root# bundle installprod:~...
$ cap deploy production
Why automate?
Digression: The Rails deploy model
$ ssh root@production.com
$ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2
$ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/si...
$ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/si...
$ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/si...
$ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/si...
$ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/si...
$ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/si...
ci-server:~/app/ $ bundle install --deploymentci-server:~/app/ $ rake jammit:packageci-server:~/app/ $ tar zxvf app-<SHA>....
RVM
RVMNot for production
$ cat ~/projecta/.rvmrcrvm jruby@projecta$ cat ~/projecta/.rvmrcrvm ree@projectb$ cat ~/projecta/.rvmrcrvm 1.9.1@projectc
Environments
Appserver
Appserver Appserver Appserver
Appserver         Background         jobs server Appserver Appserver
App           server                    Background                    jobs server            App Load           serverbala...
App           server                    Background                    jobs server            App Load           serverbala...
Chef
ChefPuppet
App           server                    Background                    jobs server            App Load           serverbala...
ConfigurationManagement                           App                          server                                   Bac...
Peace in the kingdom
How often?
Project Lifecycle   faf4d2788f   .........................   a433f20abbCode                                           Rele...
Project Lifecycle  faf4d2788f   f26115c8c   c86c1bfea6   56d1dd8accc4   dd35192f8 1b51fee653a   f038af17de4   8318b750aec ...
Project Lifecycle             f26115c8c                  dd35192f8   f038af17de4       631f5c3f58c        7bcafdd2266Code ...
Project Lifecycle         7bcafdd2266Code                       Release        Multiple times          a day??
Features long in development need branches
Branch by abstraction(“if this feature is enabled, show this link”)<% if feature?(:masala) %>  <%= render :partial => "dos...
This doesn’t work for everything:   big features, config changes
Branch by source control      (“fork me”)  http://martinfowler.com/bliki/FeatureBranch.html
The Build Pipeline
“...an automated manifestation of your process for   getting software from version control into the                hands o...
Unit and     Automated      ManualIntegration   Acceptance   Acceptance   Production                                      ...
Test     Test     Test              runner   runner   runner                        Test                       runner Unit...
“I see CI as primarily giving birth to a releasecandidate at each commit. The job of the CIsystem and deployment process i...
Automate until human intervention = decision                 DEPLOY
Internal                 External                             users                    users  Feature                     ...
Human beings
Real testing is hardLet computers do the simple testing  Smart humans for smart testing
Automated testing                       User testingTraditional projects
Automated testing           User testingAgilify!
Agilify!
Questions?   Srushti Ambekallu   @srshti   github.com/srushti   Brian Guthrie   @bguthrie   github.com/bguthrie
Continuous Delivery in Ruby
Continuous Delivery in Ruby
Continuous Delivery in Ruby
Continuous Delivery in Ruby
Continuous Delivery in Ruby
Continuous Delivery in Ruby
Continuous Delivery in Ruby
Continuous Delivery in Ruby
Continuous Delivery in Ruby
Upcoming SlideShare
Loading in...5
×

Continuous Delivery in Ruby

6,307

Published on

The Ruby community has driven a lot of technical innovation in deployment and configuration management over the last few years, and so the idea of delivering high-quality software rapidly should be familiar to most of us. But although our tools are state-of-the-art, getting them to work together properly can be surprisingly frustrating. In this talk, I'll explain how to implement a high-quality rapid build and deploy process using standard CI tools, Bundler, RVM, and Capistrano. I'll also discuss how to coach your developers, QAs, and client to be "production-ready, any time."

Published in: Technology
0 Comments
9 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
6,307
On Slideshare
0
From Embeds
0
Number of Embeds
7
Actions
Shares
0
Downloads
47
Comments
0
Likes
9
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • Brian - skeptic (&amp;#x201C;what do I need tests for?&amp;#x201D;)\nSrushti - champion\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Brian - champion (&amp;#x201C;I deploy all the time - I GUESS you could automate&amp;#x201D;)\nSrushti - skeptic\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Brian - champion, Srushti - skeptic\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Brian - more rapid, then convinced to be slower\nSrushti - slower, then convinced to be more rapid\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Brian - skeptic because wants slower deploys, Srushti - champion\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Etsy - will open source later\n
  • Brian - skeptic (&amp;#x201C;I used to have an army of testers&amp;#x201D;)\nSrushti - champion\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Transcript of "Continuous Delivery in Ruby"

    1. 1. Continuous Deliveryin RubySrushti Ambekallu Brian Guthrie@srshti @bguthriegithub.com/srushti github.com/bguthrie
    2. 2. Delivering great software
    3. 3. Continuous Integration
    4. 4. 1.Unit and integration tests
    5. 5. RSpec or Test::Unit
    6. 6. Tests of specific units of code Tests of multiple layersTests of external integration points
    7. 7. Receive new commitReset testdatabase schema Run tests Reset test data
    8. 8. Receive new commitReset testdatabase schema Run tests Reset test data
    9. 9. 1.Unit and integration tests2.Automated acceptance tests
    10. 10. Cucumber or the test runner of your choice
    11. 11. Selenium or Sahi Capybara
    12. 12. Receive new commitReset test Run Resetdatabase browser test data schema tests Restart test server
    13. 13. 1.Unit and integration tests2.Automated acceptance tests3.User acceptance tests
    14. 14. type click click click click
    15. 15. type click click click click click click click click click type
    16. 16. type click click click click click click click click click type clickclick click type
    17. 17. type click click click click click click click click click click type click clickclick click type
    18. 18. click type click type click click click click click click click click click click click click type click clickclick click type
    19. 19. click type click type click click click click click click ERROR click click click click click click type click clickclick click type
    20. 20. 1.Unit and integration tests2.Automated acceptance tests3.User acceptance tests
    21. 21. 1.Unit and integration tests2.Automated acceptance tests2a.Deploy3.User acceptance tests
    22. 22. Deployment
    23. 23. Super easy in Ruby(those Java guys are suckers)
    24. 24. $ ssh root@production.com
    25. 25. $ ssh root@production.comprod:~ root# cd /var/www/site
    26. 26. $ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2
    27. 27. $ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2prod:~ root# bundle install
    28. 28. $ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2prod:~ root# bundle installprod:~ root# rake db:migrate
    29. 29. $ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2prod:~ root# bundle installprod:~ root# rake db:migrateprod:~ root# rake jammit:package
    30. 30. $ ssh root@production.comprod:~ root# cd /var/www/siteprod:~ root# git pull a31a0eb569ba2prod:~ root# bundle installprod:~ root# rake db:migrateprod:~ root# rake jammit:packageprod:~ root# touch tmp/restart.txt
    31. 31. $ cap deploy production
    32. 32. Why automate?
    33. 33. Digression: The Rails deploy model
    34. 34. $ ssh root@production.com
    35. 35. $ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2
    36. 36. $ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/site/current /var/www/site/a31a0eb569ba2
    37. 37. $ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/site/current /var/www/site/a31a0eb569ba2prod:~ root# bundle install
    38. 38. $ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/site/current /var/www/site/a31a0eb569ba2prod:~ root# bundle installprod:~ root# rake db:migrate
    39. 39. $ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/site/current /var/www/site/a31a0eb569ba2prod:~ root# bundle installprod:~ root# rake db:migrateprod:~ root# rake jammit:package
    40. 40. $ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/site/current /var/www/site/a31a0eb569ba2prod:~ root# bundle installprod:~ root# rake db:migrateprod:~ root# rake jammit:packageprod:~ root# touch tmp/restart.txt
    41. 41. $ ssh root@production.comprod:~ root# git clone git@scm/myapp.git /var/www/site/a31a0eb569ba2prod:~ root# ln -s /var/ww/site/current /var/www/site/a31a0eb569ba2prod:~ root# bundle installprod:~ root# rake db:migrateprod:~ root# rake jammit:packageprod:~ root# touch tmp/restart.txt
    42. 42. ci-server:~/app/ $ bundle install --deploymentci-server:~/app/ $ rake jammit:packageci-server:~/app/ $ tar zxvf app-<SHA>.tgz *
    43. 43. RVM
    44. 44. RVMNot for production
    45. 45. $ cat ~/projecta/.rvmrcrvm jruby@projecta$ cat ~/projecta/.rvmrcrvm ree@projectb$ cat ~/projecta/.rvmrcrvm 1.9.1@projectc
    46. 46. Environments
    47. 47. Appserver
    48. 48. Appserver Appserver Appserver
    49. 49. Appserver Background jobs server Appserver Appserver
    50. 50. App server Background jobs server App Load serverbalancer App server
    51. 51. App server Background jobs server App Load serverbalancer App server Background jobs server App server
    52. 52. Chef
    53. 53. ChefPuppet
    54. 54. App server Background jobs server App Load serverbalancer App server Background jobs server App server
    55. 55. ConfigurationManagement App server Background jobs server App Load server balancer App server Background jobs server App server
    56. 56. Peace in the kingdom
    57. 57. How often?
    58. 58. Project Lifecycle faf4d2788f ......................... a433f20abbCode Release Six months
    59. 59. Project Lifecycle faf4d2788f f26115c8c c86c1bfea6 56d1dd8accc4 dd35192f8 1b51fee653a f038af17de4 8318b750aec 192410bd2537 631f5c3f58c 7bcafdd2266 2bbed3e4bd2Code Release Every week (iteration)
    60. 60. Project Lifecycle f26115c8c dd35192f8 f038af17de4 631f5c3f58c 7bcafdd2266Code Release Every day?
    61. 61. Project Lifecycle 7bcafdd2266Code Release Multiple times a day??
    62. 62. Features long in development need branches
    63. 63. Branch by abstraction(“if this feature is enabled, show this link”)<% if feature?(:masala) %> <%= render :partial => "dosas/masala", :locals => { :dosa => @dosas.masala.first } %><% else %> <%= render :partial => "dosas/plain", :locals => { :dosa => @dosas.first } %><% end %>
    64. 64. This doesn’t work for everything: big features, config changes
    65. 65. Branch by source control (“fork me”) http://martinfowler.com/bliki/FeatureBranch.html
    66. 66. The Build Pipeline
    67. 67. “...an automated manifestation of your process for getting software from version control into the hands of your users.” - Jez Humble and David Farley, Continuous Delivery
    68. 68. Unit and Automated ManualIntegration Acceptance Acceptance Production (Woohoo!) Tests Tests Tests
    69. 69. Test Test Test runner runner runner Test runner Unit and Automated ManualIntegration Acceptance Acceptance Production (Woohoo!) Tests Tests Tests
    70. 70. “I see CI as primarily giving birth to a releasecandidate at each commit. The job of the CIsystem and deployment process is to disprovethe production-readiness of a release candidate.This model relies on the need to have somemainline that represents the current shared, mostup to date picture of complete.” - David Farley
    71. 71. Automate until human intervention = decision DEPLOY
    72. 72. Internal External users users Feature User Continuousdevelopment Staging acceptance Production integration Bug fixes testing
    73. 73. Human beings
    74. 74. Real testing is hardLet computers do the simple testing Smart humans for smart testing
    75. 75. Automated testing User testingTraditional projects
    76. 76. Automated testing User testingAgilify!
    77. 77. Agilify!
    78. 78. Questions? Srushti Ambekallu @srshti github.com/srushti Brian Guthrie @bguthrie github.com/bguthrie
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×