Slide 1

Slide 1 text

lostpropertyhq.com Deployment in a new Cloud Era presentation about shipping and tooling / Created byRach Belaid @rachbelaid

Slide 2

Slide 2 text

Who I am. Python charmer Git Lover PostgreSQL Fan I build web products and love learning something new.

Slide 3

Slide 3 text

Version controle matters!! It keeps the history of the application.

Slide 4

Slide 4 text

Boom! magic rollback! What about servers? How do I version them? Unfortunately I cannot do: g i t r e s e t - - h a r d < p r e v i o u s >

Slide 5

Slide 5 text

What is an application? Is it just code? Or, does it include all its components?

Slide 6

Slide 6 text

This is a talk about shipping release. Warning: There is no silver bullet for all cases.

Slide 7

Slide 7 text

What's a Good release? Self Contained Easy to rollback Fast to deploy Easy to upgrade (less legacy) Easy to duplicate Testable in parallel

Slide 8

Slide 8 text

What's the cloud? Buzzword Flexible resources More resources on demande Pay for what you use

Slide 9

Slide 9 text

What to ship then? Source Code Python package Distribution Package LXC Images

Slide 10

Slide 10 text

Tools Python Wheels FPM Docker Packer Use tools or contribute but don't reinvent the wheel ;)

Slide 11

Slide 11 text

Python Wheels PEP 427 - A wheel is a ZIP-format archive.

Slide 12

Slide 12 text

Example: Create Wheels p i p i n s t a l l w h e e l p i p w h e e l - - w h e e l - d i r = / l o c a l / w h e e l s - r r e q u i r e m e n t s . t x t p i p w h e e l - - w h e e l - d i r = / l o c a l / w h e e l s . / a p p

Slide 13

Slide 13 text

Example: Install Wheels p i p i n s t a l l - - u s e - w h e e l - - n o - i n d e x - - f i n d - l i n k s = h t t p : / / m y f a n c y u r l /

Slide 14

Slide 14 text

Downsides Not self-contained. Just code. Not easy to rollback. Portability.

Slide 15

Slide 15 text

Distro Package via FPM

Slide 16

Slide 16 text

Fundamental Principle: “ IF FPM IS NOT HELPING YOU MAKE PACKAGES EASILY, THEN THERE IS A BUG IN FPM.”

Slide 17

Slide 17 text

Example: Create Package f p m - s p y t h o n - t d e b . / a p p / s e t u p . p y f p m - s d i r - t d e b a p p _ f o l d e r _ w i t h _ v e n v /

Slide 18

Slide 18 text

Upsides Easy to rollback. Make migration easier. Wrap your dependencies.

Slide 19

Slide 19 text

Downsides Not self-contained (enough). Just code. Platform dependant.

Slide 20

Slide 20 text

What about the big picture

Slide 21

Slide 21 text

Application are more complex and not just code they have dependencies!! Redis Postgres System Libs

Slide 22

Slide 22 text

Configuration managment?

Slide 23

Slide 23 text

I love sensible configuration managment Salt Ansible

Slide 24

Slide 24 text

But they are not easy to rollback ... even if you keep it in a VCS. It's not enough.

Slide 25

Slide 25 text

Immutable servers From Credit: Martin Fowler's blog post on Immutable Server

Slide 26

Slide 26 text

Immutable servers To Credit: Martin Fowler's blog post on Immutable Server

Slide 27

Slide 27 text

Versionning Server State!

Slide 28

Slide 28 text

LXC, made easy with Docker

Slide 29

Slide 29 text

What's docker Docker, the Linux Container Runtime, an application to pack, ship and run any application as a lightweight container

Slide 30

Slide 30 text

Why container matter? Content Agnostic Hardware Agnostic Content isolation Automation Separation of duties

Slide 31

Slide 31 text

Get Started g i t c l o n e h t t p s : / / g i t h u b . c o m / d o t c l o u d / d o c k e r . g i t c d d o c k e r v a g r a n t u p v a g r a n t s s h s u d o d o c k e r

Slide 32

Slide 32 text

Docker Awesomeness Versionning Push / Pull Remote/Private Registery Logs Diff REST API Support a docker inside a docker

Slide 33

Slide 33 text

Downsides Kernel version Auto-scalling

Slide 34

Slide 34 text

Images, made easy via Packer packer.io

Slide 35

Slide 35 text

What's packer Packer is a tool for creating identical machine images for multiple platforms from a single source configuration.

Slide 36

Slide 36 text

Simple JSON to describe 3 steps: Provisioning (shell, files, Salt, Chef) Build (AWS, DigitalOcean, VMWare, OpenStack ) Post-Process (Vagrant, Compress)

Slide 37

Slide 37 text

Examples { " b u i l d e r s " : [ { " t y p e " : " a m a z o n - e b s " , " r e g i o n " : " u s - e a s t - 1 " , " s o u r c e _ a m i " : " a m i - e 5 0 e 8 8 8 c " , " i n s t a n c e _ t y p e " : " t 1 . m i c r o " , " s s h _ u s e r n a m e " : " u b u n t u " , " a m i _ n a m e " : " p a c k e r - e x a m p l e { { t i m e s t a m p } } " } ] , " p r o v i s i o n e r s " : [ { " t y p e " : " s h e l l " , " i n l i n e " : [ " e c h o ' I c a n c h a i n P r o v i s i o n e r s ' " ] } , { " t y p e " : " s a l t - m a s t e r l e s s " , " b o o t s t r a p _ a r g s " : " g i t v 0 . 1 6 . 0 " , " l o c a l _ s t a t e _ t r e e " : " p a t h / t o / s t a t e s " , " l o c a l _ p i l l a r _ r o o t s " : " p a t h / t o / p i l l a r " } ] }

Slide 38

Slide 38 text

What to use where There is no rules. They all can play well together (with a shoehorn)

Slide 39

Slide 39 text

private libs, dependencies, pur python apps Wheels

Slide 40

Slide 40 text

Migration, datacenter, no VM FPM

Slide 41

Slide 41 text

Recent Kernel (or patched), datacenter, Cloud Provider Docker

Slide 42

Slide 42 text

Cloud provider, Private Cloud, Virtualized Datacenter: AWS, Digital Ocean. Packer

Slide 43

Slide 43 text

A Final Word. Have Fun and Pick your tools.