I'm seeing errors like these in the Apache error log immediately after deployment and there are HTTP 500 errors:
PHP Fatal error: Uncaught RuntimeException: Failed to write cache file "/var/www/html/app/tmp/twig_cache/6d/6d9137e2293cd0c967ee8ce214a07535e605a8a487340c1fcebb231ae2ef9317.php".
/var/www/html/app
is a symlink to /var/www/app/4.0.0
(outside if the document root). What I'm doing now is preparing the new version in a directory and running this command in the html
directory to go live:
ln --symbolic --directory --force --no-target-directory ../app/4.1.0 app
This worked for a few versions but recently the errors have started to occur, most likely from people who already had the site open prior to the update.
A solution would be to restart the Apache server via systemctl restart httpd
but it can take almost a minute and a half for systemd to restart it, which is problematic during business hours. Apache restarts very quickly on the QA environment so again I assume the delay is caused by waiting for open connections to terminate.
Can someone suggest a better way to deploy the application to avoid this problem?