Top Banner
@nzupan Turbo-boosting your Python development
70

Turbo boosting your python development

Jan 13, 2015

Download

Technology

Nejc Zupan

A talk describing how I use services like Travis CI, Coveralls, Papertrail, DataDog and others to make my life easier and more productive on Plone and Pyramid projects.
Personally, I regard time spent fixing preventable problems and doing routine tasks is time wasted stupidly. I'll show you how you can leverage some of the recently available "cloud" services to cut the amount of routine tasks in your day-to-day work.

This talk is somewhat based on the Travis CI talk I had last year on PloneConf in Arnhem, but extended to include other cloud services.
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Turbo boosting your python development

@nzupan

Turbo-boostingyour Python development

Page 2: Turbo boosting your python development
Page 3: Turbo boosting your python development
Page 4: Turbo boosting your python development
Page 5: Turbo boosting your python development
Page 6: Turbo boosting your python development
Page 7: Turbo boosting your python development
Page 8: Turbo boosting your python development

Problem

Page 9: Turbo boosting your python development

Problem

Pull Request

Page 10: Turbo boosting your python development

Problem

Pull Request

Page 11: Turbo boosting your python development

Problem

Pull Request

Travis build

Page 12: Turbo boosting your python development

Problem

Pull Request

Travis build

Automatic Deployment

Page 13: Turbo boosting your python development

Problem

Pull Request

Travis build

Automatic Deployment

Sentry

Page 14: Turbo boosting your python development

Problem

Pull Request

Travis build

Automatic Deployment

SentryQA

Page 15: Turbo boosting your python development

Problem

Pull Request

Travis build

Automatic Deployment

SentryQA

Datadog

Papertrail

Page 16: Turbo boosting your python development

CODE REPOSITORY

Any DVCS is OK, but I prefer git

Main reason: GitHub’s UI

Page 17: Turbo boosting your python development

CONTINUOUS INTEGRATION

Run your tests often

Preferably on every commit

In a clean environment

Page 18: Turbo boosting your python development

Easy and fun CI for your Python packages

Travis CI

Page 19: Turbo boosting your python development

Hosted Continuous Integration for the Open Source Community

Page 20: Turbo boosting your python development

+

Page 21: Turbo boosting your python development

BUILDS

Page 22: Turbo boosting your python development

SINGLE BUILD

Page 23: Turbo boosting your python development

SINGLE BUILD (CONT.)

Page 24: Turbo boosting your python development

Free for any public GitHub repo

Page 25: Turbo boosting your python development

Private repos supported too!

Page 26: Turbo boosting your python development

Already ran ~8 mio tests for ~78k open-source projects

Page 27: Turbo boosting your python development

Supports:C, C++, Clojure, Erlang, Go, Groovy,

Haskell, Java, JavaScript, Perl, PHP, Python, Ruby, Scala

Page 28: Turbo boosting your python development

Preinstalled DBs:MySQL, PostgreSQL, MongoDB,

CouchDB, Redis, Riak, RabbitMQ, Memcached, Cassandra, Neo4J, ElasticSearch, Kestrel, SQLite3

Page 29: Turbo boosting your python development

GETTING STARTED

Sign in to travis-ci.org with GitHub account

Enable repository

Add .travis.yml to your repository

Push it

Page 30: Turbo boosting your python development

MINIMAL CONFIG

Page 31: Turbo boosting your python development

MORE CONTROL

Page 32: Turbo boosting your python development

PREINSTALLED SERVICES

Page 33: Turbo boosting your python development

HEADLESS TESTING

Page 34: Turbo boosting your python development

BRANCHES

Page 35: Turbo boosting your python development

BUILD NOTIFICATIONS

+ many more

Page 36: Turbo boosting your python development

STATUS IMAGES

Page 38: Turbo boosting your python development

PULL REQUESTS TESTING

Page 39: Turbo boosting your python development
Page 40: Turbo boosting your python development
Page 41: Turbo boosting your python development
Page 42: Turbo boosting your python development

HEROKU: CLOUD APPLICATION PLATFORM

Page 43: Turbo boosting your python development

OUT-OF-THE-BOX

Page 44: Turbo boosting your python development

Add to .travis.yml:

Page 45: Turbo boosting your python development
Page 46: Turbo boosting your python development

AUTO-DEPLOYING PLONE

Page 47: Turbo boosting your python development

SENTRY: CLOUD ERROR REPORTING

Page 48: Turbo boosting your python development

ERROR AGGREGATION

Page 49: Turbo boosting your python development

ERROR CONTEXT

Page 50: Turbo boosting your python development

SENTRY SETUP

Page 51: Turbo boosting your python development

Datadog: cloud monitoring

Page 52: Turbo boosting your python development

Datadog: cloud monitoring

Page 53: Turbo boosting your python development

MUNIN + ...

Page 54: Turbo boosting your python development

... + OPS TWITTER

Page 55: Turbo boosting your python development

OUT-OF-THE-BOX

EVENTS:

Fabric, Chef, Puppet

RSS

GitHub, Pivotal Tracker, Redmine, etc.

Pingdom

Jenkins

HTTP API

METRICS

Nginx & Apache

Amazon AWS & HP Cloud

Cacti & Nagios

PostgreSQL, MySQL, Cassandra, MongoDB, CouchDB, etc.

Haproxy, Varnish, Memcached, RabbitMQ, Solr & ElasticSearch, etc.

Page 56: Turbo boosting your python development

CUSTOM METRICS

$ easy_install dogstatsd-python

from statsd import statsd

stasd.gauge(‘users.active’, 50)

statsd.counter(‘base_edit.rendered’)

statsd.histogram: (‘catalog.query.time’, duration)

statsd.set: (‘users.unique’, user_id)

Page 57: Turbo boosting your python development

CUSTOM APP METRICS

Page 58: Turbo boosting your python development

PAPERTRAIL: CLOUD LOG AGGREGATION

Page 59: Turbo boosting your python development

WHO IS DOWNLOADING?

Page 60: Turbo boosting your python development

BONUS SLIDE: CODE COVERAGE REPORTS

Page 61: Turbo boosting your python development
Page 62: Turbo boosting your python development
Page 63: Turbo boosting your python development
Page 64: Turbo boosting your python development
Page 65: Turbo boosting your python development

Problem

Pull Request

Travis build

Automatic Deployment

SentryQA

Datadog

Papertrail

Page 66: Turbo boosting your python development

bobtemplates.niteoweb

Page 67: Turbo boosting your python development

THE PLONE TEMPLATE

zc.buildout best practices

GenericSetup install profile

Zope 3 browser layer

z3c.jbot overrides folder

static/ resourceDirectory for serving static resources (images, CSS, JS, etc.)

Sphinx documentation

test suite with a solid test coverage

Travis CI integration

Page 68: Turbo boosting your python development

THE PYRAMID TEMPLATE

zc.buildout best practices

SQLite for development, PostgreSQL for production

A sample view with a Chameleon template

A sample DB model

static resources filled with Twitter Bootstrap niceties

Sphinx documentation

Exemplary test suite

Travis CI & Coveralls integration

Heroku continuous deployment

Page 69: Turbo boosting your python development

Try it out:https://github.com/niteoweb/bobtemplates.niteoweb/

Then, let’s generalize it!