{"id":19664578,"url":"https://github.com/sourcebroker/deployer-extended-media","last_synced_at":"2025-06-28T22:42:19.663Z","repository":{"id":57056075,"uuid":"94532515","full_name":"sourcebroker/deployer-extended-media","owner":"sourcebroker","description":"Deployer tasks to manage media synchronization between application instances.","archived":false,"fork":false,"pushed_at":"2023-06-18T14:07:14.000Z","size":80,"stargazers_count":8,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-26T13:42:18.853Z","etag":null,"topics":["deployer","deployments","instances","php","rsync","sb-dem","synchronization"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sourcebroker.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGELOG.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-16T10:14:47.000Z","updated_at":"2023-07-28T09:18:42.000Z","dependencies_parsed_at":"2024-06-18T20:10:16.894Z","dependency_job_id":"23484ef9-9e85-41eb-bae0-7999935f95bf","html_url":"https://github.com/sourcebroker/deployer-extended-media","commit_stats":{"total_commits":84,"total_committers":3,"mean_commits":28.0,"dds":0.04761904761904767,"last_synced_commit":"33e33826196df3f21e09a685089f145afdaff88e"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended-media","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended-media/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended-media/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended-media/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sourcebroker","download_url":"https://codeload.github.com/sourcebroker/deployer-extended-media/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224133770,"owners_count":17261303,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deployer","deployments","instances","php","rsync","sb-dem","synchronization"],"created_at":"2024-11-11T16:18:09.697Z","updated_at":"2025-04-28T21:33:40.611Z","avatar_url":"https://github.com/sourcebroker.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"deployer-extended-media\n=======================\n\n.. image:: https://img.shields.io/packagist/v/sourcebroker/deployer-extended-media.svg?style=flat\n   :target: https://packagist.org/packages/sourcebroker/deployer-extended-media\n\n.. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat\n   :target: https://packagist.org/packages/sourcebroker/deployer-extended-media\n\n|\n\n.. contents:: :local:\n\nWhat does it do?\n----------------\n\nThe package provides additional tasks for deployer (deployer.org) for synchronizing media between instances.\n\nHow this can be useful for me?\n------------------------------\n\nThe most useful is ``dep media:pull [source]`` task which allows you to pull media from source instance to current\ninstance with rsync.\n\nThere are also two additional useful tasks which allows to copy or symlink media between remote instances. For example\nyou can use ``dep media:link [source] --options=target:[target]`` to create symlinks for each single file (equivalent of cp -Rs).\n\nInstallation\n------------\n\n1) Install package with composer:\n   ::\n\n      composer require sourcebroker/deployer-extended-media\n\n2) If you are using deployer as composer package then just put following line in your deploy.php:\n   ::\n\n      new \\SourceBroker\\DeployerLoader\\Load([['path' =\u003e 'vendor/sourcebroker/deployer-extended-media/deployer']]);\n\n3) If you are using deployer as phar then put following lines in your deploy.php:\n   ::\n\n      require_once(__DIR__ . '/vendor/sourcebroker/deployer-loader/autoload.php');\n      new \\SourceBroker\\DeployerLoader\\Load([['path' =\u003e 'vendor/sourcebroker/deployer-extended-media/deployer']]);\n\n   | IMPORTANT NOTE!\n   | Do not put ``require('/vendor/autoload.php')`` inside your deploy.php because you can have dependency problems.\n     Use ``require_once(__DIR__ . '/vendor/sourcebroker/deployer-loader/autoload.php');`` instead as suggested.\n\n4) In deploy.php set the folders you want to synchronize:\n   ::\n\n      set('media_custom',\n          [\n           'filter' =\u003e [\n               '+ /public/',\n               '+ /public/fileadmin/',\n               '- /public/fileadmin/_processed_/*',\n               '+ /public/fileadmin/**',\n               '+ /public/uploads/',\n               '+ /public/uploads/**',\n               '- *'\n          ]\n      ]);\n\n5) Run the task:\n   ::\n\n      dep media:pull [source]\n\nOptions\n-------\n\n- | **exclude**\n  | *default value:* null\n  |\n  | Array with patterns to be excluded.\n\n  |\n- | **exclude-case-insensitive**\n  | *default value:* null\n  |\n  | Array with patterns to be excluded. Because rsync does not support case insensitive then\n    each value of array is set in state uppercase/lowercase. That means if you will have ``['*.mp4', '*.zip']``\n    then final exclude will be ``--exclude '*.[mM][pP]4' --exclude '*.[zZ][iI][pP]'``\n\n  |\n- | **exclude-file**\n  | *default value:* null\n  |\n  | String containing absolute path to file, which contains exclude patterns.\n\n  |\n- | **include**\n  | *default value:* null\n  |\n  | Array with patterns to be included.\n\n  |\n- | **include-file**\n  | *default value:* null\n  |\n  | String containing absolute path to file, which contains include patterns.\n\n  |\n- | **filter**\n  | *default value:* null\n  |\n  | Array of rsync filter rules\n\n  |\n- | **filter-file**\n  | *default value:* null\n  |\n  | String containing merge-file filename.\n\n  |\n- | **filter-perdir**\n  | *default value:* null\n  |\n  | String containing merge-file filename to be scanned and merger per each directory in rsync\n    list offiles to send.\n\n  |\n- | **flags**\n  | *default value:* rz\n  |\n  | Flags added to rsync command.\n\n  |\n- | **options**\n  | *default value:* ['copy-links', 'keep-dirlinks', 'safe-links']\n  |\n  | Array of options to be added to rsync command.\n\n  |\n- | **timeout**\n  | *default value:* 0\n  |\n  | Timeout for rsync task. Zero means no timeout.\n\n\nDefault configuration for task:\n::\n   set('media_default',\n    [\n        'exclude' =\u003e [],\n        'exclude-case-insensitive' =\u003e [\n            '*.mp4',\n            '*.zip',\n            '*.pdf',\n            '*.exe',\n            '*.doc',\n            '*.docx',\n            '*.pptx',\n            '*.ppt',\n            '*.xls',\n            '*.xlsx',\n            '*.xlsm',\n            '*.tiff',\n            '*.tif',\n            '*.potx',\n            '*.mpg',\n            '*.mp3',\n            '*.avi',\n            '*.wmv',\n            '*.flv',\n            '*.eps',\n            '*.ai',\n            '*.mov',\n        ],\n        'exclude-file' =\u003e false,\n        'include' =\u003e [],\n        'include-file' =\u003e false,\n        'filter' =\u003e [],\n        'filter-file' =\u003e false,\n        'filter-perdir' =\u003e false,\n        'flags' =\u003e 'rz',\n        'options' =\u003e ['copy-links', 'keep-dirlinks', 'safe-links'],\n        'timeout' =\u003e 0,\n    ]);\n\n\nIn your deploy.php you should set ``media_custom`` which will be merged with ``media_default`` configuration.\nSee \"Managing the media config\" section to know how to set ``media_custom`` configuration.\n\n\nTasks\n-----\n\nmedia:copy\n++++++++++\n\nCopy media between (remote) instances.\n\n::\n\n    dep media:copy [source] --options=target:[target]\n\nCommands are executed on target remote instance. If instances are placed on the same remote server then rsync on\nlocal files are called. If instances are placed on different remote servers then ``media:pull [source]`` is executed\non target instance.\n\nCopy to instance defined in ``instance_live_name`` (default ``live``) is special case.\nIf you copy to highest instance then by default you will be asked twice if you really want to.\nYou can disable asking by setting ``media_allow_copy_live_force`` to ``true``.\nYou can also forbid coping to live instance by setting ``media_allow_copy_live`` to ``false``.\n\nExample: ``dep media:copy live --options=target:beta``\n\nmedia:link\n++++++++++\n\nOnly for remote instances placed on same machine.\nCommand creates symbolic links on target instance pointing to files on source machine.\n\n::\n\n    media:link [source] --options=target:[target]\n\nFor each file from source instance that does not exist on target instance:\n1. Create directory tree recursively.\n2. Symlink to file from source instance.\n\nSo each file on target instance may be modified / deleted without effect on source.\n\nLinking to instance defined in ``instance_live_name`` (default ``live``) is special case.\nIf you link to highest instance then by default you will be asked twice if you really want to.\nYou can disable asking by setting ``media_allow_link_live_force`` to ``true``.\nYou can also forbid linking to live instance by setting ``media_allow_link_live`` to ``false``.\n\nExample: ``dep media:link live --options=target:beta``\n\nmedia:pull\n++++++++++\n\nPull media from source instance to current instance using rsync and options from media config.\n\n::\n\n    dep media:pull [source]\n\nExample: ``dep media:pull live``\n\nPulling to instance defined in ``instance_live_name`` (default ``live``) is special case.\nIf you pull to highest instance then by default you will be asked twice if you really want to.\nYou can disable asking by setting ``media_allow_pull_live_force`` to ``true``.\nYou can also forbid pulling to live instance by setting ``media_allow_pull_live`` to ``false``.\n\nmedia:push\n++++++++++\n\nPull media from current instance to target instance using rsync and options from media config.\n\n::\n\n    dep media:push [target]\n\nPushing to instance defined in ``instance_live_name`` (default ``live``) is special case.\nIf you push to highest instance then by default you will be asked twice if you really want to.\nYou can disable asking by setting ``media_allow_push_live_force`` to ``true``.\nYou can also forbid pushing to live instance by setting ``media_allow_push_live`` to ``false``.\n\nExample: ``dep media:push beta``\n\n\nManaging the media config\n-------------------------\n\nThe final media config is result of merging three arrays:\n - ``media_default`` (from deployer-extended-media)\n - ``media`` (from deployer-extended-typo3)\n - ``media_custom`` (from user's deploy.php file)\n\nThe merging function has some special features:\n\n1) A special ``__UNSET`` notation is used to remove specific items from array during the merging process.\n2) An empty array will overwrite the array we merge to.\n\nExamples of config final tunning\n++++++++++++++++++++++++++++++++\n\n**Example 1: Removing a specific option**\n\n.. code-block:: php\n\n    set('media_custom', [\n        'options' =\u003e [\n            '__UNSET' =\u003e ['safe-links'],\n        ],\n    ]);\n\nIn the above example, if ``options`` in the ``media_default`` array contained ``['copy-links', 'safe-links']``,\nafter the merge with ``media_custom``, ``options`` would contain only ``['copy-links']``.\n\n\n**Example 2: Removing specific file types from exclusion**\n\n.. code-block:: php\n\n    set('media_custom', [\n        'exclude-case-insensitive' =\u003e [\n            '__UNSET' =\u003e ['*.pdf', '*.exe'],\n        ],\n    ]);\n\nIn this example, ``*.pdf`` and ``*.exe`` are removed from the list of case-insensitive excluded file types.\n\n\n**Example 3: Completely clearing an array and adding one new option**\n\n.. code-block:: php\n\n    set('media_custom', [\n        'exclude-case-insensitive' =\u003e [\n            '__UNSET' =\u003e get('media_default')['exclude-case-insensitive'],\n            '*.mp4'\n        ],\n    ]);\n\nIn this example, ``__UNSET`` is used to completely clear the ``exclude`` array in the ``media_default`` settings and add only ``*.mp4``.\n\nIf you want only to clear you can just set empty array:\n\n.. code-block:: php\n\n    set('media_custom', [\n        'exclude-case-insensitive' =\u003e []\n    ]);\n\n\n**Example 4: Extend existing filter config**\n\n.. code-block:: php\n\n    set('media_custom', [\n        'filter' =\u003e [\n            '__UNSET' =\u003e ['- *'],\n            '+ /' . get('web_path') . 'public/pim/',\n            '+ /' . get('web_path') . 'public/pim/**',\n            '- *',\n        ],\n    ]);\n\nIn this example, ``__UNSET`` is used to remove ``- *`` option from filter array, then adding ``public/pim`` folder\nfor synchronising. Finally putting ``- *`` at end of filter array.\n\n\nChangelog\n---------\n\nSee https://github.com/sourcebroker/deployer-extended-media/blob/master/CHANGELOG.rst\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcebroker%2Fdeployer-extended-media","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsourcebroker%2Fdeployer-extended-media","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcebroker%2Fdeployer-extended-media/lists"}