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

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

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

allestuetsmerweh/php-deploy

最新稳定版本:2.7.0

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

统计信息

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

GitHub 信息

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

其他信息

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