承接 dcousineau/phorever 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

dcousineau/phorever

Composer 安装命令:

composer require dcousineau/phorever

包简介

Role-based process and daemon management for PHP

README 文档

README

Role-based long-running process daemon for PHP projects!

Overview & Goals

Phorever provides an easy way to launch and manage background processes based on configuration defined in a phorever.json file in your project's root directory.

Phorever will automatically keep track of all running processes, respawning them based on configured behavior, and fire notifications on aberrant behavior.

Phorever is installable via Composer and automatically drops a binary to interact with.

Phorever's ultimate goal is to make provisioning servers and monitoring long-running processes more idiot proof. For example, a simple phorever start scheduler will ensure all background processes required for a scheduler server are running.

Installation

Phorever is provided as a composer package and requires PHP 5.4 and up. To use Phorever, simply add:

{
    "require": {
        "dcousineau/phorever": "dev-master"
    }
}

Composer will attempt to symlink the Phorever executable into your own bin folder. It is advisable that you make sure your own composer.json file is updated to define where that bin directory is located:

{
    "config": {
        "bin-dir": "bin"
    }
}

Configuration

Phorever by default reads from a configuration file found in your project root named phorever.json.

This configuration file defines the individual processes that should be launched and tracked, what roles they belong to, where log files should be dumped, among other things.

An example configuration file would look like:

{
    "pidfile": "./phorever_cool.pid",
    "timezone": "America/Chicago",
    "logging": {
        "directory": "./logs/"
    },
    "processes": [
        {
            "name": "Long Lived",
            "roles": ["roleb"],

            "up": "./tests/commands/longlived",

            "log_forwarding": true
        },
        {
            "name": "Short Lived",
            "roles": ["rolea"],

            "up": "./tests/commands/shortlived",

            "resurrect_after": 10,

            "clones": 2,

            "log_forwarding": true
        },
        {
            "name": "Runaway",
            "roles": ["runaway"],

            "up": "./tests/commands/runaway",

            "resurrect_after": 1,

            "log_forwarding": true
        }
    ]
}

Running the command bin/phorever start rolea roleb will launch both the "Short Lived" and "Long Lived" processes given they both belong to at least one of the roles we've requested to start.

Passing the --daemon parameter to Phorever will cause it to fork into the background.

Project Status

The project is currently in an MVP state after some exploratory coding. Currently it launches processes based on requested role and respawns processes after a resurrection wait time.

Currently not supported, but desperately needed before BETA1:

  • Processes that daemonize themselves (cannot check custom PIDs)
  • Giving up after certain thresholds
  • Notification on aberrant behavior

Features to come:

  • Configure respawn and notification behavior
  • Hooks for your own custom event listener classes for more fine-grained control
  • Status monitor and statistical logs

统计信息

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

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2013-04-03

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固