Git Product home page Git Product logo

minions-server's Introduction

Minions Component Server using ReactPHP

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).

minions-server's People

Contributors

crynobone avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

minions-server's Issues

Request Logging

I am trying to figure out how to log incoming request. I can see that there is a LogRequest middleware. But not sure where it is being log into.

Also when running the minions:serve there is no output, as compared to laravel-websocket, which make it easier to check if it is actually running and receiving request.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.