https://github.com/sourcebroker/deployer-extended
General helper tasks for deployments based on deployer.
https://github.com/sourcebroker/deployer-extended
deployer deployer-recipes deployment php sb-de
Last synced: 2 months ago
JSON representation
General helper tasks for deployments based on deployer.
- Host: GitHub
- URL: https://github.com/sourcebroker/deployer-extended
- Owner: sourcebroker
- License: mit
- Created: 2017-02-19T20:18:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2025-04-06T20:19:17.000Z (2 months ago)
- Last Synced: 2025-04-06T21:26:11.345Z (2 months ago)
- Topics: deployer, deployer-recipes, deployment, php, sb-de
- Language: PHP
- Homepage:
- Size: 301 KB
- Stars: 23
- Watchers: 5
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: CHANGELOG.rst
- License: LICENSE.txt
Awesome Lists containing this project
README
deployer-extended
=================.. image:: http://img.shields.io/packagist/v/sourcebroker/deployer-extended.svg?style=flat
:target: https://packagist.org/packages/sourcebroker/deployer-extended.. image:: https://img.shields.io/badge/license-MIT-blue.svg?style=flat
:target: https://packagist.org/packages/sourcebroker/deployer-extended.. contents:: :local:
What does it do?
----------------Library with some additional tasks for deployer (deployer.org).
The project is organized into two main directories:
- ``deployer/``
Contains files (tasks/settings) that are safe to be loaded as until explicitly used they do not affect Deployer.
So even if you use two tasks from ``deployer/`` folder you can load whole directory safely. Tasks are set to
be hidden by default so they will not pollute Deployer task list.- ``includes/``
Contains files that should be included selectively in your deployment process.
Unlike the functionality in the ``deployer/`` directory, these components can override default Deployer functionality
(for example override ``bin/composer`` or ``bin/php`` setting in Deployer).New tasks (``deployer/`` folder)
----------------------------cache
~~~~~cache:clear_php_cli
+++++++++++++++++++This task clears the file status cache, opcache and eaccelerator cache for CLI context.
cache:clear_php_http
++++++++++++++++++++This task clears the file status cache, opcache and eaccelerator cache for HTTP context. It does following:
1) Creates file ``cache_clear_[random].php`` in ``{{deploy_path}}/current`` folder.
2) Fetch this file with selected method - curl / wget / file_get_contents - by default its wget.
3) The file is not removed after clearing cache for reason. It allows to prevent problems with realpath_cache.You must set **public_urls** configuration variable so the script knows the domain it should fetch the php script.
Here is example:::
host('staging')
->setHostname('vm-dev.example.com')
->setRemoteUser('project1')
->set('public_urls', ['https://staging-t3base13.example.com'])
->set('deploy_path', '~/t3base13.example.com/staging');Task configuration variables:
- | **cache:clear_php_http:phpcontent**
| *required:* no
| *type:* string
| *default value:*
::[
'-path "./etc/*"',
],
'translations' => [
'-path "./l10n/*"',
'-path "./modules/*/l10n/*"',
],
'small_images' => [
[ '-path "./media/uploads/*"', '-size -25k' ],
[ '-path "./media/theme/*"', '-size -25k' ],
],
]);set('file_backup_keep', 10);
Config variable *file_backup_packages* stores information about backup packages and files filtering options.
Each package defines filters which will be used in ``find`` command.
First level element are groups which will be concatenated using logical alternative operator operator OR.
If group is array type then group elements will be concatenated using logical conjunction operator.Package *config*:
It is simplest definition.
For this package all files from directory ``./etc/`` will be backuped.Package *translations*:
For this one all files from directory ``./l10n/`` will be backuped.
It will also include files from all ``l10n/`` from "modules" subdirectory.
For example ``modules/cookies/l10``Package *small_images*:
This one will contain all small (smaller than 25kB) files from "media/uploads" and "media/theme".As you can see *file_backup_keep* is set to 10 which means only newest 10 backups per package will be stored.
file:copy_dirs_ignore_existing
++++++++++++++++++++++++++++++Copy directories from previous release except for those directories which already exists in new release.
file:copy_files_ignore_existing
+++++++++++++++++++++++++++++++Copy files from previous release except for those files which already exists in new release.
file:upload_build
+++++++++++++++++++++++++++++++Upload files not defined in ``clear_paths``, ``shared_files``, ``shared_dirs``.
Can be used as good default for uploading build from CI.service
~~~~~~~service:php_fpm_reload
++++++++++++++++++++++Very simple task for php-fpm reloading. There is lot of different ways to reload php-fpm depending on hoster configuration.
The command can look like ``nine-flush-fpm`` (nine.ch hoster), ``killall -9 php-cgi`` (hostpoint.ch hoster) or just more
regular ``sudo service php84-fpm reload``.All you need to do is to add to host configuration ``service_php_fpm_reload_command`` setting with command that should be executed.
Example:
::
host('production')
->setHostname('my.example.com')
->setRemoteUser('deploy')
->set('deploy')
->set('service_php_fpm_reload_command', 'sudo service php84-fpm reload')Then add it also to you deploy flow like ``after('deploy:symlink', 'service:php_fpm_reload');``;
This is not done here as the rule is that ``sourcebroker/deployer-extended`` should not override default Deployer tasks
or settings.Tasks and settings override (``includes/`` folder)
--------------------------------------------------bin/composer
~~~~~~~~~~~~In ``includes/settings/bin_composer.php`` you can find ``bin/composer`` setting override. This implementation has more functionality
compared to default Deployer version. It allows to install specific version of composer and later check if composer
is up to date.- | **composer_version**
| *required:* no
| *default value:* null
|
| Install specific composer version. Use tags. Valid tags are here https://github.com/composer/composer/tags .
|- | **composer_channel**
| *required:* no
| *default value:* stable
|
| Install latest version from channel. Set this variable to '1' or '2' (or 'stable', 'snapshot', 'preview'). Read more on composer docs.
| Default value is ``stable`` which will install latest version of composer.
|- | **composer_channel_autoupdate**
| *required:* no
| *default value:* true
|
| If set then on each deploy the composer is checked for latest version according to ``composer_channel`` settings.
| Default value is ``true``.
|bin/php
~~~~~~~In ``includes/settings/bin_php.php`` you can find ``bin/php`` setting override. This implementation has more functionality
compared to default Deployer version.It works like:
1. It takes as first ``php_version`` if it is set explicitly for host.
2. If ``php_version`` is not set for host then ``composer.json`` file is searched for ``['config']['platform']['php']``
and if not found then for ``['require']['php']``.
3. Values set from point 1 or point 2 are then normalised to 'X.Y' and system is checked for specific PHP binaries
with ``which('phpX.Y')`` and ``which('phpXY')``.
4. If none of ``php_version``, ``['config']['platform']['php']``, ``['require']['php']`` are set then there
is standard check for ``which('php')``.Generally after you include this you can completely forget about ``bin/php`` setting.
releases
~~~~~~~~In ``includes/tasks/releases.php`` you can find ``release`` task override.
This task solves performance problems of original Deployer "releases" task.
Read more at PR added https://github.com/deployphp/deployer/pull/4034Issue has been solved but will be available only in Deployer 8. If you still want it in Deployer 7 then here it is.
Changelog
---------See https://github.com/sourcebroker/deployer-extended/blob/master/CHANGELOG.rst