SlideShare uma empresa Scribd logo
1 de 50
Baixar para ler 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

Mais conteúdo relacionado

Mais procurados

[CB19] アンチウイルスをオラクルとしたWindows Defenderに対する新しい攻撃手法 by 市川遼
[CB19] アンチウイルスをオラクルとしたWindows Defenderに対する新しい攻撃手法 by 市川遼 [CB19] アンチウイルスをオラクルとしたWindows Defenderに対する新しい攻撃手法 by 市川遼
[CB19] アンチウイルスをオラクルとしたWindows Defenderに対する新しい攻撃手法 by 市川遼 CODE BLUE
 
How to Bulletproof Your Scylla Deployment
How to Bulletproof Your Scylla DeploymentHow to Bulletproof Your Scylla Deployment
How to Bulletproof Your Scylla DeploymentScyllaDB
 
Discover Quarkus and GraalVM
Discover Quarkus and GraalVMDiscover Quarkus and GraalVM
Discover Quarkus and GraalVMRomain Schlick
 
SRE and GitOps for Building Robust Kubernetes Platforms.pdf
SRE and GitOps for Building Robust Kubernetes Platforms.pdfSRE and GitOps for Building Robust Kubernetes Platforms.pdf
SRE and GitOps for Building Robust Kubernetes Platforms.pdfWeaveworks
 
BlueStore: a new, faster storage backend for Ceph
BlueStore: a new, faster storage backend for CephBlueStore: a new, faster storage backend for Ceph
BlueStore: a new, faster storage backend for CephSage Weil
 
ARMアーキテクチャにおけるセキュリティ機構の紹介
ARMアーキテクチャにおけるセキュリティ機構の紹介ARMアーキテクチャにおけるセキュリティ機構の紹介
ARMアーキテクチャにおけるセキュリティ機構の紹介sounakano
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System ServerOpersys inc.
 
ASP.NET과 C#으로 개발하는 대규모 소셜 게임
ASP.NET과 C#으로 개발하는 대규모 소셜 게임ASP.NET과 C#으로 개발하는 대규모 소셜 게임
ASP.NET과 C#으로 개발하는 대규모 소셜 게임흥배 최
 
UseNUMA做了什么?(2012-03-14)
UseNUMA做了什么?(2012-03-14)UseNUMA做了什么?(2012-03-14)
UseNUMA做了什么?(2012-03-14)Kris Mok
 
Redis vs Infinispan | DevNation Tech Talk
Redis vs Infinispan | DevNation Tech TalkRedis vs Infinispan | DevNation Tech Talk
Redis vs Infinispan | DevNation Tech TalkRed Hat Developers
 
DTrace Topics: Introduction
DTrace Topics: IntroductionDTrace Topics: Introduction
DTrace Topics: IntroductionBrendan Gregg
 
Scylla Summit 2022: Scylla 5.0 New Features, Part 2
Scylla Summit 2022: Scylla 5.0 New Features, Part 2Scylla Summit 2022: Scylla 5.0 New Features, Part 2
Scylla Summit 2022: Scylla 5.0 New Features, Part 2ScyllaDB
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debuggingHao-Ran Liu
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughBenjamin Zores
 
Keeping Latency Low for User-Defined Functions with WebAssembly
Keeping Latency Low for User-Defined Functions with WebAssemblyKeeping Latency Low for User-Defined Functions with WebAssembly
Keeping Latency Low for User-Defined Functions with WebAssemblyScyllaDB
 

Mais procurados (20)

[CB19] アンチウイルスをオラクルとしたWindows Defenderに対する新しい攻撃手法 by 市川遼
[CB19] アンチウイルスをオラクルとしたWindows Defenderに対する新しい攻撃手法 by 市川遼 [CB19] アンチウイルスをオラクルとしたWindows Defenderに対する新しい攻撃手法 by 市川遼
[CB19] アンチウイルスをオラクルとしたWindows Defenderに対する新しい攻撃手法 by 市川遼
 
How to Bulletproof Your Scylla Deployment
How to Bulletproof Your Scylla DeploymentHow to Bulletproof Your Scylla Deployment
How to Bulletproof Your Scylla Deployment
 
Securefile LOBs
Securefile LOBsSecurefile LOBs
Securefile LOBs
 
Discover Quarkus and GraalVM
Discover Quarkus and GraalVMDiscover Quarkus and GraalVM
Discover Quarkus and GraalVM
 
YARN Federation
YARN Federation YARN Federation
YARN Federation
 
SRE and GitOps for Building Robust Kubernetes Platforms.pdf
SRE and GitOps for Building Robust Kubernetes Platforms.pdfSRE and GitOps for Building Robust Kubernetes Platforms.pdf
SRE and GitOps for Building Robust Kubernetes Platforms.pdf
 
Quarkus k8s
Quarkus   k8sQuarkus   k8s
Quarkus k8s
 
"DevOps > CI+CD "
"DevOps > CI+CD ""DevOps > CI+CD "
"DevOps > CI+CD "
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
BlueStore: a new, faster storage backend for Ceph
BlueStore: a new, faster storage backend for CephBlueStore: a new, faster storage backend for Ceph
BlueStore: a new, faster storage backend for Ceph
 
ARMアーキテクチャにおけるセキュリティ機構の紹介
ARMアーキテクチャにおけるセキュリティ機構の紹介ARMアーキテクチャにおけるセキュリティ機構の紹介
ARMアーキテクチャにおけるセキュリティ機構の紹介
 
Understanding the Android System Server
Understanding the Android System ServerUnderstanding the Android System Server
Understanding the Android System Server
 
ASP.NET과 C#으로 개발하는 대규모 소셜 게임
ASP.NET과 C#으로 개발하는 대규모 소셜 게임ASP.NET과 C#으로 개발하는 대규모 소셜 게임
ASP.NET과 C#으로 개발하는 대규모 소셜 게임
 
UseNUMA做了什么?(2012-03-14)
UseNUMA做了什么?(2012-03-14)UseNUMA做了什么?(2012-03-14)
UseNUMA做了什么?(2012-03-14)
 
Redis vs Infinispan | DevNation Tech Talk
Redis vs Infinispan | DevNation Tech TalkRedis vs Infinispan | DevNation Tech Talk
Redis vs Infinispan | DevNation Tech Talk
 
DTrace Topics: Introduction
DTrace Topics: IntroductionDTrace Topics: Introduction
DTrace Topics: Introduction
 
Scylla Summit 2022: Scylla 5.0 New Features, Part 2
Scylla Summit 2022: Scylla 5.0 New Features, Part 2Scylla Summit 2022: Scylla 5.0 New Features, Part 2
Scylla Summit 2022: Scylla 5.0 New Features, Part 2
 
Linux kernel debugging
Linux kernel debuggingLinux kernel debugging
Linux kernel debugging
 
ABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting WalkthroughABS 2012 - Android Device Porting Walkthrough
ABS 2012 - Android Device Porting Walkthrough
 
Keeping Latency Low for User-Defined Functions with WebAssembly
Keeping Latency Low for User-Defined Functions with WebAssemblyKeeping Latency Low for User-Defined Functions with WebAssembly
Keeping Latency Low for User-Defined Functions with WebAssembly
 

Destaque

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
 

Destaque (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
 

Semelhante a 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
 

Semelhante a 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...
 

Mais de 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
 

Mais de 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
 

Último

Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe中 央社
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024Lorenzo Miniero
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch TuesdayIvanti
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...ScyllaDB
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024Stephen Perrenod
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideStefan Dietze
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxFIDO Alliance
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfFIDO Alliance
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceSamy Fodil
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfFIDO Alliance
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?Paolo Missier
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...ScyllaDB
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxFIDO Alliance
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfFIDO Alliance
 

Último (20)

Portal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russePortal Kombat : extension du réseau de propagande russe
Portal Kombat : extension du réseau de propagande russe
 
WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024WebRTC and SIP not just audio and video @ OpenSIPS 2024
WebRTC and SIP not just audio and video @ OpenSIPS 2024
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
2024 May Patch Tuesday
2024 May Patch Tuesday2024 May Patch Tuesday
2024 May Patch Tuesday
 
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
Event-Driven Architecture Masterclass: Integrating Distributed Data Stores Ac...
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024TopCryptoSupers 12thReport OrionX May2024
TopCryptoSupers 12thReport OrionX May2024
 
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The InsideCollecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
Collecting & Temporal Analysis of Behavioral Web Data - Tales From The Inside
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
ADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptxADP Passwordless Journey Case Study.pptx
ADP Passwordless Journey Case Study.pptx
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
WebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM PerformanceWebAssembly is Key to Better LLM Performance
WebAssembly is Key to Better LLM Performance
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
(Explainable) Data-Centric AI: what are you explaininhg, and to whom?
 
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
Event-Driven Architecture Masterclass: Engineering a Robust, High-performance...
 
Design Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptxDesign Guidelines for Passkeys 2024.pptx
Design Guidelines for Passkeys 2024.pptx
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 

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