定制 bolt/simple-deploy 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

bolt/simple-deploy

Composer 安装命令:

composer require bolt/simple-deploy

包简介

A simple tool to deploy a site build from a local workstation to a (S)FTP enabled host.

README 文档

README

To use this tool, on your development machine only you can create a file named .deploy.yml.

Each key in the .deploy.yml represents a deployment target that can be uploaded to via either FTP or SFTP (secure FTP).

Every deployment configuration you add to .deploy.yml must set the protocol to either ftp or sftp, and an options array.

NOTE: If your host provides SFTP, it is the preferred upload method as it is both faster and more secure than FTP alone, and supports more functionality.

Command Usage

    php app/nut setup:deploy [options] <target>

Arguments

Value Description
target Name of the deployment setting to use from .deploy.yml

Options

Value Description
--check Only check the connection settings for a given deployment
--edit Interactively create or edit a deployment configuration

Example: Editing or creating a connection

    php app/nut setup:deploy --edit production

Example: Checking a connection

    php app/nut setup:deploy --check production

Example: Running a deployment

    php app/nut setup:deploy production

Configuration File

Configuration is done in a .deploy.yml file in the site's root directory on your development environment, with the following format:

staging:
    protocol:
    options:
        host:
        root:
        username:
        …

FTP Options

Options

Key Description
host DNS host name to upload to
root The root directory of the remote site. Can be an absolute path, or if missing a trailing / it will be assumed to be a subdirectory of the remote user's home directory
username User name to login to the remote host with
password (optional) Password to login to the remote host with
port (optional) Port number to connect to if the target is not listening on the default
ssl (optional) Connect to the FTP target host over a secure SSL-FTP connection
timeout (optional) Time in seconds to wait for a connection attempt
transferMode (optional) The transfer mode. Must be either ASCII or BINARY
utf8 (optional) Set the connection to UTF-8 mode
passive (optional) Force FTP to use "passive" mode
ignorePassiveAddress (optional) Ignore the IP address returned when setting up a passive connection. Useful if a server is behind a NAT device. Requires PHP >= 5.6.18

Example

staging:
    protocol: ftp
    options:
        host: example.com
        root: my-site
        username: deploy
        password: 'your password goes here'

NOTE: In the above example, the root directory is a subdirectory of the remote user's home directory called my-site/, e.g. /home/deploy/my-site/.

SFTP Options

Options

Key Description
host DNS host name to upload to
root The root directory of the remote site. Can be an absolute path, or if missing a trailing / it will be assumed to be a subdirectory of the remote user's home directory
username User name to login to the remote host with
password (optional) Password to login to the remote host with
privateKey (optional) Full path to private key file to for key exchange if not using password authentication
useAgent (optional) Set to true if using a private key, and you don't want to use the system SSH agent
port (optional) Port number to connect to if the target is not listening on the default
timeout (optional) Time in seconds to wait for a connection attempt
hostFingerprint (optional) The public key fingerprint of the deployment target

NOTE: Either a password or privateKey must be set.

Example: Password Login

production:
    protocol: sftp
    options:
        host: example.com
        username: deploy
        password: 'your password goes here'
        root: /var/www/sites/example.com

Example: Key-Based Login

production:
    protocol: sftp
    options:
        host: example.com
        username: deploy
        privateKey: /home/your_home_dir/.ssh/id_rsa
        root: /var/www/sites/example.com

Setting Permissions

You can control the permissions of newly created files and directories by adding a permissions key under options.

By default, Simple Deploy will set files to 0664 and directories to 0775, but if you need less restricted permissions (not recommended) you can set them like:

    options:
        permissions:
            file: 0666
            dir: 0777

Of course more secure values are also possible and recommended.

Editing

A very simple editor is also available by adding the --edit option to the command.

php app/nut setup:deploy --edit <target>

Example: Editing the configuration for the "production" target

php app/nut setup:deploy --edit production

bolt/simple-deploy 适用场景与选型建议

bolt/simple-deploy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.44k 次下载、GitHub Stars 达 7, 最近一次更新时间为 2017 年 08 月 14 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 10.44k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 10
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 13
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-14