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

  1. Codebase
  2. Dependencies
  3. Config
  4. Backing Services
  5. Build, release, run
  6. Processes
  7. Port binding
  8. Concurrency
  9. Disposability
  10. Dev/prod parity
  11. Logs
  12. 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.

Get our latest updates & occasional tips on building better WordPress sites

Follow @rootswp on Twitter