Anatomy of a deploy
Nine steps.
Only one is irreversible.
Every release is built in an isolated directory and started on its own port. Production switches only after the new version passes its health check, while the previous release continues serving throughout the process.
/srv/apps/my-site/
Production changes at step 7, after the new release has passed its health check on an isolated port. Failures before that point leave the live version untouched; failures afterwards trigger an automatic rollback.