Twelve factors

The twelve-factor application methodology was drafted by developers at Heroku1. The characteristics mentioned in the twelve factors are not specific to cloud provider, platform or language. The factors represent a set of guidelines or best practices for portable, resilient applications for that will thrive in cloud environments (specifically Software as a Service applications).

Here are the twelve factors in brief:

  1. There should be a one-to-one association between a versioned code base(for example a git repository) and a deployed service. The same codebase is used for many deployments.
  2. Services should explicitly declare all dependencies, and should not rely on the presence of system-level tools or libraries.
  3. Configuration that varies between deployment environments should be stored in the environment (specifically in environment variables).
  4. All backing services are treated as attached resources,which are managed(attached and detached) by the execution environment.
  5. The delivery pipeline should have strictly separate stages: build, release, run.
  6. Applications should be deployed as one or more stateless processes.Specifically, transient processes must be stateless and share nothing. Persisted data should be stored in an appropriate backing service.
  7. Self-contained services should make themselves available to other services by listening on a specified port.
  8. Concurrency is achieved by scaling individual processes (horizontal scaling).
  9. Processes must be disposable: fast start up and graceful shutdown behaviors will lead to a more robust and resilient system.
  10. All environments, from local development to production, should be as similar as possible.
  11. Applications should produce logs as event streams (for example writing to stdout and stderr), and trust the execution environment to aggregate streams. 12.If one-off admin tasks are needed, they should be kept in source control and packaged alongside the application, to ensure it is run with the same environment as the application.

These factors do not have to be strictly followed to achieve a good microservice environment; however, keeping them in mind allows us to build portable applications or services that can be built and maintained in continuous delivery environments.

1. “The Twelve-Factor App”, Adam Wiggins, http://12factor.net, 2012

results matching ""

    No results matching ""