正在进行/部署基础

v1.0.3 2020-08-26 07:45 UTC

This package is auto-updated.

Last update: 2024-09-24 15:35:29 UTC


README

这是一个为部署项目使用的一些常用任务的基类。

开始使用

安装

使用composer安装

composer require ongoing/deployer-base

设置

根据您的symfony版本,将 vendor/ongoing/deployer-base/symfony*.php 文件包含到您的 deployer.php 文件中。

symfony.php // symfony 2.x
symfony3.php // symfony 3.x
symfony4.php // symfony 4.x|5.x

##配置 ###项目特定配置 项目特定配置应放置在您的 deploy.php 文件中。

示例

// application name
set('application', 'application-name');
// source repository
set('repository', 'git@github.com:user/repo.git');
// console path (only if it differs from the default in your symfony version
set('console_path', 'bin/console');

// sentry organisation
set('sentry_organisation', 'oranisation-name');
// sentry project
set('sentry_project', 'sentry-project');

// config name for translation:extract command
set('translation_app_name', 'app');
// locale to extract translations in
set('translation_locale', 'en');

用户特定配置

用户特定配置应在环境变量中定义。

示例

SENTRY_TOKEN=your-token
PRIVATE_KEY=~/.ssh/id_rsa

任务

deployer-base 包含许多任务。以下是一个完整的部署配置示例。

task('deploy', [
    'deploy:info',
    'deploy:prepare',
    'deploy:lock',
    'deploy:release',
    'deploy:update_code',
    'deploy:shared',
    'deploy:vendors',
    'deploy:build:assets', // build assets on the server
    'deploy:writable',
    'translation:extract', // extract tokens
    'deploy:cache:clear',
    'deploy:schema_update', // updates the database schema. Will show a preview and ask for confirmation.
    'deploy:cache:warmup',
    'deploy:symlink',
    'reload:php-fpm', // used on nine servers to clear the fpm cache
    'deploy:unlock',
    'deploy:tag', // tags the current release in your repository
    'deploy:sentry',
    'cleanup',
]);

附加任务

本地构建资源

您可以使用 deploy:build:assets_local 命令来代替 deploy:build:assets 进行本地资源构建。资源将被构建并提交到仓库。

运行数据库迁移

如果您在项目中使用迁移,您可以用 database:migrate 替换 deploy:schema_update