部署Symfony3 Web应用程序时的Jenkins权限(清除缓存)

部署Symfony3 Web应用程序时的Jenkins权限(清除缓存)

问题描述:

I'm deploying a Symfony3 application via Jenkins on Ubuntu. I'm clearing the cache by running the cache:clear --env=prod command after all the other commands (using shell command in Jenkins).

After clearing the owner of the new cache files is Jenkins, so my Symfony3 application does not load via browser telling me it has no permission to work with the cache and logs folders.

How can I make Jenkins clearing the cache and return the folders owner to www-data?

我正在Ubuntu上通过Jenkins部署Symfony3应用程序。 我在所有其他命令之后运行 cache:clear --env = prod code>命令清除缓存(在Jenkins中使用shell命令)。 p>

之后 清除新缓存文件的所有者是Jenkins,所以我的Symfony3应用程序不会通过浏览器加载,告诉我它没有权限使用缓存和日志文件夹。 p>

我如何制作 Jenkins清除缓存并将文件夹所有者返回到www-data? p> div>

I don't use Jenkins but if you make a mini shell script with :

chown -R root:www-data /var/www/xxx

And you run it at the end of your installation ?

The answer is: you should discover for yourself setfacl in linux. It allows you to add users and groups for read, write and execute. Solved all the problems for me. No more owner problems.