katsana/minions-server 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

katsana/minions-server

最新稳定版本:v1.1.2

Composer 安装命令:

composer require katsana/minions-server

包简介

Minions Component Server using ReactPHP

README 文档

README

Build Status Latest Stable Version Total Downloads Latest Unstable Version License Coverage Status

Installation

Minions can be installed via composer:

composer require "katsana/minions-server=^1.0"

Please ensure that you already install Minions and go through the installation and setup documentation.

Usages

Minion Server will run the RPC Server using ReactPHP running from Artisan command.

You can start the RPC server by issuing the artisan command:

php artisan minions:serve

Configurations

You can export the default minions-server.php to your project directory via the following command:

php artisan vendor:publish --provider="Minions\Server\MinionsServiceProvider" --tag="config"

Using a different port

The default port of the RPC server is 8085. You may set a different port by updating the environment file (or config/minions.php).

MINION_SERVER_PORT=8081

Restricting the listening host

By default, the RPC server will listen on 127.0.0.1 and will only allow incoming connections from local networks. If you want to expose this, you set a different host updating the environment file (or config/minions.php).

MINION_SERVER_HOST='0.0.0.0'

Keeping the socket server running with supervisord

The minions:serve daemon needs to always be running in order to accept connections. This is a prime use case for supervisor, a task runner on Linux.

First, make sure supervisor is installed.

# On Debian / Ubuntu
apt install supervisor

# On Red Hat / CentOS
yum install supervisor
systemctl enable supervisor

Once installed, add a new process that supervisor needs to keep running. You place your configurations in the /etc/supervisor/conf.d (Debian/Ubuntu) or /etc/supervisord.d (Red Hat/CentOS) directory.

Within that directory, create a new file called minions.conf.

[program:minion]
command=/usr/bin/php /home/project/artisan minions:serve
numprocs=1
autostart=true
autorestart=true

Once created, instruct supervisor to reload it's configuration files (without impacting the already running supervisor jobs).

supervisorctl update
supervisorctl start minion

Your RPC server should now be running (you can verify this with supervisorctl status). If it were to crash, supervisor will automatically restart it.

Please note that, by default, supervisor will force a maximum number of open files onto all the processes that it manages. This is configured by the minfds parameter in supervisord.conf.

If you want to increase the maximum number of open files, you may do so in /etc/supervisor/supervisord.conf (Debian/Ubuntu) or /etc/supervisord.conf (Red Hat/CentOS):

[supervisord]
minfds=10240; (min. avail startup file descriptors;default 1024)

After changing this setting, you'll need to restart the supervisor process (which in turn will restart all your processes that it manages).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-24