Upgrade to Pro — share decks privately, control downloads, hide ads and more …

The Twelve-Factor App

Kristian Glass
September 20, 2014

The Twelve-Factor App

http://12factor.net/ - what, why, how

From PyCon UK 2014

Kristian Glass

September 20, 2014
Tweet

More Decks by Kristian Glass

Other Decks in Programming

Transcript

  1. $ pip install -r requirements.txt! # …! Downloading/unpacking gevent! Running

    setup.py egg_info for package gevent! # …! gevent/libevent.h:9:19: error: event.h: No such file or directory! # …! error: command 'gcc-4.2' failed with exit status 1 8
  2. How do I populate the environment? • foreman • honcho

    • envdir • supervisor • bash scripts • and more… 15
  3. Build / Release? build :: Code -> Executable! ! release

    :: Config -> Executable -> Release Artefact 20
  4. Example: Building a Django Project $ git clone! $ virtualenv!

    $ pip install -r requirements.txt! $ manage.py collectstatic ! $ fpm 21
  5. What does this mean? •Your app should offer its services

    by some protocol on some port •Self-contained services: run and go 28
  6. Logs as event streams •No logfile / routing / storage

    handling •Spit logs out to stdout •One event, one line 39
  7. What does that mean? •Django management commands are a great

    example •$ python manage.py syncdb! •No private folders of “useful snippets” •Keep them with the app 41
  8. Recap 1. One codebase 2. Dependencies 3. Config in environment

    4. Backing Services 5. Build, release, run 6. Stateless processes 7. Port binding 8. Scale with processes 9. Disposability 10. Dev/prod parity 11. Logs as event stream 12. Admin processes 42