定制 ariadata/larastack-supervisor 二次开发

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

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

ariadata/larastack-supervisor

最新稳定版本:1.0.1

Composer 安装命令:

composer require ariadata/larastack-supervisor

包简介

Larastack Supervisor manager via artisan

README 文档

README

Packagist Version GitHub License

Larastack Supervisor is a Laravel package that allows you to manage Supervisor processes directly via Artisan commands. Whether you're starting, stopping, or checking the status of your processes, this package keeps your Supervisor management simple and intuitive.

Installation

You can install this package via Composer:

composer require ariadata/larastack-supervisor

Configuration on .env

After installation, need to add these in your .env file:

SUPERVISOR_RPC_HOST=supervisor # or your supervisor host
SUPERVISOR_RPC_PORT=9001
SUPERVISOR_RPC_USER=user
SUPERVISOR_RPC_PASS=pass

Usage

You can interact with Supervisor using either the Facade or the helper function.

Using the Facade

Ensure you have added the alias in your config/app.php (this is automatically registered if you are using Laravel's auto-discovery feature , laravel <= 7.x):

# if laravel <= 7.x
'aliases' => [
    'LarastackSupervisor' => Ariadata\LarastackSupervisor\Facades\LarastackSupervisorFacade::class,
],

Examples:

use LarastackSupervisor;

// Start a service
LarastackSupervisor::start('laravel-horizon');

// Stop a service
LarastackSupervisor::stop('laravel-horizon');

// Restart a service
LarastackSupervisor::restart('laravel-horizon');

// Get the status of all services
$statuses = LarastackSupervisor::status('all');

// List all processes
$processes = LarastackSupervisor::list();

Using the Helper Function

You can also use the helper function larastack_supervisor() to interact with Supervisor:

// Start all services
larastack_supervisor()->start('all');

// Stop a specific service
larastack_supervisor()->stop('laravel-horizon');

// Restart a specific service
larastack_supervisor()->restart('laravel-horizon');

// Check the status of all services
$statuses = larastack_supervisor()->status('all');

// List all processes
$processes = larastack_supervisor()->list();

Available Artisan Commands

You can also manage Supervisor processes directly from the command line using Artisan.

Command Signature

php artisan supervisor {action} {service?}

Actions

  • list - List all processes.
  • status [service] - Show the status of a specific service or all services.
  • start [service] - Start a specific service or all services.
  • stop [service] - Stop a specific service or all services.
  • restart [service] - Restart a specific service or all services.
  • Examples
  • Start all services:
php artisan supervisor start all
  • Stop a specific service (e.g., laravel-horizon):
php artisan supervisor stop laravel-horizon
  • Get the status of all services:
php artisan supervisor status all
  • Restart a specific service:
php artisan supervisor restart laravel-horizon

Process Statuses

The following statuses may be returned when querying the status of Supervisor-managed processes:

  • STOPPED
  • STARTING
  • RUNNING
  • BACKOFF
  • STOPPING
  • EXITED
  • FATAL
  • UNKNOWN

License

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

Key Points Covered:

  • Installation via Composer.
  • Configuration for customizing Supervisor's RPC settings.
  • Usage examples with both the Facade and the helper function.
  • Artisan Commands to control Supervisor processes from the command line.
  • A list of process statuses that Supervisor can return.
  • A structured and clean README.md file that provides clear instructions for installation, configuration, usage,
  • and available commands for your package.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-12