pierotto/supervisor

Symfony 扩展,用于生成 supervisor 程序的配置。

安装次数: 24

依赖者: 0

建议者: 0

安全: 0

星标: 2

关注者: 2

分支: 0

开放问题: 0

类型:symfony-bundle

2.1.0 2024-03-27 18:42 UTC

This package is auto-updated.

Last update: 2024-09-27 19:37:39 UTC


README

Supervisor 扩展是一个简化 supervisor 程序配置生成的 Symfony 扩展。

关于

此扩展包接收您的配置并生成一个包含指定程序及其设置的 supervisor.conf 文件。您可以选择此文件的路径和名称。

安装

要开始,请使用 Composer 需求此扩展及其依赖项。

composer require pierotto/supervisor

然后,在您的 Symfony 应用程序中注册此扩展。

// app/AppKernel.php
public function registerBundles(): array
{
    $bundles = [
        new \Pierotto\SupervisorBundle\SupervisorBundle(),
    ];
}

使用方法

要配置您想通过 supervisord 运行的程序,请按照以下步骤操作:

  1. 在您的 Symfony 配置中,定义所有您希望使用 Supervisor 管理的程序。
  2. 使用控制台命令生成 supervisor.conf 文件。
php bin/console supervisor:generate path/to/supervisor.conf

以下是一个 YAML 格式的示例配置:

supervisor:
    prefix: '' # Prefix for all program names (optional)
    programs:
        program_name: # Custom unique program name
            command: 'php %kernel.project_dir%/bin/console your_custom_command'
            numprocs: 1 # Number of process instances (optional, default: 1)
            autostart: true # Automatically start the program on Supervisor startup (optional, default: true)
            autorestart: true # Automatically restart the program if it exits or fails (optional, default: true)
            killasgroup: true # Kill the program's process group when stopping (optional, default: true)
            startretries: 10 # Number of retries to start the program in case of failure (optional, default: 3)
            user: 'www-data' # User under which the program should run (optional)
            directory: '/path/to/working/directory' # Working directory of the program (optional)
            stdout_logfile: '/path/to/stdout.log' # File for standard output (optional)
            stderr_logfile: '/path/to/stderr.log' # File for error output (optional)
            environment: KEY1="value1",KEY2="value2" # Environment variable definitions (optional)
            stopsignal: 'TERM' # Signal for program termination (optional)
            stopwaitsecs: 10 # Time limit for program termination (optional)
            priority: 999 # Program priority (optional)
            startsecs: 1 # Defines the duration, in seconds, a program must run after starting to be considered successful (optional)