Skip to content

Instantly share code, notes, and snippets.

@al-the-x
Created February 7, 2014 19:11
Show Gist options
  • Save al-the-x/8869693 to your computer and use it in GitHub Desktop.
Save al-the-x/8869693 to your computer and use it in GitHub Desktop.
Tips from @rasmus about atomic deployments...

The only way to have atomic (code) deploys:

  • Don't copy files into current document root
  • Let existing requests finish on old code
  • New requests start on new code
  • Avoid clearing your opcode cache
  • Minimal impact on production traffic

Breakdown:

  • two DOCUMENT_ROOT directories: A & B
  • symlink DOCUMENT_ROOT toggles between them
  • use realpath() symlink at the web server level
  • set DOCUMENT_ROOT to symlinked realpath
  • never hardcode DOCUMENT_ROOT in code

How do you do that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment