Skip to content

Symfony-cache is not writable if deployer runs on another user than the httpd  #575

@nemoinho

Description

@nemoinho

I installed and configured deployer on a clean new installation and use different users for deployment and httpd.

So the directories are owned by my deployment-user. Due to the recipe of symfony and symfony3 the cache should be writable for users of the same group but after the cache warmup the prod-directory looks like this (php_deployer is my deployment-user www-data is also in group php_deployer):

drwxrwxrwx 3 php_deployer php_deployer 4096 Mar  8 00:11 .
drwxr-xr-x 4 php_deployer php_deployer 4096 Mar  8 00:11 ..
drwxr-xr-x 6 php_deployer php_deployer 4096 Mar  8 00:11 prod

But to run symfony it has to be

drwxrwxrwx 3 php_deployer php_deployer 4096 Mar  8 00:11 .
drwxr-xr-x 4 php_deployer php_deployer 4096 Mar  8 00:11 ..
drwxrwxr-x 6 php_deployer php_deployer 4096 Mar  8 00:11 prod

I created a workaround for this that looks like this:

/**
 * Make cache writable again after warmup
 */
task('deploy:make_cache_writable', function () {
    run("chmod -R g+w {{cache_dir}}");
})->desc('Make cache writable again');

after('deploy:cache:warmup', 'deploy:make_cache_writable');

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions