Twelve Factors
This is my summary of twelve factors for building a web app, software as as service. (https://12factor.net/), which is published by Heroku co-founder Adam Wiggins.
-
Codebase: use a version control, which maintains a single codebase per an web app. One codebase can have multiple deployments.
-
Dependencies: use a package manager to declare dependency libraries explicitly and to isolate them.
-
Config: store config in environment variables, in which way config can be in different env. groups (like development, staging, production).
-
Backing services: treat backing services (datastore, messaging, emailing, cashing) as a attached service. They should be detached and attached without any code change.
-
Build, release, run - separate build, release, and run stages. The run stage runs an app by launching the app's process.
-
Processes - an app runs on one or more processes. Each process should be stateless, which means that nothing is shared among processes. Any persistent data must be stored in stateful database.
-
Port Binding - an web app will be served with its own url, as backing services do. In this ways, the app can serve as an backing service for other services.
-
Concurrency - Organizing the same type of workloads to certain process type, scaling be easier when the app grows.
-
Disposability - the app's processes are disposable, which means that they should stop and start its service quickly without interrupting users.
-
Dev/Prod parity - Keep development, staging, and production as similar as possible. The smaller the gap among them is, the easier the project management is.
-
Logs - treat logs as event streams which can be visible in development terminal, or can be captured/written in a log disk so that they can be later analyzed.
-
Admin Processes - One-off administrative or maintenance tasks on an production app should be handy. The One-off admin processes run in an identical environment as the regular long-running processes of the app.