12factor

What are the twelve factors that define a good web-app?

Source: https://12factor.net/

  1. Codebase: One codebase tracked in revision control, many deployscodebase-deploys
  2. Dependencies: Explicitly declare and isolate dependencies
    1. Dependency declaration and isolation must always be used together.
  3. Config: Store config in the environment
    1. An app’s config is everything that is likely to vary between deploys (staging, production, developer environments, etc).
    2. The twelve-factor app stores config in environment variables
  4. Backing services: Treat backing services as attached resources
    1. A backing service is any service the app consumes over the network as part of its normal operation.
    2. The code for a twelve-factor app makes no distinction between local and third party services. To the app, both are attached resources, accessed via a URL or other locator/credentials stored in the config.
  5. Build, release, run: Strictly separate build and run stages
  6. Processes: Execute the app as one or more stateless processes
    1. Twelve-factor processes are stateless and share-nothing.
  7. Port binding: Export services via port binding
    1. This is typically implemented by using dependency declaration to add a webserver library to the app
    2. The contract with the execution environment is binding to a port to serve requests.
  8. Concurrency: Scale out via the process modelprocess-types
    1. Twelve-factor app processes should never daemonize or write PID files. Instead, rely on the operating system’s process manager (such as Upstart, a distributed process manager on a cloud platform, or a tool like Foreman in development) to manage output streams, respond to crashed processes, and handle user-initiated restarts and shutdowns.
  9. Disposability: Maximize robustness with fast startup and graceful shutdown
  10. Dev/prod parity: Keep development, staging, and production as similar as possible
    1. The twelve-factor developer resists the urge to use different backing services between development and production.
  11. Logs: Treat logs as event streams
    1. Each running process writes its event stream, unbuffered, to stdout.
  12. Admin processes: Run admin/management tasks as one-off processes

More resources:

  1. The Twelve Factor app: Best Practices for Java Deployment by Joe Kutner (https://www.youtube.com/watch?v=94PxlbuizCU)

Leave a comment