Skip to content

Commit

Permalink
Merge pull request #22 from fucongcong/dev
Browse files Browse the repository at this point in the history
配置文件目录更新,兼容旧版本
  • Loading branch information
fucongcong authored Apr 13, 2018
2 parents e43d009 + 1d3ce94 commit dfbccab
Show file tree
Hide file tree
Showing 16 changed files with 505 additions and 73 deletions.
71 changes: 0 additions & 71 deletions config/app.php
Original file line number Diff line number Diff line change
@@ -1,76 +1,5 @@
<?php
return [
/****************FRAMEWORK CONFIG*********************/
// prod|dev
'environment' => 'dev',

//debug开启后service会打印接受到的数据包
'debug' => false,

//zh|en|fr...
'locale' => 'zh',

//时区
'timezone' => 'Asia/Shanghai',

//类的映射
'aliases' => [
//like 'demo' => 'src\Service\demo',
],

'onWorkStartServices' => [
'Group\Async\Pool\MysqlPoolServiceProvider',
'Group\Async\Pool\RedisPoolServiceProvider',
],

'onRequestServices' => [
//如果做api服务,可以不加载twig
'Group\Controller\TwigServiceProvider',
],

//需要实例化的单例
'singles' => [
//like 'demo' => 'src\demo\demo',
],

//扩展console命令行控制台
'console_commands' => [
'log.clear' => [
'command' => 'src\Web\Command\LogClearCommand', //执行的类
'help' => '清除日志', //提示
],
],
//**修改以下配置后需要restart server。reload不生效!
/****************SERVER CONFIG*********************/
//本机当前内网ip
'ip' => '127.0.0.1',

'host' => '0.0.0.0',
'port' => 9777,

'setting' => [
//日志
'daemonize' => true,
'log_file' => 'runtime/error.log',
'worker_num' => 2, //worker process num
'backlog' => 256, //listen backlog
'heartbeat_idle_time' => 30,
'heartbeat_check_interval' => 10,
'dispatch_mode' => 1,
'max_request' => 10000,
],

//依赖的服务模块
'services' => ["User", "Order", "Monitor"],

//在启动时可以添加用户自定义的工作进程,必须是swoole_process,请继承Group\Process抽象类
'process' => [
],

//此参数可不填。通信协议 eof:结束符, buf:包头+包体。
'protocol' => 'eof',
//包体的打包方式json,serialize
'pack' => 'serialize',
//是否启用gzip压缩true,false
'gzip' => false,
];
73 changes: 73 additions & 0 deletions config/dev/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
return [
/****************FRAMEWORK CONFIG*********************/
//debug开启后service会打印接受到的数据包
'debug' => false,

//zh|en|fr...
'locale' => 'zh',

//时区
'timezone' => 'Asia/Shanghai',

//类的映射
'aliases' => [
//like 'demo' => 'src\Service\demo',
],

'onWorkStartServices' => [
'Group\Async\Pool\MysqlPoolServiceProvider',
'Group\Async\Pool\RedisPoolServiceProvider',
],

'onRequestServices' => [
//如果做api服务,可以不加载twig
'Group\Controller\TwigServiceProvider',
],

//需要实例化的单例
'singles' => [
//like 'demo' => 'src\demo\demo',
],

//扩展console命令行控制台
'console_commands' => [
'log.clear' => [
'command' => 'src\Web\Command\LogClearCommand', //执行的类
'help' => '清除日志', //提示
],
],
//**修改以下配置后需要restart server。reload不生效!
/****************SERVER CONFIG*********************/
//本机当前内网ip
'ip' => '127.0.0.1',

'host' => '0.0.0.0',
'port' => 9771,

'setting' => [
//日志
'daemonize' => true,
'log_file' => 'runtime/error.log',
'worker_num' => 2, //worker process num
'backlog' => 256, //listen backlog
'heartbeat_idle_time' => 30,
'heartbeat_check_interval' => 10,
'dispatch_mode' => 1,
'max_request' => 10000,
],

//依赖的服务模块
'services' => ["User", "Order", "Monitor"],

//在启动时可以添加用户自定义的工作进程,必须是swoole_process,请继承Group\Process抽象类
'process' => [
],

//此参数可不填。通信协议 eof:结束符, buf:包头+包体。
'protocol' => 'eof',
//包体的打包方式json,serialize
'pack' => 'serialize',
//是否启用gzip压缩true,false
'gzip' => false,
];
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
125 changes: 125 additions & 0 deletions config/dev/service.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?php
return [
//加密token,16位。可修改
'encipher' => 'uoI49l^^M!a5&bZt',

//注册中心,如果不为空的话,在server启动时会起一个子进程订阅依赖的服务列表。
'registry_address' => [
'scheme' => 'redis',
'host' => '127.0.0.1',
'prefix' => 'group_',
'port' => 6379,
'auth' => '',
],
//mysql注册中心,开启后,请执行doc/mysql-registry.sql中的sql,创建2张表
// 'registry_address' => [
// 'scheme' => 'mysql',
// 'host' => '127.0.0.1',
// 'port' => 3306,
// 'user' => 'root',
// 'password' => '123',
// 'dbname' => 'Demo'
// ],
// 'registry_address' => [
// 'scheme' => 'zookeeper',
// 'host' => '127.0.0.1',
// 'port' => 2181,
// //集群模式
// //'url' => '127.0.0.1:2181,127.0.0.1:2182'
// ],

//配置service
'server' => [
'monitor' => [
//本机当前内网ip
'ip' => '127.0.0.1',
'serv' => '0.0.0.0',
'port' => 9517,
'config' => [
'daemonize' => true,
'worker_num' => 2,
'max_request' => 50000,
'task_worker_num' => 5,
'task_max_request' => 50000,
'heartbeat_idle_time' => 300,
'heartbeat_check_interval' => 60,
'dispatch_mode' => 3,
'log_file' => 'runtime/service/monitor.log',
],
'public' => 'Monitor',
'process' => [
//你可以使用框架封装的心跳检测进程
'Group\Process\HeartbeatProcess',
],
],
//可以配置多个server,注意请监听不同的端口。
//serverName
'user' => [
//本机当前内网ip
'ip' => '127.0.0.1',

'serv' => '0.0.0.0',
'port' => 9511,
//server配置,请根据实际情况调整参数
'config' => [
'daemonize' => true,
//worker进程数量
'worker_num' => 2,
//最大请求数,超过后讲重启worker进程
'max_request' => 50000,
//task进程数量
'task_worker_num' => 5,
//task进程最大处理请求上限,超过后讲重启task进程
'task_max_request' => 50000,
//心跳检测,长连接超时自动断开,秒
'heartbeat_idle_time' => 300,
//心跳检测间隔,秒
'heartbeat_check_interval' => 60,
//1平均分配,2按FD取摸固定分配,3抢占式分配,默认为取模
'dispatch_mode' => 3,
//日志
'log_file' => 'runtime/service/user.log',
//其他配置详见swoole官方配置参数列表
],

//公开哪些服务,如果不填默认公开所有服务
'public' => 'User',
],
'user_2' => [
//本机当前内网ip
'ip' => '127.0.0.1',
'serv' => '0.0.0.0',
'port' => 9521,
'config' => [
'daemonize' => true,
'worker_num' => 2,
'max_request' => 50000,
'task_worker_num' => 5,
'task_max_request' => 50000,
'heartbeat_idle_time' => 300,
'heartbeat_check_interval' => 60,
'dispatch_mode' => 3,
'log_file' => 'runtime/service/user_2.log',
],
'public' => 'User',
],
'order' => [
//本机当前内网ip
'ip' => '127.0.0.1',
'serv' => '0.0.0.0',
'port' => 9520,
'config' => [
'daemonize' => true,
'worker_num' => 1,
'max_request' => 50000,
'task_worker_num' => 2,
'task_max_request' => 50000,
'heartbeat_idle_time' => 300,
'heartbeat_check_interval' => 60,
'dispatch_mode' => 3,
'log_file' => 'runtime/service/order.log',
],
'public' => 'Order',
],
],
];
File renamed without changes.
73 changes: 73 additions & 0 deletions config/prod/app.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
return [
/****************FRAMEWORK CONFIG*********************/
//debug开启后service会打印接受到的数据包
'debug' => false,

//zh|en|fr...
'locale' => 'zh',

//时区
'timezone' => 'Asia/Shanghai',

//类的映射
'aliases' => [
//like 'demo' => 'src\Service\demo',
],

'onWorkStartServices' => [
'Group\Async\Pool\MysqlPoolServiceProvider',
'Group\Async\Pool\RedisPoolServiceProvider',
],

'onRequestServices' => [
//如果做api服务,可以不加载twig
'Group\Controller\TwigServiceProvider',
],

//需要实例化的单例
'singles' => [
//like 'demo' => 'src\demo\demo',
],

//扩展console命令行控制台
'console_commands' => [
'log.clear' => [
'command' => 'src\Web\Command\LogClearCommand', //执行的类
'help' => '清除日志', //提示
],
],
//**修改以下配置后需要restart server。reload不生效!
/****************SERVER CONFIG*********************/
//本机当前内网ip
'ip' => '127.0.0.1',

'host' => '0.0.0.0',
'port' => 9777,

'setting' => [
//日志
'daemonize' => true,
'log_file' => 'runtime/error.log',
'worker_num' => 2, //worker process num
'backlog' => 256, //listen backlog
'heartbeat_idle_time' => 30,
'heartbeat_check_interval' => 10,
'dispatch_mode' => 1,
'max_request' => 10000,
],

//依赖的服务模块
'services' => ["User", "Order", "Monitor"],

//在启动时可以添加用户自定义的工作进程,必须是swoole_process,请继承Group\Process抽象类
'process' => [
],

//此参数可不填。通信协议 eof:结束符, buf:包头+包体。
'protocol' => 'eof',
//包体的打包方式json,serialize
'pack' => 'serialize',
//是否启用gzip压缩true,false
'gzip' => false,
];
Loading

0 comments on commit dfbccab

Please sign in to comment.