Commit 3ceccb3c authored by tufengqi's avatar tufengqi

init

parent e90fea92
......@@ -4,4 +4,5 @@
.idea
/composer.lock
/thrift_impl/market/swoole/runtime
/thrift_impl/otc/swoole/runtime
/user_site/zhaobi/swoole/runtime
\ No newline at end of file
<?php
/* 需要修改的参数<< */
$index_root_path = '/data33/';
$app_package_path = $index_root_path . 'thrift_impl/';
$base_path = $origin_base_path = $index_root_path . 'thrift_impl/market-service-impl/';
defined('VERSION_KEY') or define('VERSION_KEY', 'thrift_impl_market_version');
$version_path = $index_root_path . 'version/';
defined('SERVICE_ENV') or define('SERVICE_ENV', 'test');
defined('MAIN_CONSOLE_CONFIG_FILE') or define('MAIN_CONSOLE_CONFIG_FILE', 'market_main_console.php');
/* 需要修改的参数>> */
\ No newline at end of file
<?php
#!/usr/bin/env php
require __DIR__ . '/common-basic.php';
require dirname(dirname(__DIR__)) . '/VersionApp.php';
\ No newline at end of file
#!/usr/bin/env php
<?php
/* 需要修改的参数<< */
$index_root_path = '/data33/';
$app_root_path = $index_root_path . 'swoole_thrift_impl/market-service-impl';
$app_package_path = $index_root_path . 'swoole_thrift_impl';
/* 需要修改的参数>> */
!defined('IS_FORCE_ONLINE') && define('IS_FORCE_ONLINE', true);
!defined('IS_SWOOLE_SERVICE') && define('IS_SWOOLE_SERVICE', true);
!defined('SWOOLE_MIDDLE_ROOT') && define('SWOOLE_MIDDLE_ROOT', $app_root_path);
!defined('APP_PACKAGE_PATH') && define('APP_PACKAGE_PATH', $app_package_path);
require_once $app_root_path . '/vendor/swoft_33cn/vendor/autoload.php';
require_once $app_root_path . '/vendor/yii2_33cn/vendor/autoload.php';
require_once $app_root_path . '/vendor/foge/swoole-yii2/Yii.php';
require_once $app_package_path . '/LoadConfig.php';
require_once $app_root_path . '/vendor/autoload.php';
require_once __DIR__ . '/swoole/config/define.php';
// init the factory of bean
\Swoft\Bean\BeanFactory::init();
/* @var \Swoft\Bootstrap\Boots\Bootable $bootstrap*/
$bootstrap = \Swoft\App::getBean(\Swoft\Bootstrap\Bootstrap::class);
$bootstrap->bootstrap();
$console = new \Swoft\Console\Console();
$console->run();
\ No newline at end of file
## swoole 启动说明
> sudo php market-swoole.php start
\ No newline at end of file
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'serverDispatcher' => [
'middlewares' => [
\Swoft\View\Middleware\ViewMiddleware::class,
// \Swoft\Devtool\Middleware\DevToolMiddleware::class,
// \Swoft\Session\Middleware\SessionMiddleware::class,
]
],
'httpRouter' => [
'ignoreLastSlash' => false,
'tmpCacheNumber' => 1000,
'matchAll' => '',
],
'requestParser' => [
'parsers' => [],
],
'view' => [
'viewsPath' => '@resources/views/',
],
'cache' => [
'driver' => 'redis',
],
'demoRedis' => [
'class' => \Swoft\Redis\Redis::class,
'poolName' => 'demoRedis'
]
];
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
];
\ No newline at end of file
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'noticeHandler' => [
'class' => \Swoft\Log\FileHandler::class,
'logFile' => '@runtime/logs/notice.log',
'formatter' => '${lineFormatter}',
'levels' => [
\Swoft\Log\Logger::NOTICE,
\Swoft\Log\Logger::INFO,
\Swoft\Log\Logger::DEBUG,
\Swoft\Log\Logger::TRACE,
],
],
'applicationHandler' => [
'class' => \Swoft\Log\FileHandler::class,
'logFile' => '@runtime/logs/error.log',
'formatter' => '${lineFormatter}',
'levels' => [
\Swoft\Log\Logger::ERROR,
\Swoft\Log\Logger::WARNING,
],
],
'logger' => [
'name' => APP_NAME,
'enable' => env('LOG_ENABLE', false),
'flushInterval' => 100,
'flushRequest' => true,
'handlers' => [
'${noticeHandler}',
'${applicationHandler}',
],
],
];
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
];
\ No newline at end of file
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
!defined('DS') && define('DS', DIRECTORY_SEPARATOR);
// App name
!defined('APP_NAME') && define('APP_NAME', 'swoft');
// Project base path
!defined('BASE_PATH') && define('BASE_PATH', SWOOLE_MIDDLE_ROOT . '/application', 1);
// Register alias
$aliases = [
'@root' => BASE_PATH,
'@env' => '@root',
'@app' => '@root/app',
'@res' => '@root/resources',
'@runtime' => dirname(__DIR__) . '/runtime',
'@configs' => __DIR__,
'@resources' => '@root/resources',
'@beans' => '@configs/beans',
'@properties' => '@configs/properties',
'@console' => '@beans/console.php',
'@commands' => '@app/command',
'@vendor' => SWOOLE_MIDDLE_ROOT . '/vendor',
];
\Swoft\App::setAliases($aliases);
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
\Swoft\App::setAliases([
'@swoft-yii2' => '@vendor/foge/swoft-yii2/src'
]);
return [
'env' => env('APP_ENV', 'test'),
'debug' => env('APP_DEBUG', true),
'version' => '1.0',
'autoInitBean' => true,
'excludeScan' => [
],
'I18n' => [
'sourceLanguage' => '@root/resources/messages/',
],
'db' => require __DIR__ . DS . 'db.php',
'cache' => require __DIR__ . DS . 'cache.php',
'service' => require __DIR__ . DS . 'service.php',
'breaker' => require __DIR__ . DS . 'breaker.php',
'provider' => require __DIR__ . DS . 'provider.php',
'bootScan' => [
'App\Commands',
'App\Boot',
'foge\swoft\yii' => \Swoft\App::getAlias('@swoft-yii2'),
],
'beanScan' => [
'App\Controllers',
'App\Boot',
'foge\swoft\yii' => \Swoft\App::getAlias('@swoft-yii2'),
],
'yiiConfig' => require APP_PACKAGE_PATH . DS . 'app_config/swoole_market_main_web.php',
// 'devtool' => [
// // 是否开启 DevTool,默认值为 false
// 'enable' => true,
// // (可选)前台运行服务器时,是否打印事件调用到 Console
// 'logEventToConsole' => true,
// // (可选)前台运行服务器时,是否打印 HTTP 请求到 Console
// 'logHttpRequestToConsole' => true,
// ]
];
\ No newline at end of file
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'user' => [
'failCount' => 3,
'successCount' => 3,
'delayTime' => 500,
],
];
\ No newline at end of file
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'redis' => [
'name' => 'redis',
'uri' => [
'127.0.0.1:6379',
'127.0.0.1:6379',
],
'minActive' => 8,
'maxActive' => 8,
'maxWait' => 8,
'maxWaitTime' => 3,
'maxIdleTime' => 60,
'timeout' => 8,
'db' => 1,
'prefix' => 'redis_',
'serialize' => 0,
],
'demoRedis' => [
'db' => 2,
'prefix' => 'demo_redis_',
],
];
\ No newline at end of file
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'master' => [
'name' => 'master',
'uri' => [
'127.0.0.1:3306/yii2basic?user=root&password=kekexi00&charset=utf8',
'127.0.0.1:3306/yii2basic?user=root&password=kekexi00&charset=utf8',
],
'minActive' => 8,
'maxActive' => 8,
'maxWait' => 8,
'timeout' => 8,
'maxIdleTime' => 60,
'maxWaitTime' => 3,
],
'slave' => [
'name' => 'slave',
'uri' => [
'127.0.0.1:3306/yii2basic?user=root&password=kekexi00&charset=utf8',
'127.0.0.1:3306/yii2basic?user=root&password=kekexi00&charset=utf8',
],
'minActive' => 8,
'maxActive' => 8,
'maxWait' => 8,
'timeout' => 8,
'maxIdleTime' => 60,
'maxWaitTime' => 3,
],
];
\ No newline at end of file
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'consul' => [
'address' => '',
'port' => 8500,
'register' => [
'id' => '',
'name' => '',
'tags' => [],
'enableTagOverride' => false,
'service' => [
'address' => 'localhost',
'port' => '8099',
],
'check' => [
'id' => '',
'name' => '',
'tcp' => 'localhost:8099',
'interval' => 10,
'timeout' => 1,
],
],
'discovery' => [
'name' => 'user',
'dc' => 'dc',
'near' => '',
'tag' =>'',
'passing' => true
]
],
];
\ No newline at end of file
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'user' => [
'name' => 'redis',
'uri' => [
'127.0.0.1:8099',
'127.0.0.1:8099',
],
'minActive' => 8,
'maxActive' => 8,
'maxWait' => 8,
'maxWaitTime' => 3,
'maxIdleTime' => 60,
'timeout' => 8,
'useProvider' => false,
'balancer' => 'random',
'provider' => 'consul',
]
];
\ No newline at end of file
<?php
return [
'env' => 'dev', // YII_ENV 的值
'debug' => true,// YII_DEBUG 的值
'config' => [ // 常规的 Yii-Config
'id' => 'swotf-test',
'basePath' => BASE_PATH . '/app/',
'language' => 'zh-CN',
'timeZone' => 'Asia/Shanghai',
'bootstrap' => ['log'],
'components' => [
'request' => [
'cookieValidationKey' => 'php is the best!!',
],
'log' => [
'traceLevel' => 3,
'targets' => [
[
'class' => 'yii\log\FileTarget',
'levels' => ['error', 'warning'],
],
],
],
'db' => [
'class' => 'foge\yii\swoole\db\Connection',
'dsn' => 'mysql:host=127.0.0.1;dbname=yii2basic',
'username' => 'root',
'password' => 'kekexi00',
'charset' => 'utf8',
'enableReloadSchema' => true,
'attributes' => [
//MysqlPoolPdo::POOL_MAX_SIZE => 50, 连接池的大小
//MysqlPoolPdo::POOL_MAX_SLEEP_Times => 0.1, 连接池满栈时等待的秒
],
],
'cache' => [
'class' => 'yii\caching\ArrayCache',
],
'fpf' => [
'class' => 'fpf\yii_component\Application',
'terry' => 'xxxx',
],
'redis' => [
'class' => 'foge\yii\swoole\redis\Connection',
'hostname' => '127.0.0.1',
'port' => 6379,
'database' => 0,
],
]
],
];
\ No newline at end of file
<?php
/*
* This file is part of Swoft.
* (c) Swoft <group@swoft.org>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
return [
'server' => [
'pfile' => env('PFILE', '/tmp/market_swoole.pid'),
'pname' => env('PNAME', 'php-swoft'),
'tcpable' => env('TCPABLE', true),
'cronable' => env('CRONABLE', false),
'autoReload' => env('AUTO_RELOAD', true),
],
'tcp' => [
'host' => env('TCP_HOST', '0.0.0.0'),
'port' => env('TCP_PORT', 8101),
'mode' => env('TCP_MODE', SWOOLE_PROCESS),
'type' => env('TCP_TYPE', SWOOLE_SOCK_TCP),
'package_max_length' => env('TCP_PACKAGE_MAX_LENGTH', 2048),
'open_eof_check' => env('TCP_OPEN_EOF_CHECK', false),
],
'http' => [
'host' => env('HTTP_HOST', '0.0.0.0'),
'port' => env('HTTP_PORT', 8081),
'mode' => env('HTTP_MODE', SWOOLE_PROCESS),
'type' => env('HTTP_TYPE', SWOOLE_SOCK_TCP),
],
'ws' => [
// enable handle http request ?
'enable_http' => env('WS_ENABLE_HTTP', true),
// other settings will extend the 'http' config
// you can define separately to overwrite existing settings
],
'crontab' => [
'task_count' => env('CRONTAB_TASK_COUNT', 1024),
'task_queue' => env('CRONTAB_TASK_QUEUE', 2048),
],
'setting' => [
'worker_num' => env('WORKER_NUM', 4),
'max_request' => env('MAX_REQUEST', 10000),
'daemonize' => env('DAEMONIZE', 0),
'dispatch_mode' => env('DISPATCH_MODE', 2),
'log_file' => env('LOG_FILE', '@runtime/logs/swoole.log'),
'task_worker_num' => env('TASK_WORKER_NUM', 1),
'package_max_length' => env('PACKAGE_MAX_LENGTH', 2048),
'upload_tmp_dir' => env('UPLOAD_TMP_DIR', '@runtime/uploadfiles'),
'document_root' => env('DOCUMENT_ROOT', BASE_PATH . '/public'),
'enable_static_handler' => env('ENABLE_STATIC_HANDLER', true),
'open_http2_protocol' => env('OPEN_HTTP2_PROTOCOL', false),
'ssl_cert_file' => env('SSL_CERT_FILE', ''),
'ssl_key_file' => env('SSL_KEY_FILE', ''),
'task_ipc_mode' => env('TASK_IPC_MODE', 1),
'message_queue_key' => env('MESSAGE_QUEUE_KEY', 0x70001001),
'task_tmpdir' => env('TASK_TMPDIR', '/tmp'),
],
];
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment