diff --git a/deploy.php b/deploy.php index c72a71a..362cdbb 100644 --- a/deploy.php +++ b/deploy.php @@ -84,7 +84,10 @@ set('http_user', 'myepsf'); // Must stay here: contrib/rsync.php sets the same key, but its __DIR__ is the vendor dir. set('rsync_src', __DIR__); set('rsync', $rsyncOptions); -set('cachetool_args', '--web=SymfonyHttpClient --web-path={{release_or_current_path}}/public/ --web-url={{web_url}}'); +// The web adapter fetches its probe file back through the live docroot, so --web-path must +// be the current symlink, never {{release_or_current_path}}: that one resolves (and memoizes) +// to the new release dir, which the FPM worker's realpath cache does not see yet. +set('cachetool_args', '--web=SymfonyHttpClient --web-path={{current_path}}/public/ --web-url={{web_url}}'); host('prod') ->setHostname('dedi10193.your-server.de') @@ -116,7 +119,12 @@ task('deploy', [ 'deploy:writable', 'deploy:cache:warmup', 'database:migrate', + // Must run before the symlink flip: the cachetool probe file is only reachable through + // the release the docroot currently resolves to. It still pays off, because it drops the + // opcache entries keyed under current/public/*. + 'cachetool:clear:opcache', 'deploy:publish', + 'deploy:stop-workers', ]); // Purely local, so it runs before anything is created on the remote. once(), so @@ -134,7 +142,9 @@ task('deploy:cache:warmup', function () { run('{{bin/console}} cache:warmup {{console_options}}'); }); -// Opcache has to be reset once the new release is actually live. -after('deploy:symlink', 'cachetool:clear:opcache'); +// Workers keep running the previous release's code until they are told to stop. +task('deploy:stop-workers', function () { + run('{{bin/console}} messenger:stop-workers'); +}); after('deploy:failed', 'deploy:unlock');