allestuetsmerweh/php-deploy 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

allestuetsmerweh/php-deploy

Composer 安装命令:

composer require allestuetsmerweh/php-deploy

包简介

Deploy your PHP code to a shared hoster

README 文档

README

Deploy your PHP code, e.g. to a shared hosting.

The only requirement on the deployment destination server is PHP and the ZIP extension.

Usage

  • composer require allestuetsmerweh/php-deploy
  • Create a file Deploy.php, containing a class implementing AbstractDefaultDeploy (or AbstractDeploy)
  • Run PASSWORD=$DEPLOY_PASSWORD php ./Deploy.php --target=host1 --environment=prod --username=$DEPLOY_USERNAME to deploy

Filesystem structure on the deployment destination server

Definitions:

  • $SECRET_ROOT: The root directory for content not to be accessible via HTTP(S).
  • $PUBLIC_ROOT: The root directory for content to be accessible via HTTP(S).
  • $DEPLOY_DIR: The directory name for the deployments. Default: deploy.
  • $RANDOM_DIR: A random name for a directory, which does not exist yet in the parent directory.

Usages:

  • $PUBLIC_ROOT/$RANDOM_DIR/deploy.zip: The zipped contents of the deployment.
  • $PUBLIC_ROOT/$RANDOM_DIR/deploy.php: The script to unzip and install the deployment.
  • $SECRET_ROOT/$DEPLOY_DIR/candidate/: The directory to unzip the deployment to
  • $SECRET_ROOT/$DEPLOY_DIR/live/: The directory where the current deployment is stored
  • $SECRET_ROOT/$DEPLOY_DIR/previous/: The directory where the previous deployment is stored

CI on github.com

Example .github/workflows/deploy-prod.yml:

on:
  push:
    branches:
      - main
name: Deploy:prod
jobs:
  # TODO: Tests

  deploy-prod:
    name: Deploy to my-domain.com
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: shivammathur/setup-php@v2
      with:
        php-version: '8.1'
    - name: Get composer cache directory
      id: composer-cache
      run: echo "::set-output name=dir::$(composer config cache-files-dir)"
    - name: Cache dependencies
      uses: actions/cache@v1
      with:
        path: ${{ steps.composer-cache.outputs.dir }}
        key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
        restore-keys: ${{ runner.os }}-composer-
    - name: Install dependencies
      run: composer install --prefer-dist
    - name: Deploy
      env:
        USERNAME: ${{ secrets.DEPLOY_USERNAME }}
        PASSWORD: ${{ secrets.DEPLOY_PASSWORD }}
      run: php ./Deploy.php --target=host1 --environment=prod --username="$USERNAME"

CI on bitbucket.org

Example bitbucket-pipelines.yml:

image: php:8.1.1
pipelines:
  default:
    - parallel:
      - step:
          name: 'Build and Test'
          script:
            - echo "Your build and test goes here..."
      - step:
          name: 'Lint'
          script:
            - echo "Your linting goes here..."
      - step:
          name: 'Security scan'
          script:
            - echo "Your security scan goes here..."

    - step:
        name: 'Deployment to Production'
        deployment: production
        trigger: 'manual'
        script:
          - apt-get update && apt-get install -y libzip-dev
          - docker-php-ext-install zip
          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
          - composer install
          - PASSWORD=$DEPLOY_PASSWORD php ./Deploy.php --target=host1 --environment=prod --username=$DEPLOY_USERNAME

allestuetsmerweh/php-deploy 适用场景与选型建议

allestuetsmerweh/php-deploy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 34.13k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 12 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「php」 「deploy」 「upload」 「sftp」 「ftp」 「ftps」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 allestuetsmerweh/php-deploy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 allestuetsmerweh/php-deploy 我们能提供哪些服务?
定制开发 / 二次开发

基于 allestuetsmerweh/php-deploy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 34.13k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 22
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-17