承接 techsemicolon/laravel-migration-pipeline 相关项目开发

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

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

techsemicolon/laravel-migration-pipeline

Composer 安装命令:

composer require techsemicolon/laravel-migration-pipeline

包简介

A migration pipeline to make sure same migration is not run again in multiple server setup

README 文档

README

A migration pipeline to make sure same migration is not run again in multiple server setup

Version Support :

Works for Laravel version 5.3 and above.

Introduction :

When you run php artisan migrate in laravel, it checks if there are any new migration files which are not yet migrated. If yes, then it runs each migration one by one and adds an entry into migrations table with migration name and batch number.

However, when you have multiple servers on autoscalling and have the CICD pipelines to automatically pull the latest releases of git webhooks, the post webhook script having php artisan migrate runs almost simultaneously on all those servers.

For example lets say, you have 3 laravel servers running. When you push latest releases to git, git webhook triggers the CICD pipeline and then all servers receive the webhooks almost at the same time.

All these 3 servers will run webhook scripts, which will have git pull and then php artisan commands. One of which will be php artisan migrate. If you have 3 new migrations in the release, all these 3 will be attempted to run with different(mostly consecutive) batch numbers.

We want to avoid that. If a migration is already run on the 1st server out of 3, we do not want 2nd and 3rd server to re-run it. This is when this package comes into picture.

In any given situation, if a migration is running on one server or already run ina different batch number, it will not run again. This will avoid the above problem.

Installation :

To install the package using composer :

composer require techsemicolon/gitdeployer

Once installed, you can add service provider in config/app.php file for laravel version <= 5.4. For later versions the service provider will be automatically included.

Techsemicolon\MigrationPipeline\ServiceProvider::class,

Example :

Following screenshot gives you an idea where both the servers are running php artisan migrate at the same time. However, the right server ran migration_1 hence, left server skipped that and ran the remaining ones.

Also, once the migration_1 was ran by right server, migration_2, migration_3 and migration_4 were skipped because those were already run by the left server.

Laravel Migration Pipeline

Note :

This package assumes/requires that you give unique names to your migrations. By default each migration in laravel is unique if you use php artisan make:migration some_table_migration where laravel adds timestamp at the start of migration file name. But in case you are removing that timestamp, make sure you have something in the migration file name which marks it as unique.

License :

This package is open-sourced software licensed under the MIT license

techsemicolon/laravel-migration-pipeline 适用场景与选型建议

techsemicolon/laravel-migration-pipeline 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 8 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 04 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 techsemicolon/laravel-migration-pipeline 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-04-09