Closed dev-rke closed 2 years ago
Good to see that i am not alone with this problem :D Still, no reply?
The touch
function call is used to expire files without physically removing them which would break frontend requests. You are completely right about the owner/group concerns though, which more and more come into the scene when we start doing deployment with different users - which of course should be possible.
We would accept a patch for this as pull request, using the solution proposed by @dev-rke, but with one modification: the file should be written first to a different filename then moved to overwrite the old file, since that removes any possibility that a frontend request might 404 in precisely the microsecond or three it takes to write a normal-sized asset file.
@mkarulin
Still, no reply?
I'm keeping pretty busy with a project that you know and can only take a couple of issues now and then ;)
Hi everyone,
we stumbled upon this issue too. We tried the solution above and found another issue. We are allowed to operate on the VHS caches via CLI but afterwards the webserver user has the same issue for the same reasons. Leading to exception when clearing the cache from the Backend.
Our two cents after some research and fidling around:
We now do our deployments as the web server user by setting the uid and gid of our deployment user. Our hosting service already does this on a per-website-basis for all ssh users anyway.
Setting a user's uid and gid must be done directly in /etc/passwd as root or with sudo.
Hopefully this helps a bit. We understand that it is very setup-specific.
Kind regards, Jona
+1
We have this issue, too.
Hi,
first i'd like to thank you for this very helpful extension - it saved us a lot of time in development.
We are using typo3_console to deploy our TYPO3 applications. To deploy the application we use a special user "deploy" which is in the primary group "www-data". The folders are owned by the deploy user. When we trigger cache:flush via typo3_console, unfortunately the application fails to deploy, because of the asset cache of the vhs extension.
Unfortunately the vhs extensions uses "touch" to reset the timestamp of their temp files, when the cache is flushed. In this case the user permissions are required to be the same as the files are.
I solved this by myself by giving the vhs-assets files the permission "deploy:www-data". But when somebody removes the typo3temp folder, the permission issue comes back.
A collegue of mine solved it by overwriting the AssetService with an own class:
This works, because any user can unlink any files which are not write protected and create files with his own rights. You can reproduce this issue by creating a new Linux user "deploy" with primary group "www-data" and executing the following commands:
Result:
In my opinion the source of the issue is the utime system call:
See this for more details: https://unix.stackexchange.com/questions/64848/cannot-touch-m-a-writable-file
I am not sure if the issue is to be called a bug, but it is an issue which increases complexity of deployments. One solution would be to reset file ownership before clearing caches. Another solution would be to not re-use the typo3temp folder, just remove it and create it from scratch, before running the cache:flush command. A third approach would be to exclude the vhs caches from beeing flushed when using CLI.
Therefore i would appreciate to discuss some ideas to find out a best practice to solve this issue.
To be complete, here is also the stacktrace of typo3_console: