部署 Shopware 6 项目时更改仅在几个小时后生效
Changes only take effect after a few hours when deploying Shopware 6 project
我的设置与 here. The only difference is that I'm building the whole project in my pipeline. This runs without problems and the code is deployed to the server without any issues. Deployer creates a new folder for the release and symlinks the "current" folder to this new release. I also make sure to run update commands for the plugins on the target server and clear the cache multiple times. Similar to this deployer recipe 中描述的类似。这一切都顺利进行。
不过,我不知所措的是,对 project/plugins 所做的实际更改可能需要数小时才能显示出来。例如:升级Shopware版本时,部署后管理仍然显示旧版本。
进一步调查我还发现缓存还在写在上一个版本的目录中(或者如果短时间内发生多次部署,则返回几个版本)。
似乎 Shopware/Symfony 正在将“当前”文件夹的符号链接解析为该版本的实际路径,storing/caching 在某处。因此,当发布新版本时,它只是继续使用旧版本的路径。
到目前为止我尝试过的:
将 PROJECT_ROOT 环境变量设置为“当前”文件夹。不幸的是,这会在部署期间 运行ning 数据库迁移时出现问题。
运行部署后的system:update:finish命令。
部署后删除整个缓存目录。
有没有人 运行 遇到过类似的问题并且知道如何解决这个问题?在生产环境中等待新部署到 'kick in' 的时间显然是不可行的。
查看我对 Julien B 评论的回答。原来 opcache 没有正确清除。
I'm using a managed cloud server and I don't have the rights to restart the server via the command line (only via the control panel). Restarting the whole server also seems kind of an overkill. I do have the rights to clear the opcache. It turns out this was the issue. I had already tried it, but for some reason it doesn't always clear the cache correctly, so now I just clear it twice after deployment and the changes take effect.
我的设置与 here. The only difference is that I'm building the whole project in my pipeline. This runs without problems and the code is deployed to the server without any issues. Deployer creates a new folder for the release and symlinks the "current" folder to this new release. I also make sure to run update commands for the plugins on the target server and clear the cache multiple times. Similar to this deployer recipe 中描述的类似。这一切都顺利进行。
不过,我不知所措的是,对 project/plugins 所做的实际更改可能需要数小时才能显示出来。例如:升级Shopware版本时,部署后管理仍然显示旧版本。
进一步调查我还发现缓存还在写在上一个版本的目录中(或者如果短时间内发生多次部署,则返回几个版本)。
似乎 Shopware/Symfony 正在将“当前”文件夹的符号链接解析为该版本的实际路径,storing/caching 在某处。因此,当发布新版本时,它只是继续使用旧版本的路径。
到目前为止我尝试过的:
将 PROJECT_ROOT 环境变量设置为“当前”文件夹。不幸的是,这会在部署期间 运行ning 数据库迁移时出现问题。
运行部署后的system:update:finish命令。
部署后删除整个缓存目录。
有没有人 运行 遇到过类似的问题并且知道如何解决这个问题?在生产环境中等待新部署到 'kick in' 的时间显然是不可行的。
查看我对 Julien B 评论的回答。原来 opcache 没有正确清除。
I'm using a managed cloud server and I don't have the rights to restart the server via the command line (only via the control panel). Restarting the whole server also seems kind of an overkill. I do have the rights to clear the opcache. It turns out this was the issue. I had already tried it, but for some reason it doesn't always clear the cache correctly, so now I just clear it twice after deployment and the changes take effect.