-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refector openswoole #7937
Refector openswoole #7937
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,102 +1,90 @@ | ||
<h1> | ||
<img width="200" height="120" align="center" alt="Open Swoole Logo" src="https://www.swoole.co.uk/images/swoole-logo.svg" /> | ||
</h1> | ||
<p align="center"><a href="https://openswoole.com" target="_blank"><img src="https://openswoole.com/images/swoole-logo.svg#gh-light-mode-only" width="200" /></a></p> | ||
|
||
[![lib-openswoole](https://github.com/openswoole/swoole-src/workflows/lib-openswoole/badge.svg)](https://github.com/openswoole/swoole-src/actions?query=workflow%3Alib-openswoole) | ||
[![ext-openswoole](https://github.com/openswoole/swoole-src/workflows/ext-openswoole/badge.svg)](https://github.com/openswoole/swoole-src/actions?query=workflow%3Aext-openswoole) | ||
[![test-linux](https://github.com/openswoole/swoole-src/workflows/test-linux/badge.svg)](https://github.com/openswoole/swoole-src/actions?query=workflow%3Atest-linux) | ||
[![Coverity Scan Build Status](https://scan.coverity.com/projects/23970/badge.svg)](https://scan.coverity.com/projects/open-swoole-src) | ||
[![codecov](https://codecov.io/gh/openswoole/swoole-src/branch/master/graph/badge.svg)](https://codecov.io/gh/openswoole/swoole-src) | ||
|
||
**Open Swoole (since 2017) is a programmatic server for PHP with async IO, coroutines and fibers: secure, reliable, high performance** | ||
<p align="center"><a href="https://github.com/openswoole/ext-openswoole/actions?query=workflow%3Alib-openswoole"><img src="https://github.com/openswoole/ext-openswoole/workflows/lib-openswoole/badge.svg" alt="lib-openswoole" style="max-width: 100%;"></a> | ||
<a href="https://github.com/openswoole/ext-openswoole/actions?query=workflow%3Aext-openswoole"><img src="https://github.com/openswoole/ext-openswoole/workflows/ext-openswoole/badge.svg" alt="ext-openswoole" style="max-width: 100%;"></a> | ||
<a href="https://github.com/openswoole/ext-openswoole/actions?query=workflow%3Atest-linux"><img src="https://github.com/openswoole/ext-openswoole/workflows/test-linux/badge.svg" alt="test-linux" style="max-width: 100%;"></a> | ||
<a href="https://scan.coverity.com/projects/open-swoole-src" rel="nofollow"><img src="https://camo.githubusercontent.com/74ce2aa24f7fc272064e7afeec3712e0e548cda19202c4af7e42e7cacf2e7f6f/68747470733a2f2f7363616e2e636f7665726974792e636f6d2f70726f6a656374732f32333937302f62616467652e737667" alt="Coverity Scan Build Status" data-canonical-src="https://scan.coverity.com/projects/23970/badge.svg" style="max-width: 100%;"></a></p> | ||
|
||
## Documentation & Community | ||
## Open Swoole | ||
|
||
+ __Documentation__: <https://www.swoole.co.uk/docs> | ||
Open Swoole is a programmatic server for PHP with async IO, coroutines and fibers: secure, reliable, high performance | ||
|
||
+ __Website__: <https://openswoole.com> | ||
+ __Twitter__: <https://twitter.com/openswoole> | ||
+ __Join Slack Group__: <https://goo.gl/forms/wooTTDmhbu30x4qC3> | ||
+ __Join Discord Channel__: <https://discord.gg/5QC57RNPpw> | ||
+ __IDE Helper & API__: <https://github.com/openswoole/ide-helper> | ||
+ __Slack__: <https://goo.gl/forms/wooTTDmhbu30x4qC3> | ||
+ __Discord__: <https://discord.gg/5QC57RNPpw> | ||
+ __IDE Helper__: <https://github.com/openswoole/ide-helper> | ||
|
||
## Installation | ||
## Documentation | ||
|
||
> As with any open source project, Open Swoole always provides the most reliable stability and the most powerful features in **the latest released version**. Please ensure as much as possible that you are using the latest version. | ||
Documentation for Open Swoole can be found on the [Open Swoole website](https://openswoole.com/docs). | ||
|
||
### Compiling requirements | ||
## Installation | ||
|
||
+ Linux, OS X or Cygwin, WSL | ||
+ PHP 7.2.0 or later (The higher the version, the better the performance.) | ||
+ GCC 4.8 or later | ||
> Open Swoole always provides the most reliable stability and the most powerful features in **the latest released version**. Please ensure as much as possible that you are using the latest version. | ||
### 1. Install with PECL (beginners) | ||
### 1. Install or upgrade Open Swoole from multiple distribution channels | ||
|
||
```shell | ||
pecl install openswoole | ||
``` | ||
Please check [Open Swoole Installation Guide](https://openswoole.com/docs/get-started/installation) about how to install Open Swoole on Ubuntu/CentOS/Windows WSL from Docker, PECL or Binary releases channels. | ||
|
||
### 2. Install from source (recommended) | ||
### 2. Compile from source | ||
|
||
Please download the source packages from [Releases](https://github.com/openswoole/swoole-src/releases) or: | ||
#### Compiling requirements | ||
|
||
```shell | ||
git clone https://github.com/openswoole/swoole-src.git && \ | ||
cd swoole-src | ||
git checkout v4.8.0 | ||
``` | ||
+ Linux, OS X or Cygwin, WSL | ||
+ PHP 7.4.0 or later (The higher the version, the better the performance.) | ||
+ GCC 4.8 or later | ||
|
||
Compile and install at the source folder: | ||
Download the source packages from [Releases](https://github.com/openswoole/ext-openswoole/releases) or: | ||
|
||
```shell | ||
git clone https://github.com/openswoole/ext-openswoole.git && \ | ||
cd ext-openswoole | ||
git checkout v22.0.0 | ||
phpize && \ | ||
./configure && \ | ||
make && make install | ||
``` | ||
|
||
#### Enable extension in PHP | ||
|
||
After compiling and installing the openswoole extension, you have to add a new line `extension=openswoole.so` to `php.ini` to enable Open Swoole. It is recommended to be added after all the other extensions because openswoole may depend on extensions: sockets, mysqlnd, curl etc. | ||
You can find how to fix [Common Installation Errors](https://openswoole.com/docs/get-started/common-install-errors) if there are errors in the installation. | ||
|
||
#### Extra compile configurations | ||
#### Compile configurations | ||
|
||
> for example: `./configure --enable-openssl --enable-sockets` | ||
+ `--enable-openssl` or `--with-openssl-dir=DIR` | ||
+ `--enable-sockets` | ||
+ `--enable-http2` | ||
+ `--enable-mysqlnd` (need mysqlnd, it just for supporting `$mysql->escape` method) | ||
+ `--enable-swoole-json` | ||
+ `--enable-swoole-curl` | ||
+ `--enable-hook-curl` | ||
+ `--with-postgres[=DIR]` | ||
|
||
### Upgrade | ||
#### Enable Open Swoole extension | ||
|
||
> If you upgrade from source, don't forget to `make clean` before you upgrade your swoole | ||
After compiling and installing the openswoole extension, you have to add a new line `extension=openswoole.so` at the end of `php.ini` or create a ini file at `conf.d` folder to enable Open Swoole. It is recommended to be added after all the other extensions because openswoole may depend on extensions: sockets, mysqlnd, curl etc. | ||
|
||
1. `pecl upgrade openswoole` | ||
2. `cd swoole-src && git pull && make clean && make && sudo make install` | ||
3. if you have changed PHP version, please re-run `phpize clean && phpize` then try to compile | ||
## Frameworks & Components | ||
|
||
## Call for Contributors | ||
> PR are welcome if your framework is using openswoole | ||
- [**Laravel Octane**](https://laravel.com/docs/9.x/octane) Laravel Octane supercharges your application's performance by serving your application using high-powered application servers. | ||
- [**PHP Runtime**](https://github.com/php-runtime) make it easy to run any kind of PHP Application (Symfony, Laravel, PSR7, Native) with all kinds of Runtimes like OpenSwoole, Bref, Google Cloud Functions, Roadrunner and React PHP with minimal configuration. | ||
- [**Mezzio Swoole**](https://docs.mezzio.dev/mezzio-swoole/) allows you to run Mezzio and [PSR-15](https://www.php-fig.org/psr/psr-15/) applications on Open Swoole. | ||
|
||
## For Contributors | ||
|
||
If you like to involve the maintenance of this repo, it is better to get started by submitting PR, you will be invited to the dev group once there are significant contributions. Or join Slack group firstly, the team will provide mentoring and internal support to help you get started. | ||
|
||
* [Report issues and feedback](https://github.com/openswoole/swoole-src/issues) | ||
* [Report issues and feedback](https://github.com/openswoole/ext-openswoole/issues) | ||
* Submit fixes, features via Pull Request | ||
|
||
This project exists thanks to all the historical [[Contributors](https://github.com/openswoole/swoole-src/graphs/contributors)]. | ||
This project exists thanks to all the historical [[Contributors](https://github.com/openswoole/ext-openswoole/graphs/contributors)]. | ||
|
||
## Security issues | ||
|
||
Security issues should be reported privately, via email, to the Open Swoole develop team [[email protected]](mailto:[email protected]). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. | ||
|
||
## Frameworks & Components | ||
|
||
> PR are welcome if your framework is using openswoole | ||
- [**Laravel Octane**](https://laravel.com/docs/8.x/octane) Laravel Octane supercharges your application's performance by serving your application using high-powered application servers. | ||
- [**PHP Runtime**](https://github.com/php-runtime) make it easy to run any kind of PHP Application (Symfony, Laravel, PSR7, Native) with all kinds of Runtimes like OpenSwoole, Bref, Google Cloud Functions, Roadrunner and React PHP with minimal configuration. | ||
- [**Mezzio Swoole**](https://docs.mezzio.dev/mezzio-swoole/) allows you to run Mezzio and [PSR-15](https://www.php-fig.org/psr/psr-15/) applications on Open Swoole. | ||
Security issues should be reported privately, via email, to the Open Swoole develop team [[email protected]](mailto:[email protected]). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. | ||
|
||
## License | ||
|
||
Apache License Version 2.0 see http://www.apache.org/licenses/LICENSE-2.0.html | ||
Open Swoole is open-sourced software licensed under the [Apache 2.0 license](http://www.apache.org/licenses/LICENSE-2.0.html). |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"require": { | ||
"openswoole/core": "dev-master" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,21 @@ | ||
FROM php:8.1-cli | ||
FROM php:8.2-cli | ||
|
||
RUN apt-get update && apt-get install -y git > /dev/null | ||
|
||
RUN docker-php-ext-install opcache pdo_mysql > /dev/null | ||
|
||
RUN pecl install openswoole > /dev/null && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't really know PHP, but does this pin the version of Openswoole? I noticed that the Dockerfile for the PostgreSQL permutation was using a different approach. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the Postgres driver is not installed by default with Swoole and OpenSwoole, and need to compile with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I see, but the main point still stands - does this pin the version of Openswoole? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, pecl don't use semver or an updating system. I try that all the PHP ecosystem in this bench, is updated and working. Also with PHP, we use the major version. All the minor versions are automatic. When fail I try to fix it or create an issue in the fw (so the bench also is used to find bugs) and if necessary I marked them as broken. No PHP framework stay more than ~3 months failing in the runs. Swoole was updated Dec, 2022 #7788 and OpenSwoole in Nov, 2022 #7665 and both working. Only check the work for major PHP versions from 2021: #6184, #6894, #7703 (still updating) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You made the PR to mark as broken a lot of frameworks. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ultimately it is up to the TechEmpower team to set policies, but my impression is that they prefer when all dependency versions are pinned, which also makes it possible to reproduce results. The reason you have opened so many pull requests is because you have changed one or a few implementations in each one, but there is no requirement to do it that way - if you update versions every quarter, you can just do 4 PRs in a year. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was thinking so, the first time that I tried to update a major PHP version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be ideal if we could pin the version of OpenSwoole. If you used the same opening lines as the postgres dockerfile at least the compilation step could be cached. Would there be any issues using OpenSwoole with other tests if it's using the configure with postgres option? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The mysql variants aren't compiled. The good think is that now the 2 mysql variants dockerfiles are identical, and so 1 variant use 1s. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
docker-php-ext-enable openswoole | ||
|
||
RUN docker-php-ext-install opcache pdo_mysql > /dev/null | ||
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer | ||
|
||
COPY php.ini /usr/local/etc/php/ | ||
|
||
ADD ./ /openswoole | ||
WORKDIR /openswoole | ||
|
||
COPY php.ini /usr/local/etc/php/ | ||
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet | ||
|
||
EXPOSE 8080 | ||
|
||
CMD php swoole-server-noasync.php | ||
CMD php /openswoole/openswoole-server-pdo.php |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
FROM php:8.1-cli | ||
FROM php:8.2-cli | ||
|
||
RUN apt-get update && apt-get install -y git > /dev/null | ||
|
||
RUN docker-php-ext-install opcache > /dev/null | ||
|
||
ENV SWOOLE_VERSION 4.8.0 | ||
ENV VERSION 22.0.0 | ||
|
||
RUN apt-get update && apt-get install -y libpq-dev \ | ||
&& cd /tmp && curl -sSL "https://github.com/openswoole/swoole-src/archive/v${SWOOLE_VERSION}.tar.gz" | tar xzf - \ | ||
&& cd swoole-src-${SWOOLE_VERSION} \ | ||
&& cd /tmp && curl -sSL "https://github.com/openswoole/ext-openswoole/archive/v${VERSION}.tar.gz" | tar xzf - \ | ||
&& cd ext-openswoole-${VERSION} \ | ||
&& phpize && ./configure --with-postgres > /dev/null && make > /dev/null && make install > /dev/null \ | ||
&& docker-php-ext-enable openswoole | ||
|
||
WORKDIR /openswoole | ||
|
||
COPY swoole-server.php swoole-server.php | ||
RUN sed -i "s|_postgres||g" swoole-server.php | ||
COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer | ||
|
||
COPY php.ini /usr/local/etc/php/ | ||
|
||
ADD ./ /openswoole | ||
WORKDIR /openswoole | ||
|
||
RUN composer install --optimize-autoloader --classmap-authoritative --no-dev --quiet | ||
|
||
EXPOSE 8080 | ||
|
||
CMD php swoole-server.php | ||
CMD php /openswoole/openswoole-server-postgres.php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Postgres variant is deleted in config.json.
But you created an Open Swoole Postgres server, and never will be executed.
Please add again the postgres variant here.