Twelve-Factor WordPress App #9: Disposability
Factor #9: Disposability
Maximize robustness with fast startup and graceful shutdown
The twelve-factor app’s processes are disposable, meaning they can be started or stopped at a moment’s notice. This facilitates fast elastic scaling, rapid deployment of code or config changes, and robustness of production deploys.
Most of this factor is already taken care of by adhering to the other factors, and by default, using PHP-FPM.
In Practice
Processes shut down gracefully when they receive a SIGTERM signal from the process manager. For a web process, graceful shutdown is achieved by ceasing to listen on the service port (thereby refusing any new requests), allowing any current requests to finish, and then exiting.
Thanks to PHP-FPM, this graceful shutdown is handled automatically by the SIGTERM
or QUIT
signal. Graceful restart is also supported by reload
or by sending the USR2
signal.
Turning a WordPress site into a Twelve-Factor App
- Codebase
- Dependencies
- Config
- Backing Services
- Build, release, run
- Processes
- Port binding
- Concurrency
- Disposability
- Dev/prod parity
- Logs
- Admin processes
Want to turn your WordPress site into a Twelve-factor App? Bedrock is a modern WordPress stack to help you get started with the best tools and practices.