承接 sourcebroker/deployer-extended-wordpress-composer 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

sourcebroker/deployer-extended-wordpress-composer

Composer 安装命令:

composer require sourcebroker/deployer-extended-wordpress-composer

包简介

Composer based WordPress deployment with deployer.org.

README 文档

README

What does it do?

This package provides deploy task for deploying WordPress with deployer (deployer.org) and additionally a tasks to synchronize database and media files.

The deployment is expected to be compatible with capistrano based for https://roots.io/bedrock/

Dependencies

This package depends on following packages:

Installation

  1. Install package with composer:

    composer require sourcebroker/deployer-extended-wordpress-composer
    
  2. If you are using deployer as phar then put following lines in your deploy.php:

    require __DIR__ . '/vendor/autoload.php';
    new \SourceBroker\DeployerExtendedWordpressComposer\Loader();
    
  3. Remove task "deploy" from your deploy.php. Otherwise you will overwrite deploy task defined in deployer/deploy/task/deploy.php

  4. Example deploy.php file:

    <?php
    
    namespace Deployer;
    
    require_once(__DIR__ . '/vendor/sourcebroker/deployer-loader/autoload.php');
    new \SourceBroker\DeployerExtendedWordpressComposer\Loader();
    
    set('repository', 'git@my-git:my-project.git');
    
    host('live')
        ->setHostname('111.111.111.111')->port(22)
        ->setRemoteUser('www-data')
        ->set('branch', 'master')
        ->set('public_urls', ['https://www.example.com/'])
        ->set('deploy_path', '/var/www/example.com.live');
    
    host('beta')
        ->setHostname('111.111.111.111')->port(22)
        ->setRemoteUser('www-data')
        ->set('branch', 'beta')
        ->set('public_urls', ['https://beta.example.com/'])
        ->set('deploy_path', '/var/www/example.com.beta');
    
    host('dev')
        ->set('public_urls', ['https://example-com.local/'])
        ->set('deploy_path', getcwd());
    

Mind the declaration of host('dev'); Its needed for database tasks to declare domain replacements, and path to store database dumps.

Synchronizing database

Database synchronization is done with sourcebroker/deployer-extended-database. Example of command for synchronizing database from live to local instance:

dep db:pull live

You can also copy database from live to beta instance like:

dep db:copy live --options=target:beta

Domain replacement

The "post_command" task "db:import:post_command:wp_domains" will change domains declared in "public_urls". Domain replacement is done with cli command "search-replace" from wp-cli/wp-cli.

Please mind to have the same amount of "public_urls" for each of instances because replacement on domains is done for every pair of corresponding urls.

Look at following example to give you idea:

host('live')
    ->setHostname('111.111.111.111')
    ->setRemoteUser('www-data')
    ->set('public_urls', ['https://www.example.com', 'https://sub.example.com'])
    ->set('deploy_path', '/var/www/example.com.live');

host('beta')
    ->setHostname('111.111.111.111')
    ->setRemoteUser('www-data')
    ->set('public_urls', ['https://beta.example.com', 'https://beta-sub.example.com'])
    ->set('deploy_path', '/var/www/example.com.beta');

host('dev')
    ->set('public_urls', ['https://example-com.dev', 'https://sub-example-com.dev'])
    ->set('deploy_path', getcwd());

The if you will do:

dep db:pull live

the following commands will be done automatically after database import:

wp search-replace https://www.example.com https://example-com.dev
wp search-replace https://sub.example.com https://sub-example-com.dev

Should I use "deployer-extended-wordpress" or "deployer-extended-wordpress-composer"?

In sourcebroker/deployer-extended-wordpress the WordPress and third party plugins are installed manually. What you have in git is basically only your theme. The good thing is that in such case you can update WordPress and plugins automatically. This can be considered as preferable for low budget WordPress websites.

In sourcebroker/deployer-extended-wordpress-composer the WordPress and third party plugins are installed using composer. This way you gain more control over what is installed but at the same time to install new WordPress or new plugin version you need first to modify composer.json or do composer update (depending how big upgrade you do). Then you need to commit composer.json / composer.lock and do deploy which will install new version of WordPress and plugins. This is additional work that can not be easily automated. One of additional advantages of this solution is that you can easily cleanup infected WordPress/plugins files as with each deployment all php files are fresh (part from your git and part from composer repositories).

sourcebroker/deployer-extended-wordpress-composer 适用场景与选型建议

sourcebroker/deployer-extended-wordpress-composer 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.48k 次下载、GitHub Stars 达 15, 最近一次更新时间为 2019 年 01 月 28 日, 在 PHP 生态内属于活跃度较高的组件。

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

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

围绕 sourcebroker/deployer-extended-wordpress-composer 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 5.48k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 15
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-28