eureka/component-deployer

基于 Eureka 框架的 PHP 安装器和部署器

3.0.0 2024-03-18 16:24 UTC

This package is auto-updated.

Last update: 2024-09-18 17:33:33 UTC


README

Current version Supported PHP version CI Quality Gate Status Coverage

基于 Eureka 框架的 PHP 安装器和部署器

Composer

composer require "eureka/component-deployer"

使用方法

脚本中依赖注入的 Symfony 配置

parameters:

  eureka.deployer.dir.src:  '/path/to/src'  # where the sources will be installed
  eureka.deployer.dir.www:  '/path/to/www'  # where the symlink on source will be put (link to use in apache/nginx conf)
  eureka.deployer.dir.conf: '/path/to/conf' # where the config with prod secrets are stored

  eureka.deployer.config:
    # Default values
    app.name:   '%app.name%'
    app.tag:    '%app.version%'
    app.domain: 'www.%app.name%.com'

    install:
      #~ Installation steps
      step.start: 0
      step.end:   100

      step.list:
        #~ 0: Start Install (defined in main installation script)
        #~ 1 to 9: reserved for deployed itself
        #~  1: Install composer
        #~  2: Copy secrets files

        #~ Setup some directories
        10: 'Install/Init/Directories'
        11: 'Install/Init/Symlink'

        #~ Yarn / npm
        40: 'Install/Yarn/Install'
        41: 'Install/Yarn/EncoreBuild'

        #~ Cleaning installation files
        70: 'Install/Clean/Files'

        #~ Composer cleaning & install no-dev
        #80: 'Install/Clean/Cache'

        #~ 90 to 99: reserved for deployed itself

        #~  98: Clean cache
        #~  99: Init directory again for production
        #~ 100: Ending installation (defined in main installation script)

      init:
        directories:
          'var/log':   777
          'var/cache': 777

        symlinks:
          '/path/to/upload/': 'web/upload'

      copy:
        #~ list of files to copy, with the format "from: to"
        files:
          '/path/to/conf/{platform}/{domain}/app.yaml':      'config/secrets/app.yaml'
          '/path/to/conf/{platform}/{domain}/database.yaml': 'config/secrets/database.yaml'

      clean:
        files:
          - '.gitignore'
          - 'composer.lock'
          - 'package.json'
          - 'README.md'
          - 'webpack.config.js'
          - 'yarn.lock'
          - 'yarn-error.log'

        directories:
          - 'assets/'
          - 'node_modules/'
          - 'sql/'


services:
  _defaults:
    autowire: true

  Eureka\Component\Deployer\:
    resource: '../../vendor/eureka/component-deployer/src/*'
    exclude:  '../../vendor/eureka/component-deployer/src/{Script}'

  Eureka\Component\Deployer\Script\:
    resource: '../../vendor/eureka/component-deployer/src/Script/*'
    public: true
    calls:
      - setPathBuilder: [ '@Eureka\Component\Deployer\Common\PathBuilder']
      - setRootDir:     [ '%kernel.directory.root%' ]
      - setConfig:      [ '%eureka.deployer.config%' ]

  Eureka\Component\Deployer\Common\PathBuilder:
    arguments:
      $pathSource: '%eureka.deployer.dir.src%'
      $pathLink:   '%eureka.deployer.dir.www%'

控制台命令(在您的应用程序中)

~/my-app/$ bin/console deploy --help

Use    :
php  Eureka\Component\Deployer\Script\Deploy [OPTION]...
OPTIONS:
  -h,     --help                        Reserved - Display Help
  -p ARG, --platform=ARG                Platform where installation is executed (default: "prod")
  -t ARG, --tag=ARG                     Tag version to install (default from config or 1.0.0 if not defined in config)
  -d ARG, --domain=ARG                  Application domain (ie: www.my-app.com) (default from config)
  -n ARG, --name=ARG                    Application name, used to retrieve config (default from config)

贡献

请参阅贡献文件。

安装/更新项目

您可以使用以下命令安装项目

make install

并使用以下命令更新

make update

注意:对于组件,composer.lock 文件未提交。

测试和 CI(持续集成)

测试

您可以使用以下命令在您的本地运行单元测试(带有覆盖率)

make tests

您可以使用以下命令在您的本地运行集成测试(不带覆盖率)

make integration

对于更美观的输出(但不带覆盖率),您可以使用以下命令

make testdox # run tests without coverage reports but with prettified output

代码风格

您还可以使用以下命令运行代码风格检查

make phpcs

您还可以使用以下命令运行代码风格修正

make phpcsf

检查缺失的显式依赖项

您可以使用以下命令检查是否有任何显式依赖项缺失

make deps

静态分析

要执行代码的静态分析(默认使用 phpstan,级别 9),您可以使用以下命令

make analyse

为了确保您的代码与 Deezer 当前支持的版本以及未来的 PHP 版本兼容,您需要运行以下命令(两个都是必需的,以获得完全支持)

最低支持版本

make php81compatibility

最高支持版本

make php83compatibility

CI 模拟

在提交和推送之前,您还可以运行以下“辅助”命令

make ci  

许可证

该项目目前受 MIT 许可证(MIT)许可。有关更多信息,请参阅许可证文件。