{"id":19664592,"url":"https://github.com/sourcebroker/deployer-extended","last_synced_at":"2025-04-07T05:13:15.268Z","repository":{"id":49133389,"uuid":"82486796","full_name":"sourcebroker/deployer-extended","owner":"sourcebroker","description":"General helper tasks for deployments based on deployer.","archived":false,"fork":false,"pushed_at":"2025-04-06T20:19:17.000Z","size":308,"stargazers_count":23,"open_issues_count":2,"forks_count":4,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-06T21:26:11.345Z","etag":null,"topics":["deployer","deployer-recipes","deployment","php","sb-de"],"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-02-19T20:18:54.000Z","updated_at":"2025-04-06T20:19:20.000Z","dependencies_parsed_at":"2024-06-18T18:31:11.160Z","dependency_job_id":"d3ca41dd-b0f4-4afa-a50b-e632c9548875","html_url":"https://github.com/sourcebroker/deployer-extended","commit_stats":{"total_commits":289,"total_committers":4,"mean_commits":72.25,"dds":0.04152249134948094,"last_synced_commit":"db1e95a28db73171a4321bf42973f594510fbd4f"},"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sourcebroker%2Fdeployer-extended/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sourcebroker","download_url":"https://codeload.github.com/sourcebroker/deployer-extended/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247557192,"owners_count":20958037,"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","deployer-recipes","deployment","php","sb-de"],"created_at":"2024-11-11T16:18:17.737Z","updated_at":"2025-04-07T05:13:15.261Z","avatar_url":"https://github.com/sourcebroker.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"deployer-extended\n=================\n\n    .. image:: http://img.shields.io/packagist/v/sourcebroker/deployer-extended.svg?style=flat\n        :target: https://packagist.org/packages/sourcebroker/deployer-extended\n\n    .. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat\n        :target: https://packagist.org/packages/sourcebroker/deployer-extended\n\n.. contents:: :local:\n\nWhat does it do?\n----------------\n\nLibrary with some additional tasks for deployer (deployer.org).\n\nThe project is organized into two main directories:\n\n- ``deployer/``\n\n  Contains files (tasks/settings) that are safe to be loaded as until explicitly used they do not affect Deployer.\n  So even if you use two tasks from ``deployer/`` folder you can load whole directory safely. Tasks are set to\n  be hidden by default so they will not pollute Deployer task list.\n\n- ``includes/``\n\n  Contains files that should be included selectively in your deployment process.\n  Unlike the functionality in the ``deployer/`` directory, these components can override default Deployer functionality\n  (for example override ``bin/composer`` or ``bin/php`` setting in Deployer).\n\nNew tasks (``deployer/`` folder)\n----------------------------\n\ncache\n~~~~~\n\ncache:clear_php_cli\n+++++++++++++++++++\n\nThis task clears the file status cache, opcache and eaccelerator cache for CLI context.\n\ncache:clear_php_http\n++++++++++++++++++++\n\nThis task clears the file status cache, opcache and eaccelerator cache for HTTP context. It does following:\n\n1) Creates file ``cache_clear_[random].php`` in ``{{deploy_path}}/current`` folder.\n2) Fetch this file with selected method - curl / wget / file_get_contents - by default its wget.\n3) The file is not removed after clearing cache for reason. It allows to prevent problems with realpath_cache.\n\nYou must set **public_urls** configuration variable so the script knows the domain it should fetch the php script.\nHere is example:\n\n::\n\n   host('staging')\n    -\u003esetHostname('vm-dev.example.com')\n    -\u003esetRemoteUser('project1')\n    -\u003eset('public_urls', ['https://staging-t3base13.example.com'])\n    -\u003eset('deploy_path', '~/t3base13.example.com/staging');\n\n\nTask configuration variables:\n\n- | **cache:clear_php_http:phpcontent**\n  | *required:* no\n  | *type:* string\n  | *default value:*\n  ::\n\n    \u003c?php\n      clearstatcache(true);\n      if(function_exists('opcache_reset')) opcache_reset();\n      if(function_exists('eaccelerator_clear')) eaccelerator_clear();\n\n  |\n  | Php content that will be put into dynamically created file that should clear the caches.\n  |\n\n- | **public_urls**\n  | *required:* yes\n  | *default value:* none\n  | *type:* array\n  |\n  | Domain used to prepare url to fetch clear cache php file. Its expected to be array so you can put there more than one\n    domain and use it for different purposes but here for this task the first domain will be taken.\n  |\n\n- | **fetch_method**\n  | *required:* no\n  | *default value:* wget\n  | *type:* string\n  |\n  | Can be one of following value:\n  | - curl,\n  | - wget,\n  | - file_get_contents\n  |\n\n- | **cache:clear_php_http:timeout**\n  | *required:* no\n  | *default value:* 15\n  | *type:* integer\n  |\n  | Set the timeout in seconds for fetching php clear cache script.\n  |\n\n\ndeploy\n~~~~~~\n\ndeploy:check_branch\n+++++++++++++++++++\n\nCheck if the branch you want to deploy is different from the branch currently deployed on host. If you have information that\nthe branch on the host is different than the branch you want to deploy then you can take decision to overwrite it or not.\n\ndeploy:check_branch_local\n+++++++++++++++++++++++++\n\nCheck if the branch you are currently checked out on your local is the same branch you want to deploy.\nThe ``deploy.php`` files on both branches can be different and that can influence the deploy process.\n\ndeploy:check_composer_install\n+++++++++++++++++++++++++++++\n\nCheck if there is composer.lock file on current instance and if its there then make dry run for\n``composer install``. If ``composer install`` returns information that some packages needs to be updated\nor installed then it means that probably developer pulled ``composer.lock`` changes from repo but forget\nto make ``composer install``. In that case deployment is stopped to allow developer to update packages,\nmake some test and make deployment then.\n\ndeploy:check_composer_validate\n++++++++++++++++++++++++++++++\n\nCheck if ``composer.lock`` file is up to date with current state of ``composer.json``.\nIn not then deployment is stopped.\n\ndeploy:check_lock\n+++++++++++++++++\n\nChecks for existence of file deploy.lock in root of current instance. If the file deploy.lock is there then\ndeployment is stopped. You can use it for whatever reason you have. Needed mainly if you do development from\nlocal and not from CI.\n\n\nfile\n~~~~\nfile\\:backup\n++++++++++++\n\nCreates backup of files. Single task may perform multiple archivization using defined filters.\nOld ones are deleted after executing this task. Default limit is 5.\n\nConfiguration description\n\n- | **file_backup_packages**\n  | *required:* yes\n  | *default value:* none\n  | *type:* array\n  |\n  | Packages definition\n\n- | **file_backup_keep**\n  | *required:* no\n  | *default value:* 5\n  | *type:* int\n  |\n  | Limit of backups per package\n\nExample configuration:\n::\n\n    set('file_backup_packages', [\n        'config' =\u003e [\n            '-path \"./etc/*\"',\n        ],\n        'translations' =\u003e [\n            '-path \"./l10n/*\"',\n            '-path \"./modules/*/l10n/*\"',\n        ],\n        'small_images' =\u003e [\n            [ '-path \"./media/uploads/*\"', '-size -25k' ],\n            [ '-path \"./media/theme/*\"', '-size -25k' ],\n        ],\n    ]);\n\n    set('file_backup_keep', 10);\n\nConfig variable *file_backup_packages* stores information about backup packages and files filtering options.\nEach package defines filters which will be used in ``find`` command.\nFirst level element are groups which will be concatenated using logical alternative operator operator OR.\nIf group is array type then group elements will be concatenated using logical conjunction operator.\n\nPackage *config*:\nIt is simplest definition.\nFor this package all files from directory ``./etc/`` will be backuped.\n\nPackage *translations*:\nFor this one all files from directory ``./l10n/`` will be backuped.\nIt will also include files from all ``l10n/`` from \"modules\" subdirectory.\nFor example ``modules/cookies/l10``\n\nPackage *small_images*:\nThis one will contain all small (smaller than 25kB) files from \"media/uploads\" and \"media/theme\".\n\nAs you can see *file_backup_keep* is set to 10 which means only newest 10 backups per package will be stored.\n\n\nfile:copy_dirs_ignore_existing\n++++++++++++++++++++++++++++++\n\nCopy directories from previous release except for those directories which already exists in new release.\n\nfile:copy_files_ignore_existing\n+++++++++++++++++++++++++++++++\n\nCopy files from previous release except for those files which already exists in new release.\n\nfile:upload_build\n+++++++++++++++++++++++++++++++\n\nUpload files not defined in ``clear_paths``, ``shared_files``, ``shared_dirs``.\nCan be used as good default for uploading build from CI.\n\n\nservice\n~~~~~~~\n\nservice:php_fpm_reload\n++++++++++++++++++++++\n\nVery simple task for php-fpm reloading. There is lot of different ways to reload php-fpm depending on hoster configuration.\nThe command can look like ``nine-flush-fpm`` (nine.ch hoster), ``killall -9 php-cgi`` (hostpoint.ch hoster) or just more\nregular ``sudo service php84-fpm reload``.\n\nAll you need to do is to add to host configuration ``service_php_fpm_reload_command`` setting with command that should be executed.\n\nExample:\n\n::\n\n host('production')\n   -\u003esetHostname('my.example.com')\n   -\u003esetRemoteUser('deploy')\n   -\u003eset('deploy')\n   -\u003eset('service_php_fpm_reload_command', 'sudo service php84-fpm reload')\n\nThen add it also to you deploy flow like ``after('deploy:symlink', 'service:php_fpm_reload');``;\nThis is not done here as the rule is that ``sourcebroker/deployer-extended`` should not override default Deployer tasks\nor settings.\n\nTasks and settings override (``includes/`` folder)\n--------------------------------------------------\n\nbin/composer\n~~~~~~~~~~~~\n\nIn ``includes/settings/bin_composer.php`` you can find ``bin/composer`` setting override. This implementation has more functionality\ncompared to default Deployer version. It allows to install specific version of composer and later check if composer\nis up to date.\n\n- | **composer_version**\n  | *required:* no\n  | *default value:* null\n  |\n  | Install specific composer version. Use tags. Valid tags are here https://github.com/composer/composer/tags .\n  |\n\n- | **composer_channel**\n  | *required:* no\n  | *default value:* stable\n  |\n  | Install latest version from channel. Set this variable to '1' or '2' (or 'stable', 'snapshot', 'preview'). Read more on composer docs.\n  | Default value is ``stable`` which will install latest version of composer.\n  |\n\n- | **composer_channel_autoupdate**\n  | *required:* no\n  | *default value:* true\n  |\n  | If set then on each deploy the composer is checked for latest version according to ``composer_channel`` settings.\n  | Default value is ``true``.\n  |\n\n\nbin/php\n~~~~~~~\n\nIn ``includes/settings/bin_php.php`` you can find ``bin/php`` setting override. This implementation has more functionality\ncompared to default Deployer version.\n\nIt works like:\n\n1. It takes as first ``php_version`` if it is set explicitly for host.\n2. If ``php_version`` is not set for host then ``composer.json`` file is searched for ``['config']['platform']['php']``\n   and if not found then for ``['require']['php']``.\n3. Values set from point 1 or point 2 are then normalised to 'X.Y' and system is checked for specific PHP binaries\n   with ``which('phpX.Y')`` and ``which('phpXY')``.\n4. If none of ``php_version``,  ``['config']['platform']['php']``,  ``['require']['php']`` are set then there\n   is standard check for ``which('php')``.\n\nGenerally after you include this you can completely forget about ``bin/php`` setting.\n\n\nreleases\n~~~~~~~~\n\nIn ``includes/tasks/releases.php`` you can find ``release`` task override.\n\nThis task solves performance problems of original Deployer \"releases\" task.\nRead more at PR added https://github.com/deployphp/deployer/pull/4034\n\nIssue has been solved but will be available only in Deployer 8. If you still want it in Deployer 7 then here it is.\n\n\nChangelog\n---------\n\nSee https://github.com/sourcebroker/deployer-extended/blob/master/CHANGELOG.rst\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcebroker%2Fdeployer-extended","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsourcebroker%2Fdeployer-extended","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsourcebroker%2Fdeployer-extended/lists"}