Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deliver

 Deliver

As a developer, your job does not stop with writing clean, well-documented and well-tested code. You get paid for working, in production code. So how do you consistently deliver your code into production? How you make it part of your CI process? Does devops do it for you via Chef or Puppet?

This talk is meant to explore the current deployment processes, present their strengths and weaknesses and provide a simple alternative. This alternative has no dependencies (no, not even Ruby) and can be applied in the same way to your trusted Rails, the hated PHP or your look-ma-no-tests node.js.

Video: http://www.youtube.com/watch?v=dzI8M-H3F08

Gerhard Lazu

March 11, 2013
Tweet

More Decks by Gerhard Lazu

Other Decks in Programming

Transcript

  1. DELIVER
    @gerhardlazu
    LRUG 03.2013

    View Slide

  2. GIT-DEPLOY
    CAPISTRANO
    VLAD
    MINA
    FABRIC
    ASGARD
    CHEF PUPPET
    puppi
    GIT-DEPLOY
    application
    RECAP

    View Slide

  3. BACK TO BASICS
    git ssh foreman
    bash
    WE ARE A UNIX SHOP, EVERYTHING ELSE IS JUST A DETAIL

    View Slide

  4. DO ONE THING
    DO IT TO THE BEST OF YOUR ABILITIES

    View Slide

  5. SMALL IS BEAUTIFUL
    SIMPLICITY OVER PERFECTION

    View Slide

  6. .deliver/config
    1 #!/usr/bin/env bash
    2
    3 $APP="foo"
    4 $HOSTS="foo.1 foo.2"
    5 $PORT="5000"
    6
    7 post_launch() {
    8 notify_newrelic_of_deployment
    9 clean_static_cache
    10 }

    View Slide

  7. PROBLEM
    FOCUS ON THE

    View Slide

  8. $ deliver check
    ORIGIN_DIR /Users/gerhard/code/foo
    STRATEGY ruby
    HOSTS foo.1 foo.2
    -----------------------------------------------------------
    APP foo
    APP_USER foo
    DELIVER_TO ~foo/app
    REFSPEC master
    GIT_PUSH -f
    REVISION f80584aa195479eaa613aa2f5900009188
    PORT 5000
    SUPERVISOR upstart
    READY TO DELIVER!

    View Slide

  9. MODES
    COMPACT
    verbose
    debug
    plain

    View Slide

  10. $ deliver
    DELIVERING FOO WITH RUBY STRATEGY
    -----> Authorizing hosts
    -----> Ensuring hosts are ready to accept git pushes
    -----> Pushing new commits with git to: [email protected] [email protected]
    -----> Resetting remote hosts to f80584aa195479eaa613aa2f590
    -----> Updating git submodules
    -----> Installing gems with bundler
    -----> Exporting services to upstart
    -----> Launching app with upstart
    -----> Notifying New Relic of new deployment
    FOO DELIVERED!

    View Slide

  11. ruby
    STRATEGIES
    node.js shared
    generated gh-pages
    S3

    View Slide

  12. strategies/ruby
    1 run() {
    2 authorize_hosts
    3 init_app_remotely
    4 git_push
    5 git_reset_remote
    6 authorize_remote_hosts
    7 git_submodules
    8 rvmrc_trust
    9 bundle_install
    10 foreman_export
    11 launch
    12 }

    View Slide

  13. HOOKS
    init_app_remotely
    git_push
    git_submodules
    bundle_install
    foreman_export
    launch

    View Slide

  14. .deliver/config
    1 #!/usr/bin/env bash
    2
    3 $APP="foo"
    4 $HOSTS="foo.1 foo.2"
    5 $PORT="5000"
    6
    7 post_launch() {
    8 notify_newrelic_of_deployment
    9 clean_static_cache
    10 }

    View Slide

  15. CONTINUOUS DELIVERY
    RELIABLY
    RELEASING
    HIGH-QUALITY
    SOFTWARE
    QUICKLY
    CONTINUOUS
    INCREMENTAL
    CHANGES
    WITH
    MINIMAL
    RISK

    View Slide

  16. bin/build
    1 #!/usr/bin/env bash
    2
    3 # functions
    4
    5 setup_dependencies
    6 run_tests
    7 tag_for_deploy
    8 use_compiled_assets
    9 _deliver

    View Slide

  17. Gerhard L. hubot deliver foo foo.1

    View Slide

  18. PRODUCTION
    IF IT’S NOT IN PRODUCTION, IT’S INVENTORY

    View Slide

  19. DELIVER, BE HAPPY!
    QUESTIONS
    @gerhardlazu
    LRUG 03.2013

    View Slide