friemt/deployer-tasks
Composer 安装命令:
composer require friemt/deployer-tasks
包简介
Additional and enhanced tasks not available for Deployer out of the box.
README 文档
README
Additional and enhanced tasks not available for Deployer out of the box.
Installation
composer require friemt/deployer-tasks
Usage
Either include the recipe or task and the respective configuration to your deployer file.
crontab
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');
variables
| 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 |
tasks
| 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 |
runonce
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');
variables
| 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 |
tasks
| 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 |
template
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');
variables
| 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 |
tasks
| 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 |
cleanup
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');
variables
| variable | description | default |
|---|---|---|
| cleanup_paths | A list of paths, relative to the release dir, which should be removed. | 'var/cache' |
tasks
| task | description |
|---|---|
| cleanup:paths | Checks every release except current for the configured paths and removes them if they exist. |
symlink
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');
variables
| variable | description | default |
|---|---|---|
| symlink_config | list of destination => source pairs. These will be created on deployment | [] |
tasks
| task | description |
|---|---|
| symlink:create | creates the given list of symlinks on deployment |
supervisor
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');
variables
| 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 |
tasks
| task | description |
|---|---|
| supervisor:stop | stops the given list of supervisor task groups |
| supervisor:start | updates and starts the given list of supervisor task groups |
friemt/deployer-tasks 适用场景与选型建议
friemt/deployer-tasks 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 11.49k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2022 年 08 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 friemt/deployer-tasks 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 friemt/deployer-tasks 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 11.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-07