Skip to content

Allow to adjust ownership during sync #3006

Description

@phoenix-bjoern

When syncing files from local to remote it might be necessary to change the ownership. A process in the pod might not be able to access/modify a file if the ownership/permission locally is not as expected (e.g. "root" instead of "nginx").

It would be wonderful if devspace could adjust ownership (and maybe permissions) of files being uploaded according to a configuration. The configuration could be extended, e.g.:

    sync:
    # Map the local path "./" (= local working directory / project root) to the container path "/app"
    - path: ./:/app
      owner: nginx:nginx
      permissions: 0755
      excludePaths:
      - node_modules/

IMHO downloaded files shouldn't be a problem as they get created in the user context anyway. So, I think the problem really only applies to uploaded files.

As a workaround one could already configure commands like this:

      name: magento-root
    sync:
      - path: src:/var/www/html
        initialSync: preferLocal
        onUpload:
          exec:
            - command: |-
                chmod -R nginx:nginx /var/www/html/media
              onChange: ["media"]

However, executing these commands can become resource intensive when applied on large directories. I think if there would be an option to only apply the command on the synced file only it might work.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions