Self-Contained Deployment (Rach Belaid)

Notes taken during a presentation given by Rach Belaid at PyConUK

1620 on Friday

Look up immutable server concept

Docker for devs and administration


Vagrant docker


He shows various ways to deploy the docker app

Supervisord used in docker to run many processes

Baby steps approach to moving to docker. Normally one container per process
Isolation / sandbox



Google input

Even finance companies are considering it

Only a young project


1 app = 1 container

What’s the diff

Uses less space,  only store what is necessary

Start instantaneously

Use cases :
Test prod architecture
Can combine with Jenkins CI CD

Can use base images
And then keep the docker configuration file clean

Is command line tool,  but can use other tools to make simpler

Fig is a helpful tool for creating an infrastructure

Possible mention to and Heroku

Almost no down time,  if upgrading a component

Look at mounting volumes for running local dev code

Can use another app to orchestrate the dockers apps

The Twelve-Factor App by Kristian Glass

Notes taken during a talk at PyConUK

#1 one code repo many deploys

#2 what about declaring your dependencies, e.g. gcc compiled items, deply containers

#3 read config from environment

debug flag, db connections etc
avoids secret leakage,
add defaults
make it language independent

populating env – foreman, supervisor (d?), ansible, bash -whatever etc

doismellburning – django app

www.doismellburning. .com?

NB: can be in another repo, just def outside of your app

#4 Loose coupling

#5 build, release (when config gets blended), run

build tip

fpm – builds an os package (ruby, don’t snigger too much – it’s awesome)

run stage needs to be a simple as possibly, do as much work in advance.  e.g. fetch eggs in build, collect static etc

#6 stateless

assume nothing about RAM, persist data to external serices

#7 Port binding:
clean interface, should be able to tell your app a protocol and port and go

#8 Scale out not up, start more processes, don’t daemonise – let the env do it

#9 Stop quick;y, stop nicely

#10 Keep env similar: time, people, tool gap

Deploy more often

-> get people together, devops, …

-> it works on my machine

#11 Treat logs as event streams

Run a log agreegator

one event, one line

=> q. how do you handle exceptions – let the agreegotr handle this, some differently code new lines.

#12 Run admin tasks in your app, eg clean up old sessions, as a django management command not a one off script on some dev machine

Language and framework agnostics