Skip to content

Commit

Permalink
Merge pull request #651 from jingjingxyk/experiment-webui
Browse files Browse the repository at this point in the history
Experiment 更新文档
  • Loading branch information
jingjingxyk committed Jun 9, 2024
2 parents 96f5dd5 + 62dd3a4 commit 6193e68
Show file tree
Hide file tree
Showing 15 changed files with 252 additions and 64 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/linux-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql --with-libavif=1
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql --with-build-type=release --with-libavif=1
bash make-install-deps.sh
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/linux-x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile --no-dev
composer dump-autoload --optimize --profile --no-dev
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql --with-libavif=1
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +pgsql --with-build-type=release --with-libavif=1
bash make-install-deps.sh
Expand All @@ -167,7 +167,7 @@ jobs:
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php --list-tests
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/MainTest.php
./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/SwoolePGSQLTest.php
# ./bin/swoole-cli ./vendor/bin/phpunit ./sapi/src/UnitTest/SwoolePGSQLTest.php
- name: production artifacts debug
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macos-aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ jobs:
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 --with-build-type=release --with-swoole-pgsql=1
php prepare.php --without-docker=1 +ds +apcu +xlswriter +ssh2 +pgsql --with-build-type=release --with-libavif=1
- name: Build
run: |
Expand Down
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,28 @@
## 相关文章

- [Swoole-Cli 介绍](https://zhuanlan.zhihu.com/p/581695339)
- [Swoole-Cli 使用说明](https://wenda.swoole.com/detail/108876)
- [Swoole-Cli v5.0.0 版本新特性预览之新的运行模式](https://zhuanlan.zhihu.com/p/459983471)
- [Swoole-Cli 介绍、使用说明](https://wenda.swoole.com/detail/108876)
- [Swoole-Cli 5.0.1 使用说明](https://wenda.swoole.com/detail/108876)
- [Swoole-Cli v5.0.1 PHP 的二进制发行版](https://zhuanlan.zhihu.com/p/581695339)
- [Swoole-Cli v5.0.2 增加 opcache/readline 扩展,强化 Cli-Server](https://zhuanlan.zhihu.com/p/610014616)
- [Swoole-Cli v5.0.0 版本新特性预览之新的运行模式](https://wenda.swoole.com/detail/108706)
- [Swoole-Cli v5.0.2 增加 opcache/readline 扩展,强化 Cli-Server](https://wenda.swoole.com/detail/108931)
- [Swoole-Cli 已提供 Windows 平台 (cygwin64)支持](https://wenda.swoole.com/detail/108743)
- [Swoole 5.1 增加更多数据库协程客户端支持](https://wenda.swoole.com/detail/109023)
- [Swoole v6 要来了!即将增加多线程支持](https://segmentfault.com/a/1190000044737434)
- [Swoole v6 开发计划 - 支持多线程运行模式](https://github.com/swoole/rfc/issues/85)
- [phpy:连接 PHP 与 Python 互调用库,为 PHP 引入 Python 生态,PHP 也可以写 AI 了](https://wenda.swoole.com/detail/109176)

### 相关文章 知乎

- [Swoole-Cli v5.0.1 PHP 的二进制发行版](https://zhuanlan.zhihu.com/p/581695339)
- [Swoole-Cli v5.0.2 增加 opcache/readline 扩展,强化 Cli-Server](https://zhuanlan.zhihu.com/p/610014616)
- [Swoole v6 即将增加多线程支持](https://zhuanlan.zhihu.com/p/688462525)
- [phpy:连接 PHP 与 Python 互调用库,为 PHP 引入 Python 生态,PHP 也可以写 AI 了](https://zhuanlan.zhihu.com/p/670373512)

## 下载`swoole-cli`发行版

- [https://www.swoole.com/download](https://www.swoole.com/download) (recommend)
- [https://github.com/swoole/swoole-src/releases](https://github.com/swoole/swoole-src/releases)
- [https://github.com/swoole/swoole-cli/releases](https://github.com/swoole/swoole-cli/releases)
- [https://github.com/swoole/swoole-src/releases](https://github.com/swoole/swoole-src/releases)

## `swoole-cli`构建文档

Expand Down
18 changes: 15 additions & 3 deletions build-release-example.sh
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,14 @@ while [ $# -gt 0 ]; do
export HTTP_PROXY="$2"
export HTTPS_PROXY="$2"
NO_PROXY="127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16"
NO_PROXY="${NO_PROXY},127.0.0.1,localhost"
NO_PROXY="${NO_PROXY},::1/128,fe80::/10,fd00::/8,ff00::/8"
NO_PROXY="${NO_PROXY},localhost"
NO_PROXY="${NO_PROXY},.aliyuncs.com,.aliyun.com"
NO_PROXY="${NO_PROXY},.tsinghua.edu.cn,.ustc.edu.cn"
NO_PROXY="${NO_PROXY},.tencent.com"
NO_PROXY="${NO_PROXY},.sourceforge.net"
NO_PROXY="${NO_PROXY},ftpmirror.gnu.org"
NO_PROXY="${NO_PROXY},gitee.com,gitcode.com"
NO_PROXY="${NO_PROXY},.myqcloud.com,.swoole.com"
export NO_PROXY="${NO_PROXY},.npmmirror.com"

WITH_HTTP_PROXY=1
Expand Down Expand Up @@ -98,6 +101,15 @@ while [ $# -gt 0 ]; do
shift $(($# > 0 ? 1 : 0))
done

if [ "$OS" = 'linux' ] ; then
if [ ! "$BASH_VERSION" ] ; then
echo "Please use bash to run this script ($0) " 1>&2
echo "fix : " 1>&2
echo "apk add bash' or sh sapi/quickstart/linux/alpine-init.sh " 1>&2
exit 1
fi
fi

# 构建环境依赖检查
CMDS_NUMS=0
CMDS=("flex" "pkg-config" "cmake" "re2c" "bison" "curl" "automake" "libtool" "clang" "xz" "zip" "unzip" "autoconf")
Expand Down Expand Up @@ -207,7 +219,7 @@ fi


# 定制构建选项
OPTIONS='+apcu +ds +xlswriter +ssh2'
OPTIONS="${OPTIONS} +apcu +ds +xlswriter +ssh2 +uuid "
OPTIONS="${OPTIONS} --with-libavif=1"
OPTIONS="${OPTIONS} --with-global-prefix=${LIBRARY_INSTALL_PREFIX}"
# OPTIONS="${OPTIONS} @macos"
Expand Down
46 changes: 29 additions & 17 deletions docs/Cygwin.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,19 @@
## 安装cygwin 和 cygwin 依赖项

> 打开 windows 控制台,并找到 setup-x86_64.exe 所在目录, 执行如下命令
> 打开 windows 控制台,并找到 setup-x86_64.exe 所在目录, 将 setup-x86_64.exe 复制到 `sapi\quickstart\windows\` 目录
> 执行如下命令
```bash
# 安装 cygwin
setup-x86_64.exe --site https://mirrors.ustc.edu.cn/cygwin/

# 安装 cygwin 依赖项
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages zip unzip icu libicu-devel

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages libpq5 libpq-devel
# 自动安装 cygwin 和 cygwin 依赖项
sapi\quickstart\windows\install-cygwin.bat


# 打开 cygwin64 Terminal
```

构建步骤
------
首先需要安装上述工具和库,然后 Clone 项目,并切换 `ext/swoole`
到对应的分支,如 `4.8.x``master` (`5.0.x`)
构建步骤 - 执行的命令
====
> 运行如下步骤,需要先 打开 cygwin64 Terminal
```shell

Expand All @@ -44,15 +36,15 @@ git clone --recursive https://github.com/swoole/swoole-cli.git

cd swoole-cli

# git submodule update --init
# git submodule update --init -f

bash ./sapi/scripts/cygwin/install-re2c.sh

bash ./sapi/scripts/cygwin/cygwin-config-ext.sh
bash ./sapi/scripts/cygwin/cygwin-config.sh
bash ./sapi/scripts/cygwin/cygwin-build.sh
bash ./sapi/scripts/cygwin/cygwin-archive.sh


```

构建步骤说明
Expand Down Expand Up @@ -126,3 +118,23 @@ libicu-devel
icu
```

## 安装 cygwin 和 安装 cygwin 依赖项 具体执行的命令

> `sapi\quickstart\windows\install-cygwin.bat` 脚本包含的内容
```bash
# 安装 cygwin
setup-x86_64.exe --site https://mirrors.ustc.edu.cn/cygwin/

# 安装 cygwin 依赖项
setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages make,git,curl,wget,tar,libtool,bison,gcc-g++,autoconf,automake,openssl,libpcre2-devel,libssl-devel,libcurl-devel,libxml2-devel,libxslt-devel,libgmp-devel,ImageMagick,libpng-devel,libjpeg-devel,libfreetype-devel,libwebp-devel,libsqlite3-devel,zlib-devel,libbz2-devel,liblz4-devel,liblzma-devel,libzip-devel,libicu-devel,libonig-devel,libcares-devel,libsodium-devel,libyaml-devel,libMagick-devel,libzstd-devel,libbrotli-devel,libreadline-devel,libintl-devel,libpq-devel,libssh2-devel,libidn2-devel,gettext-devel,coreutils,openssl-devel

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages zip unzip icu libicu-devel

setup-x86_64.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode --disable-buggy-antivirus --site https://mirrors.ustc.edu.cn/cygwin/ --packages libpq5 libpq-devel


# 打开 cygwin64 Terminal
```

62 changes: 61 additions & 1 deletion docs/linux.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
# linux 环境下构建 swoole-cli

## 运行环境要求

1. 容器 docker 运行环境

构建步骤 - 运行命令
====

```shell

git clone --recursive https://github.com/swoole/swoole-cli.git
cd swoole-cli

bash setup-php-runtime.sh
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile

php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +uuid
bash ./make.sh docker-build
bash ./make.sh docker-bash

bash sapi/quickstart/linux/alpine-init.sh

# 进入容器后需要再一次执行此命令
php prepare.php +inotify +apcu +ds +xlswriter +ssh2 +uuid
bash ./make.sh all-library
bash ./make.sh config
bash ./make.sh build
bash ./make.sh archive

./bin/swoole-cli -m
./bin/swoole-cli --ri swoole
file ./bin/swoole-cli

```

构建镜像
====
`Linux` 下需要在容器中构建,因此需要先构建 `swoole-cli-builder:base` 基础镜像。
Expand All @@ -16,7 +53,7 @@
快速初始化构建环境
====

不执行 `./make.sh docker-build [china|ustc|tuna] ` 生成基础镜像
跳过生成容器基础镜像
使用如下命令快速进入容器环境
便捷调整构建环境

Expand Down Expand Up @@ -73,3 +110,26 @@ make: ext/opcache/minilua: No such file or directory
rm ext/opcache/minilua
./make.sh build
```

docker no found
----
> 快速安装 docker 运行环境
```bash

bash sapi/quickstart/linux/install-docker.sh

# 使用中国镜像
bash sapi/quickstart/linux/install-docker.sh --mirror china


```

fix slow alpine apk installations
----

```bash

bash sapi/quickstart/linux/alpine-init.sh --mirror china

```
36 changes: 34 additions & 2 deletions docs/macOS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,39 @@
# 步骤
# macOS 环境下构建 swoole-cli

构建步骤 - 运行命令
====

```shell

git clone --recursive https://github.com/swoole/swoole-cli.git
cd swoole-cli

bash setup-php-runtime.sh
composer install --no-interaction --no-autoloader --no-scripts --profile
composer dump-autoload --optimize --profile

php prepare.php --without-docker=1 +inotify +apcu +ds +xlswriter +ssh2 +uuid

bash sapi/quickstart/macos/macos-init.sh

bash ./make.sh all-library
bash ./make.sh config
bash ./make.sh build
bash ./make.sh archive

./bin/swoole-cli -m
./bin/swoole-cli --ri swoole
xattr -cr ./bin/swoole-cli
otool -L ./bin/swoole-cli


```

构建步骤简述
====

0. 清理 `brew` 安装的软件
1. 执行 `php prepare.php --without-docker=1`
1. 执行 `php prepare.php --without-docker=1` 生成构建shell 脚本
2. 编译所有依赖的库 `./make.sh all-library`
3. 配置 `./make.sh config`
4. 构建 `./make.sh build`
Expand Down
23 changes: 13 additions & 10 deletions prepare.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,19 @@
EOF;
$proxyConfig .= PHP_EOL;
$proxyConfig .= <<<'EOF'
export NO_PROXY="127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16"
export NO_PROXY="${NO_PROXY},127.0.0.1,localhost"
export NO_PROXY="${NO_PROXY},.aliyuncs.com,.aliyun.com,.tencent.com"
export NO_PROXY="${NO_PROXY},.tsinghua.edu.cn,.ustc.edu.cn,.npmmirror.com"
export NO_PROXY="${NO_PROXY},dl-cdn.alpinelinux.org"
export NO_PROXY="${NO_PROXY},deb.debian.org,security.debian.org"
export NO_PROXY="${NO_PROXY},archive.ubuntu.com,security.ubuntu.com"
export NO_PROXY="${NO_PROXY},pypi.python.org,bootstrap.pypa.io"
export NO_PROXY="${NO_PROXY},.sourceforge.net"
export NO_PROXY="${NO_PROXY},.gitee.com"
NO_PROXY="127.0.0.0/8,10.0.0.0/8,100.64.0.0/10,172.16.0.0/12,192.168.0.0/16"
NO_PROXY="${NO_PROXY},::1/128,fe80::/10,fd00::/8,ff00::/8"
NO_PROXY="${NO_PROXY},.aliyuncs.com,.aliyun.com,.tencent.com"
NO_PROXY="${NO_PROXY},.tsinghua.edu.cn,.ustc.edu.cn,.npmmirror.com"
NO_PROXY="${NO_PROXY},ftpmirror.gnu.org"
NO_PROXY="${NO_PROXY},gitee.com,gitcode.com"
NO_PROXY="${NO_PROXY},.myqcloud.com,.swoole.com"
NO_PROXY="${NO_PROXY},dl-cdn.alpinelinux.org"
NO_PROXY="${NO_PROXY},deb.debian.org,security.debian.org"
NO_PROXY="${NO_PROXY},archive.ubuntu.com,security.ubuntu.com"
NO_PROXY="${NO_PROXY},pypi.python.org,bootstrap.pypa.io"
export NO_PROXY="${NO_PROXY},localhost"


EOF;
$p->setProxyConfig($proxyConfig, $http_proxy);
Expand Down
7 changes: 3 additions & 4 deletions sapi/download-box/download-box-get-archive-from-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ mkdir -p ${__PROJECT__}/var/download-box/

cd ${__PROJECT__}/var/download-box/

ALL_DEPS_HASH="1b8bbd1b64e196b1d56c940fc62079fac8c2cd106867f9534fadb40ee02beaec"
ALL_DEPS_HASH="5fa1485c2408f05cbc548712917e6dbb8ecd5a631b558d6d512d4a6671f071e5"

DOMAIN='https://github.com/swoole/swoole-cli/releases/download/v5.1.1.0/'
DOMAIN='https://github.com/swoole/swoole-cli/releases/download/v5.1.3.0/'
while [ $# -gt 0 ]; do
case "$1" in
--mirror)
Expand All @@ -36,8 +36,7 @@ while [ $# -gt 0 ]; do
done


URL="${DOMAIN}/all-archive.zip"
# URL="${DOMAIN}/all-deps.zip" # 下一个版本启用此命名
URL="${DOMAIN}/all-deps.zip"

test -f all-deps.zip || curl -Lo all-deps.zip ${URL}

Expand Down
4 changes: 2 additions & 2 deletions sapi/quickstart/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
```shell

# 自动下载 cygwin
sapi/quickstart/windows/download-cygwin.bat
sapi\quickstart\windows\download-cygwin.bat
# 自动安装 cygwin
sapi/quickstart/windows/install-cygwin.bat
sapi\quickstart\windows\install-cygwin.bat


```
Expand Down
Loading

0 comments on commit 6193e68

Please sign in to comment.