diff --git a/deploy.php b/deploy.php index 7671c19..8ac8e01 100644 --- a/deploy.php +++ b/deploy.php @@ -4,6 +4,9 @@ namespace Deployer; require 'recipe/typo3.php'; require 'contrib/rsync.php'; +require 'contrib/cachetool.php'; + +set('cachetool_url', 'https://github.com/gordalina/cachetool/releases/download/10.0.0/cachetool.phar'); set('application', 'ep-reisen-typo3-13'); set('keep_releases', 3); @@ -73,6 +76,10 @@ host('prod') ->setDeployPath('/usr/home/eptypo3/public_html/{{application}}') ->set('bin/php', '/usr/bin/php85') ->set('http_user', 'eptypo3') + // The temp script goes into the shared typo3temp/assets, which resolves to the same directory from + // every release: PHP workers with a stale realpath cache still map "current" to the previous release + // and would 404 on a script placed inside the new one. + ->set('cachetool_args', '--web=SymfonyHttpClient --web-path={{deploy_path}}/shared/{{typo3/public_dir}}/typo3temp/assets/ --web-url=https://www.ep-reisen.de/typo3temp/assets') ; task('deploy:build', function () { @@ -114,6 +121,10 @@ task('deploy', [ // Caches belong to the release that goes live, so they are cleared after the symlink flip. Hooking // into deploy:symlink rather than appending to the list above keeps them inside deploy:publish, ahead // of deploy:unlock and deploy:success - a failing cache task must not follow a declared success. +// OPcache first: until it is reset the vhosts keep running the previous release, and the pages it +// renders (with its hashed CSS/JS) would outlive the flush. +after('deploy:symlink', 'cachetool:clear:opcache'); after('deploy:symlink', 'typo3:cache:flush'); // Pages cached by the other release must not survive a rollback +after('rollback', 'cachetool:clear:opcache'); after('rollback', 'typo3:cache:flush');