On 06/19/2015 08:43 AM, Sebastian Bergmann wrote: > Scenario: nginx + PHP-FPM / FastCGI. > > The final step of the deployment is updating a symlink to point to the > new version. > > For N <= realpath_cache_ttl seconds after the deployment, some > filesystem operations fail because of outdated realpath cache entries. > > Is there a way to signal the PHP-FPM / FastCGI processes to clear > the realpath cache? If not, I think this should be added :-)
I think this is a symptom of doing deploys incorrectly. If you are
flipping a symlink on a live server which can happen in the middle of a
request then your deploy mechanism is broken.
The web server should set the document_root to the target of the symlink
at the start of a request.
For nginx this is a built-in feature:
fastcgi_param DOCUMENT_ROOT $realpath_root;
For Apache I wrote a module to do it: https://github.com/etsy/mod_realdoc
Then there is never a question of needing to clear any caches at the PHP
level.
See: https://codeascraft.com/2013/07/01/atomic-deploys-at-etsy/
for a more indepth explanation.
-Rasmus
signature.asc
Description: OpenPGP digital signature
