Skip to main content

Fifteen-Factor App

The Fifteen-Factor guidelines extend Heroku's "12 Factor" with three more factors, and are applied day to day through the operational recommendations detailed below.

The original twelve factors​

12Factor App banner

In June 2011, Adam Wiggins published a set of guidelines on GitHub for designing, building and deploying applications, known as "12 Factor". They set out the guiding principles for developing, shipping and operating web applications and software delivered under the software-as-a-service (SaaS) model.

In June 2013, Heroku forked the repository and has since maintained the official website 12factor.net, translated into several languages, including French.

1. Codebase2. Dependencies3. Config
One codebase tracked in version control, many deploys.Explicitly declare and isolate dependencies.Store config in the environment.
4. Backing services5. Build, release, run6. Processes
Treat backing services as attached resources.Strictly separate build and run stages.Execute the app as one or more stateless processes.
7. Port binding8. Concurrency9. Disposability
Export services via port binding.Scale out via the process model.Maximize robustness with fast startup and graceful shutdown.
10. Dev/prod parity11. Logs12. Admin processes
Keep development, staging and production as similar as possible.Treat logs as event streams.Run admin and management tasks as one-off processes.

Often overlooked, these guidelines are the origin of practices that have since become common: application containerization, popularized by Docker; orchestration and infrastructure as code (IaC), which drove the DevOps movement (i.e. Lean IT); and the continuous deployment operating model GitOps, created by Weaveworks in 2017.

The three additional factors (12+3)​

As cloud adoption grew and microservices became popular, additional guidelines were added as application integration evolved, with real-time processing and cybersecurity gaining importance. Microservices are now event-driven, which lets organizations get value from data through a distributed, just-in-time and reactive architecture.

13. API First14. Telemetry15. Authentication and authorization
Define integration service contracts.Monitor the performance of processes.Secure applications across hardware, network and software layers.

Operationalization​

Applying the original twelve factors, with the associated recommendations.

1. Codebase​

1. Code base

All code and documentation must be managed with version control software (e.g. git):

  • Application = source code
  • Infrastructure = source code
  • Configuration = source code
  • Documentation = source code

2. Dependencies​

2. Dependencies
  • All dependencies must be clearly declared.
  • The target system is not expected to contain any preinstalled programs...

... except the tools required to instantiate the application (Docker, Kubernetes, Cloud-Init, Python, a configuration management agent, etc.).

  • No implicit dependencies. Specify the exact version of the component you want (e.g. SemVer, minor version at minimum).

3. Config​

3. Config
  • Configuration is anything that differs from one environment to another (integration, pre-production, production, another region, etc.).
  • Every configuration item must be passed as an environment variable.

Or through any other mechanism supported by the provisioning tool: metadata, or files mounted or downloaded at startup (Cloud-Init/User-Data, Docker Secrets, Kubernetes ConfigMaps and Secrets, etc.).

  • There must be absolutely no reference to configuration in the code.

4. Backing services​

4. Backing services
  • A backing service is a resource outside the application engine (database, mail server, message queue, distributed cache, enterprise directory, etc.).
  • Access to these resources is configured as described in the Config guideline.
  • No distinction between local and remote services.

Prefer object storage over block or file storage (e.g. the S3 protocol).


5. Build, release, run​

5. Build, Release, Run
  • The application and its environment are rebuilt before every deployment of a new version.
  • No changes are made to the running application.
  • Every deployed release has a unique version identifier (SemVer, date, commit or build number, etc.).

6. Processes​

6. Processes
  • The application runs in the execution environment as one or more stateless processes.
  • All persistent data must be stored as described in the Backing services guideline.
  • User session state must never be stored locally.

7. Port binding​

7. Port binding
  • The application provides a service that listens on a port.
  • Even if the application is not web-oriented, the port must expose a health page so the process can be checked remotely over HTTP (e.g. http://example.com/health).

Use a launcher such as the inet_http_server of Supervisord.


8. Concurrency​

8. Concurrency
  • Each application can be scaled according to traffic or hardware utilization.

Load balancing by default, design for failure.

  • Instances can be started X times, in X locations, to spread the load.
  • No background launching.
  • When the program stops, the instance stops.

Rule enforced by containers in the Open Container Image (OCI)/Docker format.


9. Disposability​

9. Disposability
  • Instances must be disposable.
  • They must therefore be able to start very quickly.
  • An abrupt shutdown must not compromise data integrity (SIGTERM (terminate) rather than SIGKILL (kill)).

Favor microservice architectures based on application containers.


10. Dev/prod parity​

10. Dev/prod parity
  • Developers must be able to quickly deploy the code they just wrote (feedback loop).
  • Developers must be as close as possible to deployment (DevOps).
  • Keep development and production as similar as possible by using the same tools.
  • Avoid using different backing services in production and development, to limit surprises when promoting to production (e.g. database engine type).

11. Logs​

11. Logs
  • Applications must externalize their logs for viewing and long-term archiving (OpenSearch, Loki, Graylog, etc.).
  • Logs may at minimum be written to the application's standard output, but not to a file inside the instance.

12. Admin processes​

12. Admin processes
  • Administrative commands must run in an environment identical to that of the other operational processes.

Only consider remote control through remote procedure calls (e.g. gRPC, RESTful API, SSH, etc.). Favor configuration managers or containers over scripts.

  • Same instance, same environment variables, but in interactive mode.