Skip to content

Commit

Permalink
Upgrade to v2.2 (hyperf#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo authored Jul 11, 2021
1 parent 1e3750f commit 4ceba76
Show file tree
Hide file tree
Showing 16 changed files with 426 additions and 109 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# @contact group@hyperf.io
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE

FROM hyperf/hyperf:7.4-alpine-v3.11-swoole
FROM hyperf/hyperf:8.0-alpine-v3.12-swoole
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"

##
Expand All @@ -25,7 +25,7 @@ RUN set -ex \
&& php -m \
&& php --ri swoole \
# ---------- some config ----------
&& cd /etc/php7 \
&& cd /etc/php8 \
# - config PHP
&& { \
echo "upload_max_filesize=128M"; \
Expand Down
4 changes: 2 additions & 2 deletions .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
@license https://github.com/hyperf/hyperf/blob/master/LICENSE
EOF;

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@DoctrineAnnotation' => true,
'@PhpCsFixer' => true,
'header_comment' => [
'commentType' => 'PHPDoc',
'comment_type' => 'PHPDoc',
'header' => $header,
'separate' => 'none',
'location' => 'after_declare_strict',
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# @contact group@hyperf.io
# @license https://github.com/hyperf/hyperf/blob/master/LICENSE

FROM hyperf/hyperf:7.4-alpine-v3.11-swoole
FROM hyperf/hyperf:8.0-alpine-v3.12-swoole
LABEL maintainer="Hyperf Developers <group@hyperf.io>" version="1.0" license="MIT" app.name="Hyperf"

##
Expand All @@ -25,7 +25,7 @@ RUN set -ex \
&& php -m \
&& php --ri swoole \
# ---------- some config ----------
&& cd /etc/php7 \
&& cd /etc/php8 \
# - config PHP
&& { \
echo "upload_max_filesize=128M"; \
Expand Down
29 changes: 15 additions & 14 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,25 @@
"license": "Apache-2.0",
"require": {
"php": ">=7.3",
"hyperf/cache": "~2.1.0",
"hyperf/command": "~2.1.0",
"hyperf/config": "~2.1.0",
"hyperf/db-connection": "~2.1.0",
"hyperf/framework": "~2.1.0",
"hyperf/guzzle": "~2.1.0",
"hyperf/http-server": "~2.1.0",
"hyperf/logger": "~2.1.0",
"hyperf/memory": "~2.1.0",
"hyperf/process": "~2.1.0"
"hyperf/cache": "~2.2.0",
"hyperf/command": "~2.2.0",
"hyperf/config": "~2.2.0",
"hyperf/db-connection": "~2.2.0",
"hyperf/framework": "~2.2.0",
"hyperf/guzzle": "~2.2.0",
"hyperf/http-server": "~2.2.0",
"hyperf/logger": "~2.2.0",
"hyperf/memory": "~2.2.0",
"hyperf/process": "~2.2.0"
},
"require-dev": {
"swoole/ide-helper": "^4.5",
"friendsofphp/php-cs-fixer": "^3.0",
"hyperf/devtool": "~2.2.0",
"hyperf/ide-helper": "~2.2.0",
"hyperf/testing": "~2.2.0",
"mockery/mockery": "^1.0",
"phpstan/phpstan": "^0.12",
"hyperf/devtool": "~2.1.0",
"hyperf/testing": "~2.1.0"
"swoole/ide-helper": "^4.5"
},
"suggest": {
"ext-openssl": "Required to use HTTPS.",
Expand Down Expand Up @@ -68,7 +69,7 @@
"post-autoload-dump": [
"rm -rf runtime/container"
],
"test": "co-phpunit -c phpunit.xml --colors=always",
"test": "co-phpunit --prepend test/bootstrap.php -c phpunit.xml --colors=always",
"cs-fix": "php-cs-fixer fix $1",
"analyse": "phpstan analyse --memory-limit 300M -l 0 -c phpstan.neon ./app ./config",
"start": [
Expand Down
54 changes: 32 additions & 22 deletions installer/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,61 +12,61 @@
return [
'packages' => [
'hyperf/amqp' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/async-queue' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/database' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/db-connection' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/model-cache' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/constants' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/json-rpc' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/redis' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/rpc' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/rpc-client' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/rpc-server' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/grpc-client' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/grpc-server' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/elasticsearch' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/config-apollo' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/config-aliyun-acm' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/config-etcd' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/tracer' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
'hyperf/service-governance' => [
'version' => '~2.1.0',
'version' => '~2.2.0',
],
],
'require-dev' => [
Expand Down Expand Up @@ -160,7 +160,7 @@
'hyperf/config-apollo',
],
'resources' => [
'resources/config_center/apollo.php' => 'config/autoload/apollo.php',
'resources/config_center/config_apollo.php' => 'config/autoload/config_center.php',
],
],
2 => [
Expand All @@ -169,7 +169,7 @@
'hyperf/config-aliyun-acm',
],
'resources' => [
'resources/config_center/aliyun_acm.php' => 'config/autoload/aliyun_acm.php',
'resources/config_center/config_acm.php' => 'config/autoload/config_center.php',
],
],
3 => [
Expand All @@ -179,7 +179,17 @@
],
'resources' => [
'resources/config_center/etcd.php' => 'config/autoload/etcd.php',
'resources/config_center/config_etcd.php' => 'config/autoload/config_etcd.php',
'resources/config_center/config_etcd.php' => 'config/autoload/config_center.php',
],
],
4 => [
'name' => 'Nacos',
'packages' => [
'hyperf/config-nacos',
],
'resources' => [
'resources/config_center/nacos.php' => 'config/autoload/nacos.php',
'resources/config_center/config_nacos.php' => 'config/autoload/config_center.php',
],
],
],
Expand Down
28 changes: 15 additions & 13 deletions installer/resources/amqp/amqp.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,30 @@
*/
return [
'default' => [
'host' => 'localhost',
'port' => 5672,
'user' => 'guest',
'password' => 'guest',
'vhost' => '/',
'host' => env('AMQP_HOST', 'localhost'),
'port' => (int) env('AMQP_PORT', 5672),
'user' => env('AMQP_USER', 'guest'),
'password' => env('AMQP_PASSWORD', 'guest'),
'vhost' => env('AMQP_VHOST', '/'),
'concurrent' => [
'limit' => 1,
],
'pool' => [
'min_connections' => 1,
'max_connections' => 10,
'connect_timeout' => 10.0,
'wait_timeout' => 3.0,
'heartbeat' => -1,
'connections' => 2,
],
'params' => [
'insist' => false,
'login_method' => 'AMQPLAIN',
'login_response' => null,
'locale' => 'en_US',
'connection_timeout' => 3.0,
'read_write_timeout' => 6.0,
'connection_timeout' => 3,
'read_write_timeout' => 6,
'context' => null,
'keepalive' => false,
'keepalive' => true,
'heartbeat' => 3,
'channel_rpc_timeout' => 0.0,
'close_on_destruct' => false,
'max_idle_channels' => 10,
],
],
];
4 changes: 4 additions & 0 deletions installer/resources/async_queue/QueueHandleListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/
namespace App\Listener;

use Hyperf\AsyncQueue\AnnotationJob;
use Hyperf\AsyncQueue\Event\AfterHandle;
use Hyperf\AsyncQueue\Event\BeforeHandle;
use Hyperf\AsyncQueue\Event\Event;
Expand Down Expand Up @@ -57,6 +58,9 @@ public function process(object $event)
if ($event instanceof Event && $event->message->job()) {
$job = $event->message->job();
$jobClass = get_class($job);
if ($job instanceof AnnotationJob) {
$jobClass = sprintf('Job[%s@%s]', $job->class, $job->method);
}
$date = date('Y-m-d H:i:s');

switch (true) {
Expand Down
8 changes: 7 additions & 1 deletion installer/resources/async_queue/async_queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,16 @@
return [
'default' => [
'driver' => Hyperf\AsyncQueue\Driver\RedisDriver::class,
'channel' => 'queue',
'redis' => [
'pool' => 'default',
],
'channel' => '{queue}',
'timeout' => 2,
'retry_seconds' => 5,
'handle_timeout' => 10,
'processes' => 1,
'concurrent' => [
'limit' => 10,
],
],
];
21 changes: 0 additions & 21 deletions installer/resources/config_center/aliyun_acm.php

This file was deleted.

22 changes: 0 additions & 22 deletions installer/resources/config_center/apollo.php

This file was deleted.

Loading

0 comments on commit 4ceba76

Please sign in to comment.