From 88fac7313ef87a2f99cd377e50c5cb48213e499a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Fromme?= Date: Mon, 26 Oct 2026 08:14:47 +0100 Subject: [PATCH] fix: deploys reset OPcache before flushing the TYPO3 caches, as on TYPO3 10 After a deploy, pages showed unstyled content until the caches were flushed by hand in the backend. Every vhost points at current/public since 2026-10-24 and keeps running the previous release after the switch; pages it renders after the deploy's flush reference that release's hashed CSS/JS, which the new release does not have, and stay in the page cache and as staticfilecache files. As in TYPO3 10's deploy.php, cachetool resets OPcache right after the switch (and after a rollback), before the flush. Its web adapter puts the temp script into the shared typo3temp/assets, which every release resolves to the same directory, and requests it through www.ep-reisen.de. cachetool is pinned to 10.0.0 for PHP 8.5. Co-Authored-By: Claude Opus 5.5 --- deploy.php | 11 +++++++++++ 1 file changed, 11 insertions(+) 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');