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

12 Factor Snake

Nabarun Pal
September 19, 2020

12 Factor Snake

Nabarun Pal

September 19, 2020
Tweet

More Decks by Nabarun Pal

Other Decks in Technology

Transcript

  1. 1. Declarative formats to setup automation 2. Clean contract and

    maximum portability 3. Suitable for deployment on modern cloud platforms 4. Minimizing divergence across deployments 5. Agile scaling without much changes to underlying infrastructure Goals
  2. ➔ Code should always be version controlled ➔ All deploys

    of the app should have the same code ➔ Different versions of the code may exist
  3. ➔ Declare dependencies in requirements.txt or Pipfile depending on your

    choice of tooling ➔ Achieve isolation using virtualenv or Pipenv
  4. <TODO: CODE SNIPPET FROM REPO> ➔ Code should always be

    version control ➔ All deploys of the app should have the same code
  5. ➔ The application should not care about where external resources

    like databases, cache are running ➔ The application should just care about the correct configuration provided to it
  6. ➔ Processes should not share state amongst themselves ➔ They

    should be completely stateless ➔ Any required state needs to be in backing databases
  7. ➔ Publish app as service through ports ➔ Self contained

    and doesn’t need runtime injection of web servers ➔ One application can act as a backing service for another app through URIs
  8. ➔ Processes are first class citizens ➔ Workloads should be

    able scale across machines ➔ NEVER try to do process management yourself - DELEGATE Source: https://12factor.net/concurrency
  9. ➔ Processes should be destroyable at will ➔ Minimal startup

    time ➔ Graceful shutdown on termination signal ➔ Functionality should be idempotent
  10. ➔ Try to bridge gaps in workflow ➔ Development environment

    and deployments should be as similar as possible ➔ Use same services in all environments
  11. ➔ Logs are are chronological event streams ➔ Must be

    written unbuffered to stdout ➔ Log shippers are responsible to collect ➔ Ship to warehouses like Elasticsearch for slicing and dicing
  12. $ createdb todo $ psql todo < schema/schema.sql --- $

    python manage.py migrate ➔ Ad-hoc tasks like database migrations should be run as a separate job ➔ The runtime environment should be same as the main process