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

"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. 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
  2. ELEMENTS OF DEPLOYMENT • System deployment • Application deployment •

    Configuration deployment • Database deployment
  3. 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)
  4. MIGRAINES AND MIGRATIONS • Flyway • Liquibase • c5-db-migration •

    dbdeploy • mybatis • MIGRATEdb • migrate4j • dbmaintain • AutoPatch