jontsa/maintenance-bundle
Composer 安装命令:
composer require jontsa/maintenance-bundle
包简介
Symfony bundle to put your site in to maintenance mode.
README 文档
README
A small bundle for Symfony 4/5 which provides commands to put your application in maintenance break during which
all requests receive HTTP 503 response. This is done by throwing ServiceUnavailableHttpException and clients
will receive either default Symfony error page or JSON message with correct HTTP status code.
Features
- Put your site to maintenance mode with single command
- Responds with HTTP 503 to requests during maintenance
- Optional IP-address whitelist. For example to allow access for load balancer health checks during maintenance.
- Lightweight bundle
- Recipes for Deployer
Requirements
- Symfony 5+
- PHP 7.4+
- composer
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Open a command console, enter your project directory and execute:
$ composer require jontsa/maintenance-bundle
Applications not using Symfony Flex
When not using Symfony Flex, you need to enable the bundle by adding it
to the list of registered bundles in the config/bundles.php file of your project:
// config/bundles.php return [ // ... Jontsa\Bundle\MaintenanceBundle\JontsaMaintenanceBundle::class => ['all' => true], ];
Usage
To put your site under maintenance mode
$ bin/console jontsa:maintenance enable
To disable maintenance mode
$ bin/console jontsa:maintenance disable
Configuration
To change default settings, create a configuration file.
# config/packages/jontsa_maintenance.yaml jontsa_maintenance: whitelist: ip: [127.0.0.1, 192.168.0.0/24] lock_path: '%kernel.project_dir%/var/cache/maintenance'
ipis an array of IP-addresses or networks which are allowed to access applications even during maintenancelock_pathis the file path which is created during maintenance
Custom error page
If you want to customize the error page, check out Symfony documentation.
jontsa/maintenance-bundle 适用场景与选型建议
jontsa/maintenance-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 736 次下载、GitHub Stars 达 1, 最近一次更新时间为 2020 年 03 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 jontsa/maintenance-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jontsa/maintenance-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 736
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-03-25