Slide 1

Slide 1 text

Django Apps to Services

Slide 2

Slide 2 text

Craig Kerstiens @craigkerstiens work at @heroku

Slide 3

Slide 3 text

Project A collection of configuration and apps for a particular Website. (per Django Project) Django

Slide 4

Slide 4 text

Project App A collection of configuration and apps for a particular Website. (per Django Project) Django

Slide 5

Slide 5 text

Project App A collection of configuration and apps for a particular Website. A web application that does something. I.e. Weblog, Poll, Ticket system (per Django Project) Django

Slide 6

Slide 6 text

Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table

Slide 7

Slide 7 text

Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table

Slide 8

Slide 8 text

Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table Table App

Slide 9

Slide 9 text

Within Django

Slide 10

Slide 10 text

Project Within Django

Slide 11

Slide 11 text

Project App App App Within Django

Slide 12

Slide 12 text

Project App App App Tickets FAQ FaqCreator Within Django

Slide 13

Slide 13 text

Project App App App Tickets FAQ FaqCreator Within Django cd myproject && find . manage.py requirements.txt settings.py urls.py ./faq/admin.py ./faq/forms.py ./faq/models.py ./faq/urls.py ./faq/views.py ./faqcreator/admin.py ./faqcreator/forms.py ./faqcreator/models.py ./faqcreator/urls.py ./faqcreator/views.py ./tickets/admin.py ./tickets/forms.py ./tickets/models.py ./tickets/urls.py ./tickets/views.py

Slide 14

Slide 14 text

Reusability

Slide 15

Slide 15 text

cd myproject && find . Reusability

Slide 16

Slide 16 text

cd myproject && find . manage.py requirements.txt settings.py urls.py ./faq/admin.py ./faq/forms.py ./faq/models.py ./faq/urls.py ./faq/views.py ./faqcreator/admin.py ./faqcreator/forms.py ./faqcreator/models.py ./faqcreator/urls.py ./faqcreator/views.py ./tickets/admin.py ./tickets/forms.py ./tickets/models.py ./tickets/urls.py ./tickets/views.py Reusability

Slide 17

Slide 17 text

cd myproject && find . cd myproject && find . manage.py requirements.txt settings.py urls.py ./faq/admin.py ./faq/forms.py ./faq/models.py ./faq/urls.py ./faq/views.py ./faqcreator/admin.py ./faqcreator/forms.py ./faqcreator/models.py ./faqcreator/urls.py ./faqcreator/views.py ./tickets/admin.py ./tickets/forms.py ./tickets/models.py ./tickets/urls.py ./tickets/views.py --> Reusability

Slide 18

Slide 18 text

cd myproject && find . manage.py requirements.txt settings.py urls.py cd myproject && find . manage.py requirements.txt settings.py urls.py ./faq/admin.py ./faq/forms.py ./faq/models.py ./faq/urls.py ./faq/views.py ./faqcreator/admin.py ./faqcreator/forms.py ./faqcreator/models.py ./faqcreator/urls.py ./faqcreator/views.py ./tickets/admin.py ./tickets/forms.py ./tickets/models.py ./tickets/urls.py ./tickets/views.py --> Reusability

Slide 19

Slide 19 text

cd myproject && find . manage.py requirements.txt settings.py urls.py cat myproject/requirements.txt cd myproject && find . manage.py requirements.txt settings.py urls.py ./faq/admin.py ./faq/forms.py ./faq/models.py ./faq/urls.py ./faq/views.py ./faqcreator/admin.py ./faqcreator/forms.py ./faqcreator/models.py ./faqcreator/urls.py ./faqcreator/views.py ./tickets/admin.py ./tickets/forms.py ./tickets/models.py ./tickets/urls.py ./tickets/views.py --> Reusability

Slide 20

Slide 20 text

cd myproject && find . manage.py requirements.txt settings.py urls.py cat myproject/requirements.txt faq==0.1 faqcreator==0.1 tickets==0.1 cd myproject && find . manage.py requirements.txt settings.py urls.py ./faq/admin.py ./faq/forms.py ./faq/models.py ./faq/urls.py ./faq/views.py ./faqcreator/admin.py ./faqcreator/forms.py ./faqcreator/models.py ./faqcreator/urls.py ./faqcreator/views.py ./tickets/admin.py ./tickets/forms.py ./tickets/models.py ./tickets/urls.py ./tickets/views.py --> Reusability

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

REUSABILITY means faster features due to DRY (Don’t Repeat Yourself)

Slide 23

Slide 23 text

REUSABILITY means faster features due to DRY (Don’t Repeat Yourself) REUSABILITY does not always mean SCALABILITY or MAINTAINABILITY

Slide 24

Slide 24 text

REUSABILITY means faster features due to DRY (Don’t Repeat Yourself) REUSABILITY does not always mean SCALABILITY or MAINTAINABILITY

Slide 25

Slide 25 text

Project App A collection of configuration and apps for a particular Website. A web application that does something. I.e. Weblog, Poll, Ticket system (per Django Project) Django

Slide 26

Slide 26 text

Project App A collection of configuration and apps for a particular Website. A web application that does something. I.e. Weblog, Poll, Ticket system (per Django Project) Django

Slide 27

Slide 27 text

Project App A collection of configuration and apps for a particular Website. A web application that does something. I.e. Weblog, Poll, Ticket system Django Service Method of communication over the web. Web APIs allow combination of multiple services

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Tech imitate Teams Project App App App Tickets FAQ FaqCreator Company Support Knowledge Base

Slide 30

Slide 30 text

Support Knowledge Base Teams

Slide 31

Slide 31 text

App App Support Knowledge Base Teams Grow

Slide 32

Slide 32 text

App App Support Knowledge Base Billing Teams Grow

Slide 33

Slide 33 text

App App Support Knowledge Base Billing Marketing Teams Grow

Slide 34

Slide 34 text

App App Support Knowledge Base Billing Marketing Analytics Mobile API Front End Social Teams Grow

Slide 35

Slide 35 text

App App App Support Knowledge Base Billing Apps Grow Marketing Analytics Mobile API Front End Social 3 Apps

Slide 36

Slide 36 text

App App App Support Knowledge Base Billing Apps Grow App App App Marketing Analytics Mobile App App App API Front End Social 9 Apps

Slide 37

Slide 37 text

Support Knowledge Base Billing Apps Grow Marketing Analytics Mobile API Front End Social 9 Apps 1 Codebase

Slide 38

Slide 38 text

SOA To the Rescue

Slide 39

Slide 39 text

SOA To the Rescue

Slide 40

Slide 40 text

SOA To the Rescue

Slide 41

Slide 41 text

Defined contract for communicating Service

Slide 42

Slide 42 text

Defined contract for communicating Service $ curl -O $FAQ_API/create/ -X “question=my\ question source=123”

Slide 43

Slide 43 text

In Python

Slide 44

Slide 44 text

In Python data = { ‘question’: “my question”, ‘source’: 123 } requests.POST(os.environ[‘FAQ_API’] + ‘/create/’, data=data)

Slide 45

Slide 45 text

Version Bump data = { ‘question’: “my question”, ‘source’: 123, ‘related’: [456, 789] } requests.POST(os.environ[‘FAQ_API’] + ‘/v2/create’, data=data)

Slide 46

Slide 46 text

Version Bump data = { ‘question’: “my question”, ‘source’: 123, ‘related’: [456, 789] } requests.POST(os.environ[‘FAQ_API’] + ‘/v2/create’, data=data)

Slide 47

Slide 47 text

Version Bump data = { ‘question’: “my question”, ‘source’: 123, ‘related’: [456, 789] } requests.POST(os.environ[‘FAQ_API’] + ‘/v2/create’, data=data) STILL VALID requests.POST(os.environ[‘FAQ_API’] + ‘/v1/create’, data=data)

Slide 48

Slide 48 text

What’s a service Provider API_HOST= http://127.0.0.1

Slide 49

Slide 49 text

What’s a service Provider Endpoint API_HOST= http://127.0.0.1 /v1/create/

Slide 50

Slide 50 text

What’s a service Provider Endpoint API_HOST= http://127.0.0.1 /v1/create/ Contract { ‘question’: ‘foo bar’, ‘source’: 123 }

Slide 51

Slide 51 text

Service App

Slide 52

Slide 52 text

Service App Models Views URLs Provider Endpoint Contract

Slide 53

Slide 53 text

A SERVICE means REUSABILITY and enables SCALABILITY and MAINTAINABILITY

Slide 54

Slide 54 text

A SERVICE means REUSABILITY and enables SCALABILITY and MAINTAINABILITY

Slide 55

Slide 55 text

In the real world

Slide 56

Slide 56 text

In the real world

Slide 57

Slide 57 text

In the real world Install Sentry

Slide 58

Slide 58 text

In the real world Install Sentry Send lots of data

Slide 59

Slide 59 text

In the real world Install Sentry Send lots of data ...........

Slide 60

Slide 60 text

In the real world Install Sentry Send lots of data ........... Crash sentry

Slide 61

Slide 61 text

In the real world Install Sentry Send lots of data ........... Crash sentry ...........

Slide 62

Slide 62 text

In the real world Install Sentry Send lots of data ........... Crash sentry ........... Scale sentry

Slide 63

Slide 63 text

In the real world Install Sentry Send lots of data ........... Crash sentry ........... Scale sentry ...........

Slide 64

Slide 64 text

In the real world Install Sentry Send lots of data ........... Crash sentry ........... Scale sentry ........... Some time later, scale the app you build

Slide 65

Slide 65 text

In the real world Install Sentry Send lots of data ........... Crash sentry ........... Scale sentry ........... Some time later, scale the app you build VS

Slide 66

Slide 66 text

In the real world Install Sentry Send lots of data ........... Crash sentry ........... Scale sentry ........... Some time later, scale the app you build Install Sentry VS

Slide 67

Slide 67 text

In the real world Install Sentry Send lots of data ........... Crash sentry ........... Scale sentry ........... Some time later, scale the app you build Install Sentry Send lots of data to Sentry Service VS

Slide 68

Slide 68 text

In the real world Install Sentry Send lots of data ........... Crash sentry ........... Scale sentry ........... Some time later, scale the app you build Install Sentry Send lots of data to Sentry Service Let David Cramer scale Sentry VS

Slide 69

Slide 69 text

App App App Support Knowledge Base Billing Where to Start App App App Marketing Analytics Mobile App App App API Front End Social

Slide 70

Slide 70 text

App App Support Knowledge Base Billing Where to Start App Marketing Analytics Mobile App API Front End Social

Slide 71

Slide 71 text

No content

Slide 72

Slide 72 text

No content

Slide 73

Slide 73 text

No content

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

No content

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

Service App

Slide 80

Slide 80 text

Service App Models Views URLs Provider Endpoint Contract

Slide 81

Slide 81 text

Take aways

Slide 82

Slide 82 text

Take aways 1. Start non-critical (Cheat) 2. Create services where theres pain 3. Start small

Slide 83

Slide 83 text

Fin. Resources http://www.craigkerstiens.com http://bit.ly/djangoappstoservices http://www.12factor.net