SlideShare a Scribd company logo
1 of 50
Download to read offline
DISQUS
                           Continuous Deployment Everything



                                      David Cramer
                                         @zeeg




Wednesday, June 22, 2011
Continuous Deployment


          Shipping new code as soon
                 as it’s ready

                      (It’s really just super awesome buildbots)




Wednesday, June 22, 2011
Workflow


                           Commit (master)




                             Integration             Failed Build




                               Deploy                Reporting




                                                      Rollback




Wednesday, June 22, 2011
Pros                           Cons


              •     Develop features           •   Culture Shock
                    incrementally              •   Stability depends on
              •     Release frequently             test coverage
              •     Smaller doses of QA        •   Initial time
                                                   investment




                       We mostly just care about iteration and stability

Wednesday, June 22, 2011
Painless Development




Wednesday, June 22, 2011
Development



               •     Production > Staging > CI > Dev
                     •     Automate testing of complicated
                           processes and architecture
               •     Simple > complete
                     •     Especially for local development
               •     python setup.py {develop,test}
               •     Puppet, Chef, simple bootstrap.{py,sh}



Wednesday, June 22, 2011
Production            Staging
                           •    PostgreSQL   •   PostgreSQL
                           •    Memcache     •   Memcache
                           •    Redis        •   Redis
                           •    Solr         •   Solr
                           •    Apache       •   Apache
                           •    Nginx        •   Nginx
                           •    RabbitMQ     •   RabbitMQ


                               CI Server         Macbook

                           •    Memcache     •   PostgreSQL
                           •    PostgreSQL   •   Apache
                           •    Redis        •   Memcache
                           •    Solr         •   Redis
                           •    Apache       •   Solr
                           •    Nginx        •   Nginx
                           •    RabbitMQ     •   RabbitMQ


Wednesday, June 22, 2011
Bootstrapping Local



               •     Simplify local setup
                     •     git clone dcramer@disqus:disqus.git
                     •     ./bootstrap.sh
                     •     python manage.py runserver


               •     Need to test dependancies?
                     •     virtualbox + vagrant up



Wednesday, June 22, 2011
“Under Construction”



               •     Iterate quickly by hiding features
               •     Early adopters are free QA



                     from gargoyle import gargoyle

                     def my_view(request):
                         if gargoyle.is_active('awesome', request):
                             return 'new happy version :D'
                         else:
                             return 'old sad version :('




Wednesday, June 22, 2011
Gargoyle

                           Deploy features to portions of a user base at a
                            time to ensure smooth, measurable releases




                            Being users of our product, we actively use
                           early versions of features before public release

Wednesday, June 22, 2011
Conditions in Gargoyle


                    from gargoyle import gargoyle
                    from gargoyle.conditions import ModelConditionSet,
                                                    Percent, String

                    class UserConditionSet(ModelConditionSet):
                        # percent implicitly maps to ``id``
                        percent = Percent()
                        username = String()

                           def can_execute(self, instance):
                               return isinstance(instance, User)

                    # register with our main gargoyle instance
                    gargoyle.register(UserConditionSet(User))




Wednesday, June 22, 2011
Without Gargoyle


                    SWITCHES = {
                        # enable my_feature for 50%
                        'my_feature': range(0, 50),
                    }

                    def is_active(switch):
                        try:
                             pct_range = SWITCHES[switch]
                        except KeyError:
                             return False

                           ip_hash = sum([int(x) for x
                                          in ip_address.split('.')])

                           return (ip_hash % 100 in pct_range)


                                    If you use Django, use Gargoyle


Wednesday, June 22, 2011
Integration
                           (or as we like to call it)




Wednesday, June 22, 2011
Integration is Required




                           Deploy only when things wont break

Wednesday, June 22, 2011
Setup a Jenkins Build




Wednesday, June 22, 2011
Reporting is Critical




Wednesday, June 22, 2011
CI Requirements



               •     Developers must know when they’ve
                     broken something
                     •     IRC, Email, IM
               •     Support proper reporting
                     •     XUnit, Pylint, Coverage.py
               •     Painless setup
                     •     apt-get install jenkins *

                           https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu


Wednesday, June 22, 2011
Shortcomings

               •     False positives lower awareness
                     •     Reporting isn't accurate
                     •     Services fail
                     •     Bad Tests
               •     Not enough code coverage
                     •     Regressions on untested code
               •     Test suite takes too long
                     •     Integration tests vs Unit tests
                     •     SOA, distribution

Wednesday, June 22, 2011
Fixing False Positives




               •     Re-run tests several times on a failure
               •     Report continually failing tests
                     •     Fix continually failing tests
               •     Rely less on 3rd parties
                     •     Mock/Dingus




Wednesday, June 22, 2011
Maintaining Coverage




               •     Raise awareness with reporting
                     •     Fail/alert when coverage drops on a build
               •     Commit tests with code
                     •     Coverage against commit di    for
                           untested regressions
               •     Drive it into your culture




Wednesday, June 22, 2011
Speeding Up Tests




               •     Write true unit tests
                     •     vs slower integration tests
               •     Mock 3rd party APIs
               •     Distributed and parallel testing
                     •     http://github.com/disqus/mule




Wednesday, June 22, 2011
Mule



               •     Unstable, will change a lot
               •     Mostly Django right now
                     •     Generic interfaces for unittest2
               •     Works with multi-processing and Celery
               •     Full XUnit integration
               •     Simple workflow
                     •     mule test --runner="python manage.py
                           mule --worker $TEST"



Wednesday, June 22, 2011
Deploy (finally)




Wednesday, June 22, 2011
How DISQUS Does It




               •     Incremental deploy with Fabric
               •     Drop server from pool
               •     Pull in requirements on each server
                     •     Isolated virtualenv’s built on each server
               •     Push server back online




Wednesday, June 22, 2011
How You Can Do It

                    # fabfile.py
                    from fabric.api import *

                    def deploy(revision):
                        # update sources, virtualenv, requirements
                        # ...

                           # copy ``current`` to ``previous``
                           run('cp -R %(path)s/current %(path)s/previous' % dict(
                               path=env.path,
                               revision=revision,
                           ))

                           # symlink ``revision`` to ``current``
                           run('ln -fs %(path)s/%(revision)s %(path)s/current' % dict(
                               path=env.path,
                               revision=revision,
                           ))

                           # restart apache
                           run('touch %(path)s/current/django.wsgi')



Wednesday, June 22, 2011
How YOU Can Do It (cont.)




                    # fabfile.py
                    from fabric.api import *

                    def rollback(revision=None):
                        # move ``previous`` to ``current``
                        run('mv %(path)s/previous %(path)s/current' % dict(
                            path=env.path,
                            revision=revision,
                        ))

                           # restart apache
                           run('touch %(path)s/current/django.wsgi')




Wednesday, June 22, 2011
Challenges




               •     PyPi works on server A, but not B
               •     Scale
               •     CPU cost per server
               •     Schema changes, data model changes
               •     Backwards compatibility




Wednesday, June 22, 2011
PyPi is Down




               •     http://github.com/disqus/chishop




Wednesday, June 22, 2011
Help, we have 100 servers!




               •     Incremental (ours) vs Fanout
               •     Push vs Pull
                     •     Twitter uses BitTorrent
               •     Isolation vs Packaging (Complexity)




Wednesday, June 22, 2011
SQL Schema Changes




               1. Add column (NULLable)
               2. Add app code to fill column
               3.Deploy
               4.Backfill column
               5. Add app code to read column
               6.Deploy




Wednesday, June 22, 2011
Updating Caches




               •     Have a global version number
                     •     CACHE_PREFIX = 9000
               •     Have a data model cache version
                     •     sha1(cls.__dict__)
               •     Use multiple caches




Wednesday, June 22, 2011
Reporting




Wednesday, June 22, 2011
It’s Important!




Wednesday, June 22, 2011
<You> Why is mongodb-1 down?

         <Ops> It’s down? Must have crashed again




Wednesday, June 22, 2011
Meaningful Metrics




               •     Rate of tra c (not just hits!)
                     •     Business vs system
               •     Response time (database, web)
               •     Exceptions
               •     Social media
                     •     Twitter




Wednesday, June 22, 2011
Standard Tools



                                                       Nagios

                           Graphite




Wednesday, June 22, 2011
Using Graphite


                    # statsd.py
                    # requires python-statsd

                    from pystatsd import Client
                    import socket

                    def with_suffix(key):
                        hostname = socket.gethostname().split('.')[0]
                        return '%s.%s' % (key, hostname)

                    client = Client(host=STATSD_HOST, port=STATSD_PORT)

                    # statsd.incr('key1', 'key2')
                    def incr(*keys):
                        keys = [with_suffix(k) for k in keys]:
                        client.increment(*keys):




Wednesday, June 22, 2011
Using Graphite (cont.)




                           (Tra c across a cluster of servers)


Wednesday, June 22, 2011
Logging



                           •   Realtime
                           •   Aggregates
                           •   History
                           •   Notifications
                           •   Scalable
                           •   Available
                           •   Metadata



Wednesday, June 22, 2011
Logging: Syslog


                           ✓   Realtime
                           x   Aggregates
                           ✓   History
                           x   Notifications
                           ✓   Scalable
                           ✓   Available
                           x   Metadata




Wednesday, June 22, 2011
Logging: Email Collection


                               ✓   Realtime
                               x   Aggregates
                               ✓   History
                               x   Notifications
                               x   Scalable
                               ✓   Available
                               ✓   Metadata


                           (Django provides this out of the box)


Wednesday, June 22, 2011
Logging: Sentry


                                 ✓   Realtime
                                 ✓   Aggregates
                                 ✓   History
                                 ✓   Notifications
                                 ✓   Scalable
                                 ✓   Available
                                 ✓   Metadata


                           http://github.com/dcramer/django-sentry


Wednesday, June 22, 2011
Setting up Sentry (1.x)



                    # setup your server first
                    $ pip install django-sentry
                    $ sentry start

                    # configure your Python (Django in our case) client
                    INSTALLED_APPS = (
                        # ...
                        'sentry.client',
                    )

                    # point the client to the servers
                    SENTRY_REMOTE_URL = ['http://sentry/store/']

                    # visit http://sentry in the browser




Wednesday, June 22, 2011
Setting up Sentry (cont.)


                    # ~/.sentry/sentry.conf.py

                    # use a better database
                    DATABASES = {
                        'default': {
                            'ENGINE': 'postgresql_psycopg2',
                            'NAME': 'sentry',
                            'USER': 'postgres',
                        }
                    }

                    # bind to all interfaces
                    SENTRY_WEB_HOST = '0.0.0.0'

                    # change data paths
                    SENTRY_WEB_LOG_FILE = '/var/log/sentry.log'
                    SENTRY_WEB_PID_FILE = '/var/run/sentry.pid'


Wednesday, June 22, 2011
Sentry (demo time)




Wednesday, June 22, 2011
Wrap Up




Wednesday, June 22, 2011
Getting Started




               •     Package your app
               •     Ease deployment; fast rollbacks
               •     Setup automated tests
               •     Gather some easy metrics




Wednesday, June 22, 2011
Going Further




               •     Build an immune system
                     •     Automate deploys, rollbacks (maybe)
               •     Adjust to your culture
                     •     CD doesn’t “just work”
               •     SOA == great success




Wednesday, June 22, 2011
DISQUS
                             Questions?




                             psst, we’re hiring
                            jobs@disqus.com

Wednesday, June 22, 2011
References



               •     Gargoyle (feature switches)
                     https://github.com/disqus/gargoyle
               •     Sentry (log aggregation)
                     https://github.com/dcramer/django-sentry (1.x)
                     https://github.com/dcramer/sentry (2.x)
               •     Jenkins CI
                     http://jenkins-ci.org/
               •     Mule (distributed test runner)
                     https://github.com/disqus/mule




                                              code.disqus.com
Wednesday, June 22, 2011

More Related Content

What's hot

What does it mean to be a test engineer?
What does it mean to be a test engineer?What does it mean to be a test engineer?
What does it mean to be a test engineer?Andrii Dzynia
 
Continuous Delivery at Netflix, and beyond
Continuous Delivery at Netflix, and beyondContinuous Delivery at Netflix, and beyond
Continuous Delivery at Netflix, and beyondMike McGarr
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentationMack Hardy
 
[오픈소스컨설팅]엔터프라이즈 오픈소스 도입전략
[오픈소스컨설팅]엔터프라이즈 오픈소스 도입전략[오픈소스컨설팅]엔터프라이즈 오픈소스 도입전략
[오픈소스컨설팅]엔터프라이즈 오픈소스 도입전략Ji-Woong Choi
 
Docker containers
Docker containersDocker containers
Docker containersPau López
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperJohn Stevenson
 
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | EdurekaWhat is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | EdurekaEdureka!
 
Understanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree TechnologiesUnderstanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree TechnologiesWalking Tree Technologies
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucketMedhat Dawoud
 
Implementing DevOps Automation: Best Practices & Common Mistakes - DevOps Eas...
Implementing DevOps Automation: Best Practices & Common Mistakes - DevOps Eas...Implementing DevOps Automation: Best Practices & Common Mistakes - DevOps Eas...
Implementing DevOps Automation: Best Practices & Common Mistakes - DevOps Eas...Derek Ashmore
 
Chef for DevOps - an Introduction
Chef for DevOps - an IntroductionChef for DevOps - an Introduction
Chef for DevOps - an IntroductionSanjeev Sharma
 
Best practices for agile design
Best practices for agile designBest practices for agile design
Best practices for agile designIgor Moochnick
 

What's hot (20)

What does it mean to be a test engineer?
What does it mean to be a test engineer?What does it mean to be a test engineer?
What does it mean to be a test engineer?
 
Continuous Delivery at Netflix, and beyond
Continuous Delivery at Netflix, and beyondContinuous Delivery at Netflix, and beyond
Continuous Delivery at Netflix, and beyond
 
Git workflows presentation
Git workflows presentationGit workflows presentation
Git workflows presentation
 
[오픈소스컨설팅]엔터프라이즈 오픈소스 도입전략
[오픈소스컨설팅]엔터프라이즈 오픈소스 도입전략[오픈소스컨설팅]엔터프라이즈 오픈소스 도입전략
[오픈소스컨설팅]엔터프라이즈 오픈소스 도입전략
 
Spring boot
Spring bootSpring boot
Spring boot
 
Docker containers
Docker containersDocker containers
Docker containers
 
DevOps intro
DevOps introDevOps intro
DevOps intro
 
Git and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern DeveloperGit and github - Verson Control for the Modern Developer
Git and github - Verson Control for the Modern Developer
 
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | EdurekaWhat is Jenkins | Jenkins Tutorial for Beginners | Edureka
What is Jenkins | Jenkins Tutorial for Beginners | Edureka
 
What is DevOps? What is DevOps CoE?
What is DevOps? What is DevOps CoE? What is DevOps? What is DevOps CoE?
What is DevOps? What is DevOps CoE?
 
Kubernetes 101
Kubernetes 101Kubernetes 101
Kubernetes 101
 
Introducing DevOps
Introducing DevOpsIntroducing DevOps
Introducing DevOps
 
Continuous Integration vs Continuous Delivery vs Continuous Deployment
Continuous Integration vs Continuous Delivery vs Continuous Deployment Continuous Integration vs Continuous Delivery vs Continuous Deployment
Continuous Integration vs Continuous Delivery vs Continuous Deployment
 
Jpa
JpaJpa
Jpa
 
Understanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree TechnologiesUnderstanding React hooks | Walkingtree Technologies
Understanding React hooks | Walkingtree Technologies
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
 
Implementing DevOps Automation: Best Practices & Common Mistakes - DevOps Eas...
Implementing DevOps Automation: Best Practices & Common Mistakes - DevOps Eas...Implementing DevOps Automation: Best Practices & Common Mistakes - DevOps Eas...
Implementing DevOps Automation: Best Practices & Common Mistakes - DevOps Eas...
 
Introduction to spring boot
Introduction to spring bootIntroduction to spring boot
Introduction to spring boot
 
Chef for DevOps - an Introduction
Chef for DevOps - an IntroductionChef for DevOps - an Introduction
Chef for DevOps - an Introduction
 
Best practices for agile design
Best practices for agile designBest practices for agile design
Best practices for agile design
 

Viewers also liked

Failing Continuous Delivery, JDays, 2015
Failing Continuous Delivery, JDays, 2015Failing Continuous Delivery, JDays, 2015
Failing Continuous Delivery, JDays, 2015Daniel Sawano
 
Code, ci, infrastructure - the gophers way
Code, ci, infrastructure - the gophers wayCode, ci, infrastructure - the gophers way
Code, ci, infrastructure - the gophers wayAlex Baitov
 
Agile Design - Chicago IXDA Presentation
Agile Design - Chicago IXDA PresentationAgile Design - Chicago IXDA Presentation
Agile Design - Chicago IXDA PresentationAlice Toth
 
The Hard Problems of Continuous Deployment
The Hard Problems of Continuous DeploymentThe Hard Problems of Continuous Deployment
The Hard Problems of Continuous DeploymentTimothy Fitz
 
Testing, CI and CD in the real world
Testing, CI and CD in the real worldTesting, CI and CD in the real world
Testing, CI and CD in the real worldRoc Boronat
 
FALCON's Tilt Tray Sorter: A new age in Packet Sorting
FALCON's Tilt Tray Sorter: A new age in Packet SortingFALCON's Tilt Tray Sorter: A new age in Packet Sorting
FALCON's Tilt Tray Sorter: A new age in Packet SortingFalcon Autotech
 
Cloud Application Development Lifecycle
Cloud Application Development LifecycleCloud Application Development Lifecycle
Cloud Application Development LifecycleSuhas Kelkar
 
Lviv PMDay: Дов Німрац Як зробити процес Continuous Integration ефективним
Lviv PMDay: Дов Німрац Як зробити процес Continuous Integration ефективнимLviv PMDay: Дов Німрац Як зробити процес Continuous Integration ефективним
Lviv PMDay: Дов Німрац Як зробити процес Continuous Integration ефективнимLviv Startup Club
 
Training for Third Sector Partners
Training for Third Sector PartnersTraining for Third Sector Partners
Training for Third Sector PartnersPaul McElvaney
 
Loraine Slinn at LP2010
Loraine Slinn at LP2010Loraine Slinn at LP2010
Loraine Slinn at LP2010Paul McElvaney
 
Stunning Photos
Stunning PhotosStunning Photos
Stunning PhotosJennAlm
 
ステルスマーケティングとニュースリリース
ステルスマーケティングとニュースリリースステルスマーケティングとニュースリリース
ステルスマーケティングとニュースリリースMinako Kambara
 
Niver Bah - 22.06.07
Niver Bah - 22.06.07Niver Bah - 22.06.07
Niver Bah - 22.06.07Jubrac Jacui
 
香港六合彩
香港六合彩香港六合彩
香港六合彩wejia
 
Learning Pool Webinar: Brand new new authoring tool templates
Learning Pool Webinar: Brand new new authoring tool templatesLearning Pool Webinar: Brand new new authoring tool templates
Learning Pool Webinar: Brand new new authoring tool templatesPaul McElvaney
 
Webanalytics2.0 sem jvol2
Webanalytics2.0 sem jvol2Webanalytics2.0 sem jvol2
Webanalytics2.0 sem jvol2Sonika Mishra
 
Pondres Social Marketing event 26 oktober
Pondres Social Marketing event 26 oktoberPondres Social Marketing event 26 oktober
Pondres Social Marketing event 26 oktoberSjef Kerkhofs
 

Viewers also liked (20)

Failing Continuous Delivery, JDays, 2015
Failing Continuous Delivery, JDays, 2015Failing Continuous Delivery, JDays, 2015
Failing Continuous Delivery, JDays, 2015
 
Code, ci, infrastructure - the gophers way
Code, ci, infrastructure - the gophers wayCode, ci, infrastructure - the gophers way
Code, ci, infrastructure - the gophers way
 
Agile Design - Chicago IXDA Presentation
Agile Design - Chicago IXDA PresentationAgile Design - Chicago IXDA Presentation
Agile Design - Chicago IXDA Presentation
 
The Hard Problems of Continuous Deployment
The Hard Problems of Continuous DeploymentThe Hard Problems of Continuous Deployment
The Hard Problems of Continuous Deployment
 
Testing, CI and CD in the real world
Testing, CI and CD in the real worldTesting, CI and CD in the real world
Testing, CI and CD in the real world
 
FALCON's Tilt Tray Sorter: A new age in Packet Sorting
FALCON's Tilt Tray Sorter: A new age in Packet SortingFALCON's Tilt Tray Sorter: A new age in Packet Sorting
FALCON's Tilt Tray Sorter: A new age in Packet Sorting
 
Cloud Application Development Lifecycle
Cloud Application Development LifecycleCloud Application Development Lifecycle
Cloud Application Development Lifecycle
 
Lviv PMDay: Дов Німрац Як зробити процес Continuous Integration ефективним
Lviv PMDay: Дов Німрац Як зробити процес Continuous Integration ефективнимLviv PMDay: Дов Німрац Як зробити процес Continuous Integration ефективним
Lviv PMDay: Дов Німрац Як зробити процес Continuous Integration ефективним
 
Training for Third Sector Partners
Training for Third Sector PartnersTraining for Third Sector Partners
Training for Third Sector Partners
 
Loraine Slinn at LP2010
Loraine Slinn at LP2010Loraine Slinn at LP2010
Loraine Slinn at LP2010
 
Stunning Photos
Stunning PhotosStunning Photos
Stunning Photos
 
ステルスマーケティングとニュースリリース
ステルスマーケティングとニュースリリースステルスマーケティングとニュースリリース
ステルスマーケティングとニュースリリース
 
Ana Flickr 101
Ana Flickr 101Ana Flickr 101
Ana Flickr 101
 
Niver Bah - 22.06.07
Niver Bah - 22.06.07Niver Bah - 22.06.07
Niver Bah - 22.06.07
 
香港六合彩
香港六合彩香港六合彩
香港六合彩
 
01.2008 AcampãO
01.2008   AcampãO01.2008   AcampãO
01.2008 AcampãO
 
Learning Pool Webinar: Brand new new authoring tool templates
Learning Pool Webinar: Brand new new authoring tool templatesLearning Pool Webinar: Brand new new authoring tool templates
Learning Pool Webinar: Brand new new authoring tool templates
 
Webanalytics2.0 sem jvol2
Webanalytics2.0 sem jvol2Webanalytics2.0 sem jvol2
Webanalytics2.0 sem jvol2
 
Pondres Social Marketing event 26 oktober
Pondres Social Marketing event 26 oktoberPondres Social Marketing event 26 oktober
Pondres Social Marketing event 26 oktober
 
Para Que Serve O Galego
Para Que Serve O GalegoPara Que Serve O Galego
Para Que Serve O Galego
 

Similar to Pitfalls of Continuous Deployment

Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)zeeg
 
Android 1.5 to 3.0: a compatibility journey
Android 1.5 to 3.0: a compatibility journeyAndroid 1.5 to 3.0: a compatibility journey
Android 1.5 to 3.0: a compatibility journeyEmanuele Di Saverio
 
Donating a mature project to Eclipse
Donating a mature project to EclipseDonating a mature project to Eclipse
Donating a mature project to Eclipseglynnormington
 
Mozilla: Continuous Deploment on SUMO
Mozilla: Continuous Deploment on SUMOMozilla: Continuous Deploment on SUMO
Mozilla: Continuous Deploment on SUMOMatt Brandt
 
Continuous delivery with Jenkins Enterprise and Deployit
Continuous delivery with Jenkins Enterprise and DeployitContinuous delivery with Jenkins Enterprise and Deployit
Continuous delivery with Jenkins Enterprise and DeployitXebiaLabs
 
Building Scalable Web Apps
Building Scalable Web AppsBuilding Scalable Web Apps
Building Scalable Web Appszeeg
 
Continuous Delivery Overview
Continuous Delivery OverviewContinuous Delivery Overview
Continuous Delivery OverviewWill Iverson
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portlanddmethvin
 
Continuous integration for open source distros v 3.0
Continuous integration for open source distros v 3.0Continuous integration for open source distros v 3.0
Continuous integration for open source distros v 3.0Sriram Narayanan
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkinsAbe Diaz
 
Continuous Delivery Using Jenkins
Continuous Delivery Using JenkinsContinuous Delivery Using Jenkins
Continuous Delivery Using JenkinsCliffano Subagio
 
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Jython 2.7 and techniques for integrating with Java - Frank WierzbickiJython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Jython 2.7 and techniques for integrating with Java - Frank Wierzbickifwierzbicki
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using JenkinsRogue Wave Software
 
Running productioninstance 1-localcopy
Running productioninstance 1-localcopyRunning productioninstance 1-localcopy
Running productioninstance 1-localcopyCloudBees
 
DevOps Fest 2020. Kohsuke Kawaguchi. GitOps, Jenkins X & the Future of CI/CD
DevOps Fest 2020. Kohsuke Kawaguchi. GitOps, Jenkins X & the Future of CI/CDDevOps Fest 2020. Kohsuke Kawaguchi. GitOps, Jenkins X & the Future of CI/CD
DevOps Fest 2020. Kohsuke Kawaguchi. GitOps, Jenkins X & the Future of CI/CDDevOps_Fest
 
Quality Assurance in a DevOps World
Quality Assurance in a DevOps WorldQuality Assurance in a DevOps World
Quality Assurance in a DevOps WorldKit Plummer
 
Php com con-2011
Php com con-2011Php com con-2011
Php com con-2011LB Denker
 
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...CloudBees
 

Similar to Pitfalls of Continuous Deployment (20)

Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)Continuous Deployment at Disqus (Pylons Minicon)
Continuous Deployment at Disqus (Pylons Minicon)
 
Hudson
HudsonHudson
Hudson
 
Android 1.5 to 3.0: a compatibility journey
Android 1.5 to 3.0: a compatibility journeyAndroid 1.5 to 3.0: a compatibility journey
Android 1.5 to 3.0: a compatibility journey
 
Donating a mature project to Eclipse
Donating a mature project to EclipseDonating a mature project to Eclipse
Donating a mature project to Eclipse
 
Mozilla: Continuous Deploment on SUMO
Mozilla: Continuous Deploment on SUMOMozilla: Continuous Deploment on SUMO
Mozilla: Continuous Deploment on SUMO
 
Continuous delivery with Jenkins Enterprise and Deployit
Continuous delivery with Jenkins Enterprise and DeployitContinuous delivery with Jenkins Enterprise and Deployit
Continuous delivery with Jenkins Enterprise and Deployit
 
Building Scalable Web Apps
Building Scalable Web AppsBuilding Scalable Web Apps
Building Scalable Web Apps
 
Continuous Delivery Overview
Continuous Delivery OverviewContinuous Delivery Overview
Continuous Delivery Overview
 
State of jQuery June 2013 - Portland
State of jQuery June 2013 - PortlandState of jQuery June 2013 - Portland
State of jQuery June 2013 - Portland
 
Continuous integration for open source distros v 3.0
Continuous integration for open source distros v 3.0Continuous integration for open source distros v 3.0
Continuous integration for open source distros v 3.0
 
Introduction to jenkins
Introduction to jenkinsIntroduction to jenkins
Introduction to jenkins
 
Continuous Delivery Using Jenkins
Continuous Delivery Using JenkinsContinuous Delivery Using Jenkins
Continuous Delivery Using Jenkins
 
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Jython 2.7 and techniques for integrating with Java - Frank WierzbickiJython 2.7 and techniques for integrating with Java - Frank Wierzbicki
Jython 2.7 and techniques for integrating with Java - Frank Wierzbicki
 
Test parallelization using Jenkins
Test parallelization using JenkinsTest parallelization using Jenkins
Test parallelization using Jenkins
 
Running productioninstance 1-localcopy
Running productioninstance 1-localcopyRunning productioninstance 1-localcopy
Running productioninstance 1-localcopy
 
DevOps Fest 2020. Kohsuke Kawaguchi. GitOps, Jenkins X & the Future of CI/CD
DevOps Fest 2020. Kohsuke Kawaguchi. GitOps, Jenkins X & the Future of CI/CDDevOps Fest 2020. Kohsuke Kawaguchi. GitOps, Jenkins X & the Future of CI/CD
DevOps Fest 2020. Kohsuke Kawaguchi. GitOps, Jenkins X & the Future of CI/CD
 
Quality Assurance in a DevOps World
Quality Assurance in a DevOps WorldQuality Assurance in a DevOps World
Quality Assurance in a DevOps World
 
Php com con-2011
Php com con-2011Php com con-2011
Php com con-2011
 
Building XWiki
Building XWikiBuilding XWiki
Building XWiki
 
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
 

More from zeeg

Practicing Continuous Deployment
Practicing Continuous DeploymentPracticing Continuous Deployment
Practicing Continuous Deploymentzeeg
 
Tools for Development and Debugging in Python
Tools for Development and Debugging in PythonTools for Development and Debugging in Python
Tools for Development and Debugging in Pythonzeeg
 
PyCon 2011 Scaling Disqus
PyCon 2011 Scaling DisqusPyCon 2011 Scaling Disqus
PyCon 2011 Scaling Disquszeeg
 
Sentry (SF Python, Feb)
Sentry (SF Python, Feb)Sentry (SF Python, Feb)
Sentry (SF Python, Feb)zeeg
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disquszeeg
 
Db tips & tricks django meetup
Db tips & tricks django meetupDb tips & tricks django meetup
Db tips & tricks django meetupzeeg
 

More from zeeg (6)

Practicing Continuous Deployment
Practicing Continuous DeploymentPracticing Continuous Deployment
Practicing Continuous Deployment
 
Tools for Development and Debugging in Python
Tools for Development and Debugging in PythonTools for Development and Debugging in Python
Tools for Development and Debugging in Python
 
PyCon 2011 Scaling Disqus
PyCon 2011 Scaling DisqusPyCon 2011 Scaling Disqus
PyCon 2011 Scaling Disqus
 
Sentry (SF Python, Feb)
Sentry (SF Python, Feb)Sentry (SF Python, Feb)
Sentry (SF Python, Feb)
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 
Db tips & tricks django meetup
Db tips & tricks django meetupDb tips & tricks django meetup
Db tips & tricks django meetup
 

Recently uploaded

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 

Recently uploaded (20)

Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 

Pitfalls of Continuous Deployment

  • 1. DISQUS Continuous Deployment Everything David Cramer @zeeg Wednesday, June 22, 2011
  • 2. Continuous Deployment Shipping new code as soon as it’s ready (It’s really just super awesome buildbots) Wednesday, June 22, 2011
  • 3. Workflow Commit (master) Integration Failed Build Deploy Reporting Rollback Wednesday, June 22, 2011
  • 4. Pros Cons • Develop features • Culture Shock incrementally • Stability depends on • Release frequently test coverage • Smaller doses of QA • Initial time investment We mostly just care about iteration and stability Wednesday, June 22, 2011
  • 6. Development • Production > Staging > CI > Dev • Automate testing of complicated processes and architecture • Simple > complete • Especially for local development • python setup.py {develop,test} • Puppet, Chef, simple bootstrap.{py,sh} Wednesday, June 22, 2011
  • 7. Production Staging • PostgreSQL • PostgreSQL • Memcache • Memcache • Redis • Redis • Solr • Solr • Apache • Apache • Nginx • Nginx • RabbitMQ • RabbitMQ CI Server Macbook • Memcache • PostgreSQL • PostgreSQL • Apache • Redis • Memcache • Solr • Redis • Apache • Solr • Nginx • Nginx • RabbitMQ • RabbitMQ Wednesday, June 22, 2011
  • 8. Bootstrapping Local • Simplify local setup • git clone dcramer@disqus:disqus.git • ./bootstrap.sh • python manage.py runserver • Need to test dependancies? • virtualbox + vagrant up Wednesday, June 22, 2011
  • 9. “Under Construction” • Iterate quickly by hiding features • Early adopters are free QA from gargoyle import gargoyle def my_view(request): if gargoyle.is_active('awesome', request): return 'new happy version :D' else: return 'old sad version :(' Wednesday, June 22, 2011
  • 10. Gargoyle Deploy features to portions of a user base at a time to ensure smooth, measurable releases Being users of our product, we actively use early versions of features before public release Wednesday, June 22, 2011
  • 11. Conditions in Gargoyle from gargoyle import gargoyle from gargoyle.conditions import ModelConditionSet, Percent, String class UserConditionSet(ModelConditionSet): # percent implicitly maps to ``id`` percent = Percent() username = String() def can_execute(self, instance): return isinstance(instance, User) # register with our main gargoyle instance gargoyle.register(UserConditionSet(User)) Wednesday, June 22, 2011
  • 12. Without Gargoyle SWITCHES = { # enable my_feature for 50% 'my_feature': range(0, 50), } def is_active(switch): try: pct_range = SWITCHES[switch] except KeyError: return False ip_hash = sum([int(x) for x in ip_address.split('.')]) return (ip_hash % 100 in pct_range) If you use Django, use Gargoyle Wednesday, June 22, 2011
  • 13. Integration (or as we like to call it) Wednesday, June 22, 2011
  • 14. Integration is Required Deploy only when things wont break Wednesday, June 22, 2011
  • 15. Setup a Jenkins Build Wednesday, June 22, 2011
  • 17. CI Requirements • Developers must know when they’ve broken something • IRC, Email, IM • Support proper reporting • XUnit, Pylint, Coverage.py • Painless setup • apt-get install jenkins * https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu Wednesday, June 22, 2011
  • 18. Shortcomings • False positives lower awareness • Reporting isn't accurate • Services fail • Bad Tests • Not enough code coverage • Regressions on untested code • Test suite takes too long • Integration tests vs Unit tests • SOA, distribution Wednesday, June 22, 2011
  • 19. Fixing False Positives • Re-run tests several times on a failure • Report continually failing tests • Fix continually failing tests • Rely less on 3rd parties • Mock/Dingus Wednesday, June 22, 2011
  • 20. Maintaining Coverage • Raise awareness with reporting • Fail/alert when coverage drops on a build • Commit tests with code • Coverage against commit di for untested regressions • Drive it into your culture Wednesday, June 22, 2011
  • 21. Speeding Up Tests • Write true unit tests • vs slower integration tests • Mock 3rd party APIs • Distributed and parallel testing • http://github.com/disqus/mule Wednesday, June 22, 2011
  • 22. Mule • Unstable, will change a lot • Mostly Django right now • Generic interfaces for unittest2 • Works with multi-processing and Celery • Full XUnit integration • Simple workflow • mule test --runner="python manage.py mule --worker $TEST" Wednesday, June 22, 2011
  • 24. How DISQUS Does It • Incremental deploy with Fabric • Drop server from pool • Pull in requirements on each server • Isolated virtualenv’s built on each server • Push server back online Wednesday, June 22, 2011
  • 25. How You Can Do It # fabfile.py from fabric.api import * def deploy(revision): # update sources, virtualenv, requirements # ... # copy ``current`` to ``previous`` run('cp -R %(path)s/current %(path)s/previous' % dict( path=env.path, revision=revision, )) # symlink ``revision`` to ``current`` run('ln -fs %(path)s/%(revision)s %(path)s/current' % dict( path=env.path, revision=revision, )) # restart apache run('touch %(path)s/current/django.wsgi') Wednesday, June 22, 2011
  • 26. How YOU Can Do It (cont.) # fabfile.py from fabric.api import * def rollback(revision=None): # move ``previous`` to ``current`` run('mv %(path)s/previous %(path)s/current' % dict( path=env.path, revision=revision, )) # restart apache run('touch %(path)s/current/django.wsgi') Wednesday, June 22, 2011
  • 27. Challenges • PyPi works on server A, but not B • Scale • CPU cost per server • Schema changes, data model changes • Backwards compatibility Wednesday, June 22, 2011
  • 28. PyPi is Down • http://github.com/disqus/chishop Wednesday, June 22, 2011
  • 29. Help, we have 100 servers! • Incremental (ours) vs Fanout • Push vs Pull • Twitter uses BitTorrent • Isolation vs Packaging (Complexity) Wednesday, June 22, 2011
  • 30. SQL Schema Changes 1. Add column (NULLable) 2. Add app code to fill column 3.Deploy 4.Backfill column 5. Add app code to read column 6.Deploy Wednesday, June 22, 2011
  • 31. Updating Caches • Have a global version number • CACHE_PREFIX = 9000 • Have a data model cache version • sha1(cls.__dict__) • Use multiple caches Wednesday, June 22, 2011
  • 34. <You> Why is mongodb-1 down? <Ops> It’s down? Must have crashed again Wednesday, June 22, 2011
  • 35. Meaningful Metrics • Rate of tra c (not just hits!) • Business vs system • Response time (database, web) • Exceptions • Social media • Twitter Wednesday, June 22, 2011
  • 36. Standard Tools Nagios Graphite Wednesday, June 22, 2011
  • 37. Using Graphite # statsd.py # requires python-statsd from pystatsd import Client import socket def with_suffix(key): hostname = socket.gethostname().split('.')[0] return '%s.%s' % (key, hostname) client = Client(host=STATSD_HOST, port=STATSD_PORT) # statsd.incr('key1', 'key2') def incr(*keys): keys = [with_suffix(k) for k in keys]: client.increment(*keys): Wednesday, June 22, 2011
  • 38. Using Graphite (cont.) (Tra c across a cluster of servers) Wednesday, June 22, 2011
  • 39. Logging • Realtime • Aggregates • History • Notifications • Scalable • Available • Metadata Wednesday, June 22, 2011
  • 40. Logging: Syslog ✓ Realtime x Aggregates ✓ History x Notifications ✓ Scalable ✓ Available x Metadata Wednesday, June 22, 2011
  • 41. Logging: Email Collection ✓ Realtime x Aggregates ✓ History x Notifications x Scalable ✓ Available ✓ Metadata (Django provides this out of the box) Wednesday, June 22, 2011
  • 42. Logging: Sentry ✓ Realtime ✓ Aggregates ✓ History ✓ Notifications ✓ Scalable ✓ Available ✓ Metadata http://github.com/dcramer/django-sentry Wednesday, June 22, 2011
  • 43. Setting up Sentry (1.x) # setup your server first $ pip install django-sentry $ sentry start # configure your Python (Django in our case) client INSTALLED_APPS = ( # ... 'sentry.client', ) # point the client to the servers SENTRY_REMOTE_URL = ['http://sentry/store/'] # visit http://sentry in the browser Wednesday, June 22, 2011
  • 44. Setting up Sentry (cont.) # ~/.sentry/sentry.conf.py # use a better database DATABASES = { 'default': { 'ENGINE': 'postgresql_psycopg2', 'NAME': 'sentry', 'USER': 'postgres', } } # bind to all interfaces SENTRY_WEB_HOST = '0.0.0.0' # change data paths SENTRY_WEB_LOG_FILE = '/var/log/sentry.log' SENTRY_WEB_PID_FILE = '/var/run/sentry.pid' Wednesday, June 22, 2011
  • 47. Getting Started • Package your app • Ease deployment; fast rollbacks • Setup automated tests • Gather some easy metrics Wednesday, June 22, 2011
  • 48. Going Further • Build an immune system • Automate deploys, rollbacks (maybe) • Adjust to your culture • CD doesn’t “just work” • SOA == great success Wednesday, June 22, 2011
  • 49. DISQUS Questions? psst, we’re hiring jobs@disqus.com Wednesday, June 22, 2011
  • 50. References • Gargoyle (feature switches) https://github.com/disqus/gargoyle • Sentry (log aggregation) https://github.com/dcramer/django-sentry (1.x) https://github.com/dcramer/sentry (2.x) • Jenkins CI http://jenkins-ci.org/ • Mule (distributed test runner) https://github.com/disqus/mule code.disqus.com Wednesday, June 22, 2011