$30 off During Our Annual Pro Sale. View Details »

"Roll out" - Code deployments that do not suck

"Roll out" - Code deployments that do not suck

How comfortable are you when deploying your code?
Is your deployment process streamlined and automated?
Can you deploy to multiple servers?
How do you deal with database migrations?
In this talk we will go over some of the options available and the challenges you will be facing while trying to setup frictionless deployments.

Vranac Srdjan

March 12, 2016
Tweet

More Decks by Vranac Srdjan

Other Decks in Programming

Transcript

  1. ROLL OUT
    Code Deployments that do not suck
    Srdjan Vranac // code4hire.com // @vranac

    View Slide

  2. business owner, developer, consultant, mercenary,
    writing terrible code that performs exceptionally,
    wrangling elePHPants and Pythons, obsessed with
    process automation, interested in continuous
    integration and delivery, clean code, testing, best
    practices and distributed systems

    View Slide

  3. WARNING!

    View Slide

  4. DOCKER?

    NO

    View Slide

  5. WHO ARE YOU?

    View Slide

  6. STRIVE FOR BETTER

    View Slide

  7. CAN YOU…?

    View Slide

  8. AS GOOD AS

    View Slide

  9. ELEMENTS OF DEPLOYMENT
    • System deployment
    • Application deployment
    • Configuration deployment
    • Database deployment

    View Slide

  10. SYSTEM DEPLOYMENT

    View Slide

  11. APPLICATION DEPLOYMENT

    View Slide

  12. CONFIGURATION DEPLOYMENT

    View Slide

  13. DATABASE DEPLOYMENT

    View Slide

  14. View Slide

  15. MANUAL DEPLOYMENT

    View Slide

  16. PUSH TO DEPLOY
    #!/bin/sh
    git --work-tree=/var/www/domain.com --git-dir=/var/repo/site.git checkout -f
    git remote add live ssh://[email protected]/var/repo/site.git

    View Slide

  17. ANSIBLE OR SIMILAR

    View Slide

  18. FABRIC
    from fabric.api import *

    from time import strftime, gmtime


    env.forward_agent = True

    env.roledefs = {

    'production': ['[email protected]'],

    }

    WEBSITE_PATH = "/var/www/project"


    def _deploy_server(version):

    with cd(WEBSITE_PATH):

    run('git fetch')

    run('git reset --hard %s' % version)


    @notify

    @task

    def deploy():

    time = strftime("%Y-%m-%d-%H.%M.%S", gmtime())

    tag = "prod-%s" % time

    local('git checkout master')

    local('git tag -a %s -m "Prod"' % tag)

    local('git push --tags')

    env.roles=['production']

    execute(_deploy_server, tag)


    @notify

    @task

    def rollback(num_revs=1):

    with cd(WEBSITE_PATH):

    run('git fetch')

    tag = run('git tag -l prod/* | sort | tail -n' + \

    str(1 + int(num_revs)) + ' | head -n1')

    run('git checkout ' + tag)

    View Slide

  19. MIGRAINES AND MIGRATIONS
    • Flyway
    • Liquibase
    • c5-db-migration
    • dbdeploy
    • mybatis
    • MIGRATEdb
    • migrate4j
    • dbmaintain
    • AutoPatch

    View Slide

  20. CONTINUOUS D*

    View Slide

  21. FULL AUTO?
    YOU NEVER GO FULL AUTO

    View Slide

  22. YOU ARE PAID TO
    MAKE THINGS HAPPEN…
    FRICTIONLESSLY

    View Slide

  23. THANK YOU!
    QUESTIONS?
    THE END

    View Slide