From 08fb3bfaf53961ec6534af13b9ab33422ab31971 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 10 Jul 2024 17:57:37 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E8=BF=9E=E6=8E=A5=20docker-bash=20?= =?UTF-8?q?=E7=94=9F=E6=88=90=E7=9A=84=E5=AE=B9=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../linux/connection-swoole-cli-builder.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 sapi/quickstart/linux/connection-swoole-cli-builder.sh diff --git a/sapi/quickstart/linux/connection-swoole-cli-builder.sh b/sapi/quickstart/linux/connection-swoole-cli-builder.sh new file mode 100644 index 0000000000..8fd8ffcd10 --- /dev/null +++ b/sapi/quickstart/linux/connection-swoole-cli-builder.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +set -exu +__DIR__=$( + cd "$(dirname "$0")" + pwd +) + +cd ${__DIR__} + +docker exec -it swoole-cli-builder sh + From 102bfe1d50f67b10df4241faf28b97c7b861b1b1 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 10 Jul 2024 20:38:18 +0800 Subject: [PATCH 2/6] update install-docker.sh --- sapi/quickstart/linux/install-docker.sh | 35 ++++++++++++++++--------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/sapi/quickstart/linux/install-docker.sh b/sapi/quickstart/linux/install-docker.sh index 46c4b77ce7..c8b0f7f8fc 100644 --- a/sapi/quickstart/linux/install-docker.sh +++ b/sapi/quickstart/linux/install-docker.sh @@ -15,18 +15,6 @@ mkdir -p ${__PROJECT__}/var cd ${__PROJECT__}/var -# https://github.com/docker/docker-install.git - - -# test -f get-docker.sh || curl -fsSL https://get.docker.com -o get-docker.sh -test -f get-docker.sh || curl -fsSL https://github.com/docker/docker-install/blob/master/install.sh?raw=true -o get-docker.sh - -if [ -n "$http_proxy" ] || [ -n "$https_proxy" ] || [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then - echo 'Please delete proxy settings !' - echo 'Execute this script again !' - exit 0 -fi - MIRROR='' while [ $# -gt 0 ]; do case "$1" in @@ -40,8 +28,29 @@ while [ $# -gt 0 ]; do shift $(($# > 0 ? 1 : 0)) done + +# https://github.com/docker/docker-install.git +# test -f get-docker.sh || curl -fsSL https://get.docker.com -o get-docker.sh + +case "$MIRROR" in +china | ustc | tuna) + test -f get-docker.sh || curl -fsSL https://gitee.com/jingjingxyk/docker-install/raw/master/install.sh -o get-docker.sh + ;; +*) + test -f get-docker.sh || curl -fsSL https://github.com/docker/docker-install/blob/master/install.sh?raw=true -o get-docker.sh + ;; +esac + + +if [ -n "$http_proxy" ] || [ -n "$https_proxy" ] || [ -n "$HTTP_PROXY" ] || [ -n "$HTTPS_PROXY" ]; then + echo 'Please delete proxy settings !' + echo 'Execute this script again !' + exit 0 +fi + + case "$MIRROR" in -china|ustc) +china | ustc) sed -i "s@https://mirrors.aliyun.com/docker-ce@https://mirrors.ustc.edu.cn/docker-ce@g" get-docker.sh sed -i "s@Aliyun)@china)@g" get-docker.sh sh get-docker.sh --mirror china From e5a5b19cc44b6ad2962686828d71dac054fb197f Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 10 Jul 2024 21:19:32 +0800 Subject: [PATCH 3/6] update linux.md --- docs/linux.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/linux.md b/docs/linux.md index ebba0ba790..f9873d1ea2 100644 --- a/docs/linux.md +++ b/docs/linux.md @@ -16,7 +16,8 @@ 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 +# 生成构建脚本 make.sh +php prepare.php --without-docker --skip-download=1 bash ./make.sh docker-build bash ./make.sh docker-bash From 5276f29fc7ed87b9c6132810b71fa42432f463d8 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Wed, 10 Jul 2024 21:58:30 +0800 Subject: [PATCH 4/6] update run rhel container --- sapi/quickstart/linux/rhel-init.sh | 5 +-- sapi/quickstart/linux/run-rhel-container.sh | 36 +++++++++++++++++++ sapi/quickstart/linux/run-ubuntu-container.sh | 17 ++++++++- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/sapi/quickstart/linux/rhel-init.sh b/sapi/quickstart/linux/rhel-init.sh index 6cfe1bbab2..d75491b9de 100644 --- a/sapi/quickstart/linux/rhel-init.sh +++ b/sapi/quickstart/linux/rhel-init.sh @@ -76,12 +76,13 @@ dnf makecache yum install -y git wget ca-certificates -yum install -y autoconf automake clang lld libtool cmake bison gettext zip unzip +yum install -y autoconf automake clang lld libtool cmake bison gettext zip unzip yum install -y pkg-config bzip2 flex -yum install -y curl-minimal +yum install -y curl-minimal yum install -y xz +yum install -y socat exit 0 yum install -y clang-tools re2c lzip coreutils p7zip diff --git a/sapi/quickstart/linux/run-rhel-container.sh b/sapi/quickstart/linux/run-rhel-container.sh index 6666d2dace..aaf36e645b 100644 --- a/sapi/quickstart/linux/run-rhel-container.sh +++ b/sapi/quickstart/linux/run-rhel-container.sh @@ -24,5 +24,41 @@ cd ${__DIR__} IMAGE=almalinux:9 IMAGE=rockylinux:9 +OS="rocky" +MIRROR='' +while [ $# -gt 0 ]; do + case "$1" in + --os) + OS="$2" + ;; + --mirror) + MIRROR="$2" + ;; + esac + shift $(($# > 0 ? 1 : 0)) +done + + + +case "$OS" in + rocky) + IMAGE=rockylinux:9 + case "$MIRROR" in + china | openatom) + IMAGE="hub.atomgit.com/library/rockylinux:9" + ;; + esac + ;; + alma) + IMAGE=almalinux:9 + case "$MIRROR" in + china | openatom) + IMAGE="hub.atomgit.com/library/almalinux:9" + ;; + esac + ;; +esac + + cd ${__DIR__} docker run --rm --name swoole-cli-rhel-dev -d -v ${__PROJECT__}:/work -w /work $IMAGE tail -f /dev/null diff --git a/sapi/quickstart/linux/run-ubuntu-container.sh b/sapi/quickstart/linux/run-ubuntu-container.sh index 64908bc1b3..a4646cdc06 100644 --- a/sapi/quickstart/linux/run-ubuntu-container.sh +++ b/sapi/quickstart/linux/run-ubuntu-container.sh @@ -18,7 +18,22 @@ cd ${__DIR__} echo $? } cd ${__DIR__} -IMAGE=ubuntu:22.04 +IMAGE=ubuntu:23.10 + +MIRROR='' +while [ $# -gt 0 ]; do + case "$1" in + --mirror) + MIRROR="$2" + case "$MIRROR" in + china | openatom) + IMAGE="hub.atomgit.com/library/ubuntu:23.10" + ;; + esac + ;; + esac + shift $(($# > 0 ? 1 : 0)) +done cd ${__DIR__} docker run --rm --name swoole-cli-ubuntu-dev -d -v ${__PROJECT__}:/work -w /work $IMAGE tail -f /dev/null From d0989eecea79a0f93928907b01e31c481dee0938 Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 11 Jul 2024 12:16:11 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E4=BE=8B=E5=AD=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sapi/src/builder/library/aaa_example.php | 37 +++++++++++------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/sapi/src/builder/library/aaa_example.php b/sapi/src/builder/library/aaa_example.php index 5d93676777..470012d42b 100644 --- a/sapi/src/builder/library/aaa_example.php +++ b/sapi/src/builder/library/aaa_example.php @@ -12,9 +12,10 @@ $lib->withHomePage('https://opencv.org/') ->withLicense('http://www.gnu.org/licenses/lgpl-2.1.html', Library::LICENSE_LGPL) ->withManual('https://github.com/opencv/opencv.git') - /* - //设置现在文件 hash 值验证,hash 值不匹配,下载文件的自动被丢弃 + /* + * + //设置现在文件 hash 值验证,hash 值不匹配,下载文件的自动被丢弃 ->withFileHash('sha1', '32ead1982fed95c52060cd92187a411de3376ac9') ->withFileHash('md5','538378de497a830092cd497e2f963b5d') ->withFileHash('sha256','5dc841d2dc9f492d57d4550c114f15a03d5ee0275975571ebd82a1fca8604176') @@ -68,26 +69,18 @@ EOF ) ->withPrefix($example_prefix) - /* - - // 当--with-build_type=dev 时 如下2个配置才生效 - - // 自动清理构建目录 - ->withCleanBuildDirectory() - // 自动清理安装目录 - ->withCleanPreInstallDirectory($example_prefix) + /* //明确申明 不使用构建缓存 例子: thirdparty/openssl (每次都解压全新源代码到此目录) ->withBuildCached(false) //明确申明 不使用库缓存 例子: /usr/local/swoole-cli/zlib (每次构建都需要安装到此目录) - ->withBuildCached(false) + ->withInstallCached(false) */ - # 构建源码可以使用cmake 、 autoconfig 、 meson 构建等 @@ -178,6 +171,9 @@ PACKAGES='openssl ' PACKAGES="\$PACKAGES zlib" + OPENSSL_CFLAGS=$(pkg-config --cflags --static openssl) + OPENSSL_LIBS=$(pkg-config --libs --static openssl) + CPPFLAGS="$(pkg-config --cflags-only-I --static \$PACKAGES)" \ LDFLAGS="$(pkg-config --libs-only-L --static \$PACKAGES) " \ LIBS="$(pkg-config --libs-only-l --static \$PACKAGES)" \ @@ -197,9 +193,8 @@ /* 使用 autoconfig automake 构建 end */ - /* + /* 默认不需要此配置 - //默认不需要此配置 ->withScriptAfterInstall( <<withScriptAfterInstall( <<withPkgName('libexample') ->withBinPath($example_prefix . '/bin/') //依赖其它静态链接库 - ->withDependentLibraries('zlib', 'openssl')/* + ->withDependentLibraries('zlib', 'openssl') + /* + //默认不需要此配置,特殊目录才需要配置 ->withLdflags('-L' . $example_prefix . '/lib64') @@ -248,6 +246,7 @@ ->withPkgConfig($example_prefix . '/lib/ib64/pkgconfig') */ + ; $p->addLibrary($lib); @@ -263,12 +262,10 @@ */ - /* - //导入需要的变量 + /* 导入需要的变量 $p->withExportVariable('LIBPQ_CFLAGS', '$(pkg-config --cflags --static libpq)'); $p->withExportVariable('LIBPQ_LIBS', '$(pkg-config --libs --static libpq)'); */ }; - From 655837f1412a9fd93e13543ba9d28cb0a2ad0f9c Mon Sep 17 00:00:00 2001 From: jingjingxyk Date: Thu, 11 Jul 2024 12:17:09 +0800 Subject: [PATCH 6/6] update webui --- sapi/webUI/.gitignore | 4 +- sapi/webUI/README.md | 5 + sapi/webUI/bootstrap.php | 6 +- sapi/webUI/deploy.sh | 16 ++++ sapi/webUI/phar-builder.php | 7 ++ sapi/webUI/setup-nodejs-runtime.sh | 144 +++++++++++++++++++++++++++++ sapi/webUI/start-browser.sh | 2 +- 7 files changed, 181 insertions(+), 3 deletions(-) create mode 100644 sapi/webUI/deploy.sh create mode 100644 sapi/webUI/phar-builder.php create mode 100644 sapi/webUI/setup-nodejs-runtime.sh diff --git a/sapi/webUI/.gitignore b/sapi/webUI/.gitignore index bf818ff34d..86209cded8 100644 --- a/sapi/webUI/.gitignore +++ b/sapi/webUI/.gitignore @@ -1,7 +1,9 @@ ./data ./.idea -./deploy.sh ./node_modules ./public/ajax/ ./public/data/ ./package-lock.json +./var/ +./bin/ +./myapp.phar diff --git a/sapi/webUI/README.md b/sapi/webUI/README.md index 6a3b9d78ee..a243ad1699 100644 --- a/sapi/webUI/README.md +++ b/sapi/webUI/README.md @@ -3,6 +3,11 @@ ## 启动 web ui ```shell + +bash build-release-example.sh --webui +# 或者 +php prepare.php --without-docker --skip-download=1 --with-web-ui=1 + # 准备数据 bash sapi/webUI/sync-webui-data.sh diff --git a/sapi/webUI/bootstrap.php b/sapi/webUI/bootstrap.php index 058a215e1d..3cd1399307 100644 --- a/sapi/webUI/bootstrap.php +++ b/sapi/webUI/bootstrap.php @@ -34,7 +34,11 @@ if ($request_uri == '/') { $path = '/index.html'; } - $file = realpath(__DIR__ . '/public/') . $path; + //$file = realpath(__DIR__ . '/public/') . $path; + $file = __DIR__ . '/public/' . $path; + echo __DIR__ . PHP_EOL; + echo $file; + echo PHP_EOL; //printf("%s,%s%s", $path, $file,PHP_EOL); $result = []; diff --git a/sapi/webUI/deploy.sh b/sapi/webUI/deploy.sh new file mode 100644 index 0000000000..5c95b4fbdd --- /dev/null +++ b/sapi/webUI/deploy.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -exu +__DIR__=$( + cd "$(dirname "$0")" + pwd +) +__PROJECT__=${__DIR__} +cd ${__PROJECT__} +bash setup-nodejs-runtime.sh + +export PATH="${__PROJECT__}/bin/runtime/node/bin/:$PATH" + +npm install + +bash sync-frontend-library.sh diff --git a/sapi/webUI/phar-builder.php b/sapi/webUI/phar-builder.php new file mode 100644 index 0000000000..5a0d38b5f1 --- /dev/null +++ b/sapi/webUI/phar-builder.php @@ -0,0 +1,7 @@ +buildFromDirectory(__DIR__); +$phar->startBuffering(); +$phar->setStub($phar->createDefaultStub('bootstrap.php')); +$phar->stopBuffering(); diff --git a/sapi/webUI/setup-nodejs-runtime.sh b/sapi/webUI/setup-nodejs-runtime.sh new file mode 100644 index 0000000000..baa078afd4 --- /dev/null +++ b/sapi/webUI/setup-nodejs-runtime.sh @@ -0,0 +1,144 @@ +#!/bin/bash + +set -exu +__DIR__=$( + cd "$(dirname "$0")" + pwd +) +__PROJECT__=${__DIR__} + +cd ${__PROJECT__} + +OS=$(uname -s) +ARCH=$(uname -m) + +case $OS in +'Linux') + OS="linux" + ;; +'Darwin') + OS="darwin" + ;; +*) + case $OS in + 'MSYS_NT'*) + OS="win" + ;; + 'MINGW64_NT'*) + OS="win" + ;; + *) + echo '暂未配置的 OS ' + exit 0 + ;; + esac + ;; +esac + +case $ARCH in +'x86_64') + ARCH="x64" + ;; +'aarch64' | 'arm64' ) + ARCH="arm64" + ;; +*) + echo '暂未配置的 ARCH ' + exit 0 + ;; +esac + +APP_VERSION='v20.15.1' +APP_NAME='node' +VERSION='v20.15.1' + +mkdir -p bin/runtime +mkdir -p var/runtime + +cd ${__PROJECT__}/var/runtime + +:<<'EOF' +https://nodejs.org/dist/v20.15.1/node-v20.15.1-darwin-x64.tar.gz +https://nodejs.org/dist/v20.15.1/node-v20.15.1-darwin-arm64.tar.gz +https://nodejs.org/dist/v20.15.1/node-v20.15.1-linux-arm64.tar.xz +https://nodejs.org/dist/v20.15.1/node-v20.15.1-linux-arm64.tar.xz +https://nodejs.org/dist/v20.15.1/node-v20.15.1-win-arm64.zip +https://nodejs.org/dist/v20.15.1/node-v20.15.1-win-x64.zip +EOF + +APP_DOWNLOAD_URL="https://nodejs.org/dist/${VERSION}/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.tar.xz" + +if [ $OS = 'win' ]; then + APP_DOWNLOAD_URL="https://nodejs.org/dist/${VERSION}/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.zip" +fi + +MIRROR='' +while [ $# -gt 0 ]; do + case "$1" in + --mirror) + MIRROR="$2" + MIRROR="" + ;; + --proxy) + 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},::1/128,fe80::/10,fd00::/8,ff00::/8" + NO_PROXY="${NO_PROXY},localhost" + NO_PROXY="${NO_PROXY},.aliyuncs.com,.aliyun.com,.tencent.com" + NO_PROXY="${NO_PROXY},.myqcloud.com,.swoole.com" + export NO_PROXY="${NO_PROXY},.tsinghua.edu.cn,.ustc.edu.cn,.npmmirror.com" + ;; + --*) + echo "Illegal option $1" + ;; + esac + shift $(($# > 0 ? 1 : 0)) +done + +case "$MIRROR" in +china) + APP_DOWNLOAD_URL="https://swoole-cli.jingjingxyk.com/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.tar.xz" + if [ $OS = 'windows' ]; then + APP_DOWNLOAD_URL="https://swoole-cli.jingjingxyk.com/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.zip" + fi + ;; +esac + +APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}" +if [ $OS = 'win' ]; then + { + test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL} + test -d ${APP_RUNTIME} && rm -rf ${APP_RUNTIME} + unzip "${APP_RUNTIME}.zip" + exit 0 + } +else + if [ $OS = "darwin" ]; then + test -f ${APP_RUNTIME}.tar.gz || curl -LSo ${APP_RUNTIME}.tar.gz ${APP_DOWNLOAD_URL} + test -d ${APP_RUNTIME} && rm -rf ${APP_RUNTIME} + tar -xvf ${APP_RUNTIME}.tar.gz + + else + test -f ${APP_RUNTIME}.tar.xz || curl -LSo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL} + test -f ${APP_RUNTIME}.tar || xz -d -k ${APP_RUNTIME}.tar.xz + test -d ${APP_RUNTIME} || tar -xvf ${APP_RUNTIME}.tar + fi + test -d ${__PROJECT__}/bin/runtime/node && rm -rf ${__PROJECT__}/bin/runtime/node + mv ${APP_RUNTIME} ${__PROJECT__}/bin/runtime/node +fi + + +cd ${__PROJECT__}/ + +set +x + +echo " " +echo " USE PHP RUNTIME :" +echo " " +echo " export PATH=\"${__PROJECT__}/bin/runtime/node/bin/:\$PATH\" " +echo " " +export PATH="${__PROJECT__}/bin/runtime/node/bin/:$PATH" +node -v +npm -v +npx -v diff --git a/sapi/webUI/start-browser.sh b/sapi/webUI/start-browser.sh index 5d1ef88c71..d1314f48f9 100644 --- a/sapi/webUI/start-browser.sh +++ b/sapi/webUI/start-browser.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -exu __DIR__=$(