Giter VIP home page Giter VIP logo

seeker's Introduction

Seeker

Seeker是一个基于Swoole实现的服务架构整体实现


实现服务

  • Master:负责管理所有节点
  • Node:用于管理该节点下所有的Service
  • ServiceProcess:运行具体的业逻辑
  • Harbor:用于转发协议,连接所有Node.

LIST

  • CLI命令行管理Master, 增加节点,发布service process ....
  • 并行远程service调用
  • 对发Node发出的协议 超时管理
  • HTTP异步下载文件,用于节点收到发布任务时 进行下载执行源码或是文件
  • .....
  • ConnectClient向Node 进行协议注册
  • 消息分发器
  • 远程调用
  • .....

启动Master

php ./bin/launcher.php --host=0.0.0.0 --port=9901 --type=master

启动Node

php ./bin/launcher.php --host=0.0.0.0 --port=9901 --type=node

启动Harbor

php ./bin/launcher.php --host=0.0.0.0 --port=9901 --type=harbor

开发时启动Service process

需要将目录切换到seeker的上次目录。

php ./seeker/bin/service.php --process=user --version=2.0.1 --vendor=./vendor --debug-user=./seeker/bin/demo/user/2.0.1 --debug-widget-demo=./seeker/bin/demo/widget_demo/1.0.0 --host=0.0.0.0 --port=9901 --key=894e6d6e55a41bfdd0603edfb1eb41a7 --id=10000

Service 示例

namespace Seeker\Service\Master;

use Seeker\Sharded;
use Seeker\Manager\NodeClient;
use Seeker\Protocol\Error;
use Seeker\Service\Common\Base;

class Deploy extends Base
{
    //节点认证
    public function progress()
    {
        //找到相应的Node...
        $nodeId = $this->request->getFromNode();
        $progress = $this->request->get('progress');
        $taskId = $this->request->get('taskId');

        print_r($this->request);

        echo 'Deploy Progress:' . sprintf('N:%d, T:%s, %d%%'
            , $nodeId
            , $taskId
            , $progress
        ) . PHP_EOL;
    }
}

调用别的Service 示例

$this->dispatcher->remoteCall('common.node.login')
    ->setToNode($this->nodeId)
    ->set('type', 'master')
    ->set('authKey', $this->authKey)
    ->then(function($connection, $response) {
        if (!$response->getCode()) {
            $connection->setAuthed(static::AUTHED_COMMON | static::AUTHED_NODE);
        } else {
            $connection->close();
        }
    })
    ->sendTo($this);

seeker's People

Stargazers

Jimi avatar  avatar  avatar  avatar Cariers Kim avatar

Watchers

James Cloos avatar Cariers Kim avatar

Forkers

caoge lijunqia

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.