Additional and enhanced tasks not available for Deployer out of the box.
composer require friemt/deployer-tasksEither include the recipe or task and the respective configuration to your deployer file.
Syncs configured cronjobs to the target systems.
# deploy.php
# ...
import('recipe/crontab.php');
# or
import('task/crontab.php');
# See `src/examples/crontab.yaml` for a yaml based example file.
import(__DIR__ . '/<path-to-configs>/crontab.yaml');
# When using the task instead of the recipe, add the sync task to the deployment manually:
after('deploy:symlink', 'crontab:sync');| variable | description | default |
|---|---|---|
| bin/crontab | path to the crontab binary on the target system | which crontab |
| crontab_backup | path where the backup should be placed | {{deploy_path}}/.dep/crontab.bak |
| crontab_marker | a string used to identify the deployment across target systems and stages | {{application}} {{crontab_stage}} |
| crontab_stage | a string to differentiate multiple deployments on the same target system | host.labels.stage |
| crontab_user | the user to use with crontabs -u option |
host.remote_user |
| crontab_target_lookup | a list of labels to determine the target systems | host.alias, host.hostname, host.labels.stage |
| task | description |
|---|---|
| crontab:check | checks the target system against the configuration and displays any differences |
| crontab:sync | syncs the configuration to the target system, adding, updating and deleting entries |
Runs a defined command on the target system once and only once.
# deploy.php
# ...
import('recipe/runonce.php');
# or
import('task/runonce.php');
# See `src/examples/runonce.yaml` for a yaml based example file.
import(__DIR__ . '/<path-to-configs>/runonce.yaml');
# When using the task instead of the recipe, add the run task to the deployment manually:
after('deploy:symlink', 'runonce:run');| variable | description | default |
|---|---|---|
| runonce_history | path where the history should be placed | {{deploy_path}}/.dep/runonce_log |
| runonce_target_lookup | a list of labels to determine the target systems | host.alias, host.hostname, host.labels.stage |
| task | description |
|---|---|
| runonce:check | checks the target system against the configuration and displays any differences |
| runonce:run | checks which commands have already run and runs any differences, also retries commands marked for retry |
Copy files to the target system after replacing deployer placeholders.
# deploy.php
# ...
import('recipe/template.php');
# or
import('task/template.php');
# See `src/examples/template.yaml` for a yaml based example file.
import(__DIR__ . '/<path-to-configs>/template.yaml');
# When using the task instead of the recipe, add the sync task to the deployment manually:
after('deploy:symlink', 'template:sync');| variable | description | default |
|---|---|---|
| template_history | path where the history should be placed | {{deploy_path}}/.dep/template_log |
| template_target_lookup | a list of labels to determine the target systems | host.alias, host.hostname, host.labels.stage |
| task | description |
|---|---|
| template:check | checks the target system against the configuration and displays any differences |
| template:sync | syncs the configuration to the target system, adding and updating files |
Remove obsolete files and folders from older releases.
# deploy.php
# ...
import('recipe/cleanup.php');
# or
import('task/cleanup.php');
# When using the task instead of the recipe, add the run task to the deployment manually:
after('deploy', 'cleanup:paths');| variable | description | default |
|---|---|---|
| cleanup_paths | A list of paths, relative to the release dir, which should be removed. | 'var/cache' |
| task | description |
|---|---|
| cleanup:paths | Checks every release except current for the configured paths and removes them if they exist. |
Creates symlinks anywhere on the host from a given list.
# deploy.php
# ...
import('recipe/symlink.php');
# or
import('task/symlink.php');
# When using the task instead of the recipe, add the run task to the deployment manually:
before('deploy:shared', 'symlink:create');| variable | description | default |
|---|---|---|
| symlink_config | list of destination => source pairs. These will be created on deployment | [] |
| task | description |
|---|---|
| symlink:create | creates the given list of symlinks on deployment |
Stop and start task for supervisor to avoid runtime errors during deployment.
# deploy.php
# ...
import('recipe/supervisor.php');
# or
import('task/supervisor.php');
# When using the task instead of the recipe, add the run task to the deployment manually:
before('deploy:publish', 'supervisor:stop');
after('deploy:publish', 'supervisor:start');| variable | description | default |
|---|---|---|
| bin/supervisor | path to the supervisorctl binary on the target system | which supervisorctl |
| supervisor_groups | list of groups to be stopped, updated and started | [] |
| supervisor_use_sudo | whether the commands are rund with sudo | false |
| task | description |
|---|---|
| supervisor:stop | stops the given list of supervisor task groups |
| supervisor:start | updates and starts the given list of supervisor task groups |