定制 jamielsharief/updater 二次开发

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

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

jamielsharief/updater

Composer 安装命令:

composer require jamielsharief/updater

包简介

Application updates and upgrades

README 文档

README

license build coverage status

Updater is an application updater, it will update and upgrade your deployed applications to the latest release running any tasks before and after each update that are specific to each each release.

Whilst this was originally designed so that applications can be updated by clients or automatically (through a CRON job), I think this might be interesting in the deployment/release cycle.

It works with composer repositories such as packagist.org or static repositories generated by satis. Private repositories can be protected using authentication and update will store and request when needed.

$ updater update
     __  __          __      __
    / / / /___  ____/ /___ _/ /____  _____
   / / / / __ \/ __  / __ `/ __/ _ \/ ___/
  / /_/ / /_/ / /_/ / /_/ / /_/  __/ /
  \____/ .___/\__,_/\__,_/\__/\___/_/
      /_/

version 0.1.0

- Checking for updates company/app (1.0.2)
- Downloading company/app (1.0.3)
- Running before scripts:
 > bin/console db:backup
- Extracting company/app (1.0.3)
- Running after scripts:
 > composer update
 > bin/console db:migrate

Installation

You can build from source or download updater from the releases section.

Download the Source Code

Download the source and build updater application.

$ git clone http://github.com/jamielsharief/updater updater
$ cd updater
$ composer install

Now build the PHAR, this will create bin/updater.phar, you can copy this into your application bin folder.

$ php -d phar.readonly=Off bin/build

Copy globally

To install globally copy

$ cp bin/updater.phar /usr/local/bin/updater

Usage

Create updater.json in your application project folder, and in each release you can configure it to run before and after commands, bash or PHP scripts - if and when needed.

{
    "url": "https://packagist.org",
    "package": "company/app",
    "scripts": {
        "before": [
            "bin/console db:backup"
        ],
        "after": [
            "bin/console db:migrate"
        ]
    }
}

If you are using a private satis repository, change the url in the updater.json , e.g. https://www.example.com and setup authentication for composer, if required.

Authentication

Currently only http-basic authorization is supported, to work with this simply create the auth.json in your project directory. However you can also generate a satis private repository which can then connect to various repositories and supports more authentication methods.

{
    "http-basic": {
        "example.com": {
            "username": "token",
            "password": "878ec3cebea5b2c1ee4c0becdb00d3d3"
        },
    }
}

Composer can create this for you as well composer config http-basic.example.com username password --global

Initializing the Project

To get started with updater you need to initialize the project.

Run the updater init command to initialize the updater, you will be prompted for the current version, and updates after this will be pulled.

$ updater init

Updating

To update your application just run the following command, which will run all updates that are available in sequence.

$ updater update

If you want to run all available updates in the current major version

$ updater update --all

You can use the --verbose option to see the output of the scripts, if any

If you want to test the update using a specific composer version (including development branch), this will use the specific version and it will not update the lock file.

$ updater update --version dev-master

Upgrading

This will only upgrade to the next major version if there are no pending updates, and it will not update any versions after the first next major version.

To upgrade to the next major release run the upgrade command.

$ updater upgrade

You can use the --verbose option to see the output of the scripts, if any

If you want to test the upgrade using a specific composer version (including development branch), this will use the specific version and it will not update the lock file.

$ updater upgrade --version dev-master

Demo

Building the PHAR will fail if you do not remove this directory when you have finished.

Download the source and dependencies

$ git clone http://github.com/jamielsharief/updater updater
$ cd updater
$ composer install

Now download the sample project into a sub folder, e.g. updater/demo so you can run updater without building the PHAR file.

$ composer create-project jamielsharief/updater-demo:0.1.0 demo

The first version does not have the updater.json, so create this in demo folder, and set the URL to the repository.

{
    "url": "https://packagist.org",
    "package": "jamielsharief/updater-demo",
    "scripts": {
        "before": [],
        "after": []
    }
}

Initialize updater, mentioning the directory where you extracted the zip archive too.

$ bin/updater init demo --version 0.1.0

Then run the update command to get the next available update

$ bin/updater update demo

Now, you can run it a few times or use the --all.

Once you are ready to upgrade the application to the next major version, run

$ bin/updater upgrade demo

jamielsharief/updater 适用场景与选型建议

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

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

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

围绕 jamielsharief/updater 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Apache-2.0
  • 更新时间: 2021-02-17