From a11be5b2ff8ee6e2dfabb4221f9f4c5842104518 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 3 Jun 2023 09:08:07 +0200 Subject: [PATCH] Deprecate support for openswoole --- CHANGELOG.md | 2 +- CONTRIBUTING.md | 6 +++--- Dockerfile | 2 ++ bin/test/run-api-tests.sh | 2 +- build.sh | 2 ++ composer.json | 2 +- config/autoload/logger.global.php | 1 + config/container.php | 1 + docker/README.md | 2 +- docker/docker-entrypoint.sh | 1 + 10 files changed, 14 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32c5596d..b0cac56b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this * *Nothing* ### Deprecated -* *Nothing* +* [#1783](https://github.com/shlinkio/shlink/issues/1783) Deprecated support for openswoole. RoadRunner is the best replacement, with the same capabilities, but much easier and convenient to install and manage. ### Removed * [#1790](https://github.com/shlinkio/shlink/issues/1790) Drop support for PHP 8.1. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index feb437ad..02325758 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ Then you will have to follow these steps: * Run `./indocker bin/cli db:migrate` to get database migrations up to date. * Run `./indocker bin/cli api-key:generate` to get your first API key generated. -Once you finish this, you will have the project exposed in ports `8000` through nginx+php-fpm and `8080` through openswoole. +Once you finish this, you will have the project exposed in ports `8800` through RoadRunner, `8080` through openswoole and `8000` through nginx+php-fpm. > Note: The `indocker` shell script is a helper tool used to run commands inside the main docker container. @@ -78,7 +78,7 @@ The purposes of every folder are: * `data`: Common runtime-generated git-ignored assets, like logs, caches, etc. * `docs`: Any project documentation is stored here, like API spec definitions or architectural decision records. * `module`: Contains a sub-folder for every module in the project. Modules contain the source code, tests and configurations for every context in the project. -* `public`: Few assets (like `favicon.ico` or `robots.txt`) and the web entry point are stored here. This web entry point is not used when serving the app with openswoole. +* `public`: Few assets (like `favicon.ico` or `robots.txt`) and the web entry point are stored here. This web entry point is not used when serving the app with RoadRunner or openswoole. ## Project tests @@ -94,7 +94,7 @@ In order to ensure stability and no regressions are introduced while developing The project provides some tooling to run them against any of the supported database engines. -* **API tests**: These are E2E tests that spin up an instance of the app with openswoole, and test it from the outside by interacting with the REST API. +* **API tests**: These are E2E tests that spin up an instance of the app with RoadRunner or openswoole, and test it from the outside by interacting with the REST API. These are the best tests to catch regressions, and to verify everything behaves as expected. diff --git a/Dockerfile b/Dockerfile index 4637e09e..8c5a9486 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,6 +29,7 @@ RUN \ # Install openswoole and sqlsrv driver for x86_64 builds RUN apk add --no-cache --virtual .phpize-deps ${PHPIZE_DEPS} unixodbc-dev && \ if [ "$SHLINK_RUNTIME" == 'openswoole' ]; then \ + # Openswoole is deprecated. Remove in v4.0.0 pecl install openswoole-${OPENSWOOLE_VERSION} && \ docker-php-ext-enable openswoole ; \ fi; \ @@ -49,6 +50,7 @@ RUN apk add --no-cache git && \ # FIXME Ignoring ext-openswoole platform req, as it makes install fail with roadrunner, even though it's a dev dependency and we are passing --no-dev php composer.phar install --no-dev --prefer-dist --optimize-autoloader --no-progress --no-interaction --ignore-platform-req=ext-openswoole && \ if [ "$SHLINK_RUNTIME" == 'openswoole' ]; then \ + # Openswoole is deprecated. Remove in v4.0.0 php composer.phar remove spiral/roadrunner spiral/roadrunner-jobs spiral/roadrunner-cli spiral/roadrunner-http --with-all-dependencies --update-no-dev --optimize-autoloader --no-progress --no-interaction ; \ elif [ "$SHLINK_RUNTIME" == 'rr' ]; then \ php composer.phar remove mezzio/mezzio-swoole --with-all-dependencies --update-no-dev --optimize-autoloader --no-progress --no-interaction --ignore-platform-req=ext-openswoole ; \ diff --git a/bin/test/run-api-tests.sh b/bin/test/run-api-tests.sh index 1cbf948a..b22a974e 100755 --- a/bin/test/run-api-tests.sh +++ b/bin/test/run-api-tests.sh @@ -2,7 +2,7 @@ export APP_ENV=test export TEST_ENV=api -export TEST_RUNTIME="${TEST_RUNTIME:-"openswoole"}" +export TEST_RUNTIME="${TEST_RUNTIME:-"openswoole"}" # Openswoole is deprecated. Remove in v4.0.0 export DB_DRIVER="${DB_DRIVER:-"postgres"}" export GENERATE_COVERAGE="${GENERATE_COVERAGE:-"no"}" diff --git a/build.sh b/build.sh index 43b240a2..065aee75 100755 --- a/build.sh +++ b/build.sh @@ -10,6 +10,7 @@ fi version=$1 noSwoole=$2 phpVersion=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;') +# Openswoole is deprecated. Remove in v4.0.0 [[ $noSwoole ]] && swooleSuffix="" || swooleSuffix="_openswoole" distId="shlink${version}_php${phpVersion}${swooleSuffix}_dist" builtContent="./build/${distId}" @@ -38,6 +39,7 @@ if [[ $noSwoole ]]; then # If generating a dist not for openswoole, uninstall mezzio-swoole ${composerBin} remove mezzio/mezzio-swoole --with-all-dependencies --update-no-dev $composerFlags else + # Deprecated. Remove in Shlink v4.0.0 # If generating a dist for openswoole, uninstall RoadRunner ${composerBin} remove spiral/roadrunner spiral/roadrunner-jobs spiral/roadrunner-cli spiral/roadrunner-http --with-all-dependencies --update-no-dev $composerFlags fi diff --git a/composer.json b/composer.json index 63196aa7..98916e26 100644 --- a/composer.json +++ b/composer.json @@ -46,7 +46,7 @@ "pugx/shortid-php": "^1.1", "ramsey/uuid": "^4.7", "shlinkio/shlink-common": "^5.5", - "shlinkio/shlink-config": "^2.4", + "shlinkio/shlink-config": "dev-main#245bbdd as 2.5", "shlinkio/shlink-event-dispatcher": "^3.0", "shlinkio/shlink-importer": "^5.1", "shlinkio/shlink-installer": "^8.4", diff --git a/config/autoload/logger.global.php b/config/autoload/logger.global.php index 1820c480..01ec40ab 100644 --- a/config/autoload/logger.global.php +++ b/config/autoload/logger.global.php @@ -52,6 +52,7 @@ return (static function (): array { ], ], + // Deprecated. Remove in Shlink 4.0.0 'mezzio-swoole' => [ 'swoole-http-server' => [ 'logger' => [ diff --git a/config/container.php b/config/container.php index 6813ebd4..e7574fe6 100644 --- a/config/container.php +++ b/config/container.php @@ -13,6 +13,7 @@ chdir(dirname(__DIR__)); require 'vendor/autoload.php'; // Workaround to make this compatible with both openswoole 22 and earlier versions. +// Openswoole support is deprecated. Remove in v4.0.0 if (! function_exists('swoole_set_process_name')) { // phpcs:disable function swoole_set_process_name(string $name): void diff --git a/docker/README.md b/docker/README.md index 629a9ee1..13de359d 100644 --- a/docker/README.md +++ b/docker/README.md @@ -5,7 +5,7 @@ This image provides an easy way to set up [shlink](https://shlink.io) on a container-based runtime. -It exposes a shlink instance served with [openswoole](https://openswoole.com/), which can be linked to external databases to persist data. +It exposes a shlink instance served with [RoadRunner](https://roadrunner.dev) or [openswoole](https://openswoole.com/), which can be linked to external databases to persist data. ## Usage diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index a2daec3d..12c13996 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -29,6 +29,7 @@ if [ "$SHLINK_RUNTIME" == 'rr' ]; then fi if [ "$SHLINK_RUNTIME" == 'openswoole' ]; then + # Openswoole is deprecated. Remove in Shlink 4.0.0 # When restarting the container, openswoole might think it is already in execution # This forces the app to be started every second until the exit code is 0 until php vendor/bin/laminas mezzio:swoole:start; do sleep 1 ; done