Skip to content

Commit

Permalink
Drop support for openswoole
Browse files Browse the repository at this point in the history
  • Loading branch information
acelaya committed Feb 16, 2024
1 parent 72c4628 commit 96ed7ca
Show file tree
Hide file tree
Showing 33 changed files with 26 additions and 369 deletions.
4 changes: 1 addition & 3 deletions .github/DISCUSSION_TEMPLATE/help-wanted.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ body:
options:
- Self-hosted Apache
- Self-hosted nginx
- Self-hosted openswoole
- Self-hosted RoadRunner
- Openswoole Docker image
- RoadRunner Docker image
- Docker image
- Other (explain in summary)
- type: dropdown
validations:
Expand Down
4 changes: 1 addition & 3 deletions .github/ISSUE_TEMPLATE/Bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,8 @@ body:
options:
- Self-hosted Apache
- Self-hosted nginx
- Self-hosted openswoole
- Self-hosted RoadRunner
- Openswoole Docker image
- RoadRunner Docker image
- Docker image
- Other (explain in summary)
- type: dropdown
validations:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-db-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- uses: './.github/actions/ci-setup'
with:
php-version: ${{ matrix.php-version }}
php-extensions: openswoole-22.1.2, pdo_sqlsrv-5.12.0
php-extensions: pdo_sqlsrv-5.12.0
extensions-cache-key: db-tests-extensions-${{ matrix.php-version }}-${{ inputs.platform }}
- name: Create test database
if: ${{ inputs.platform == 'ms' }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-mutation-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ jobs:
- uses: './.github/actions/ci-setup'
with:
php-version: ${{ matrix.php-version }}
php-extensions: openswoole-22.1.2
extensions-cache-key: mutation-tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }}
- uses: actions/download-artifact@v4
with:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ jobs:
- uses: './.github/actions/ci-setup'
with:
php-version: ${{ matrix.php-version }}
php-extensions: openswoole-22.1.2
extensions-cache-key: tests-extensions-${{ matrix.php-version }}-${{ inputs.test-group }}
- name: Download RoadRunner binary
if: ${{ inputs.test-group == 'api' }}
Expand Down
23 changes: 3 additions & 20 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ jobs:
- uses: './.github/actions/ci-setup'
with:
php-version: ${{ matrix.php-version }}
php-extensions: openswoole-22.1.2
extensions-cache-key: tests-extensions-${{ matrix.php-version }}-${{ matrix.command }}
- run: composer ${{ matrix.command }}

Expand All @@ -50,27 +49,11 @@ jobs:
with:
test-group: cli

roadrunner-api-tests:
api-tests:
uses: './.github/workflows/ci-tests.yml'
with:
test-group: api

openswoole-api-tests:
runs-on: ubuntu-22.04
strategy:
matrix:
php-version: ['8.2', '8.3']
steps:
- uses: actions/checkout@v4
- run: docker-compose -f docker-compose.yml -f docker-compose.ci.yml up -d shlink_db_postgres
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: openswoole-22.1.2
tools: composer
- run: composer install --no-interaction --prefer-dist
- run: composer test:api:openswoole

sqlite-db-tests:
uses: './.github/workflows/ci-db-tests.yml'
with:
Expand Down Expand Up @@ -112,7 +95,7 @@ jobs:

api-mutation-tests:
needs:
- openswoole-api-tests
- api-tests
uses: './.github/workflows/ci-mutation-tests.yml'
with:
test-group: api
Expand All @@ -127,7 +110,7 @@ jobs:
upload-coverage:
needs:
- unit-tests
- openswoole-api-tests
- api-tests
- cli-tests
- sqlite-db-tests
runs-on: ubuntu-22.04
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,17 @@ jobs:
strategy:
matrix:
php-version: ['8.2', '8.3']
swoole: ['yes', 'no']
steps:
- uses: actions/checkout@v4
- uses: './.github/actions/ci-setup'
with:
php-version: ${{ matrix.php-version }}
php-extensions: openswoole-22.1.2
extensions-cache-key: publish-swagger-spec-extensions-${{ matrix.php-version }}
install-deps: 'no'
- if: ${{ matrix.swoole == 'yes' }}
run: ./build.sh ${GITHUB_REF#refs/tags/v}
- if: ${{ matrix.swoole == 'no' }}
run: ./build.sh ${GITHUB_REF#refs/tags/v} --no-swoole
- run: ./build.sh ${GITHUB_REF#refs/tags/v}
- uses: actions/upload-artifact@v4
with:
name: dist-files-${{ matrix.php-version }}-${{ matrix.swoole }}
name: dist-files-${{ matrix.php-version }}
path: build

publish:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/publish-swagger-spec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ jobs:
- uses: './.github/actions/ci-setup'
with:
php-version: ${{ matrix.php-version }}
php-extensions: openswoole-22.1.2
extensions-cache-key: publish-swagger-spec-extensions-${{ matrix.php-version }}
- run: composer swagger:inline
- run: mkdir ${{ steps.determine_version.outputs.version }}
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this
* *Nothing*

### Removed
* *Nothing*
* [#1908](https://github.com/shlinkio/shlink/issues/1908) Remove support for openswoole (and swoole).

### Fixed
* *Nothing*
Expand Down
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `8800` through RoadRunner, `8080` through openswoole and `8000` through nginx+php-fpm.
Once you finish this, you will have the project exposed in ports `8800` through RoadRunner and `8000` through nginx+php-fpm.

> Note: The `indocker` shell script is a helper tool used to run commands inside the main docker container.
Expand Down Expand Up @@ -80,7 +80,7 @@ The purposes of every folder are:
* `data`: Common git-ignored assets, like logs, caches, lock files, GeoLite DB files, etc. It's the only location where Shlink may need to write at runtime.
* `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 RoadRunner or 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.

## Project tests

Expand All @@ -96,7 +96,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 RoadRunner or 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, 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.

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ FROM base as builder
COPY . .
COPY --from=composer:2 /usr/bin/composer ./composer.phar
RUN apk add --no-cache git && \
php composer.phar install --no-dev --prefer-dist --optimize-autoloader --no-progress --no-interaction --ignore-platform-req=ext-openswoole && \
php composer.phar install --no-dev --prefer-dist --optimize-autoloader --no-progress --no-interaction && \
php composer.phar clear-cache && \
rm -r docker composer.* && \
sed -i "s/%SHLINK_VERSION%/${SHLINK_VERSION}/g" config/autoload/app_options.global.php
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ First, make sure the host where you are going to run shlink fulfills these requi

* PHP 8.2 or 8.3
* The next PHP extensions: json, curl, pdo, intl, gd and gmp/bcmath.
* apcu extension is recommended if you don't plan to use openswoole.
* apcu extension is recommended if you don't plan to use RoadRunner.
* xml extension is required if you want to generate QR codes in svg format.
* sockets and bcmath extensions are required if you want to integrate with a RabbitMQ instance.
* MySQL, MariaDB, PostgreSQL, MicrosoftSQL or SQLite.
* You will also need the corresponding pdo variation for the database you are planning to use: `pdo_mysql`, `pdo_pgsql`, `pdo_sqlsrv` or `pdo_sqlite`.
* The [openswoole](https://openswoole.com/) PHP extension (if you plan to serve Shlink with openswoole) or the web server of your choice with PHP integration (like Apache or Nginx).

### Download

Expand All @@ -53,7 +52,7 @@ In order to run Shlink, you will need a built version of the project. There are

The easiest way to install shlink is by using one of the pre-bundled distributable packages.

Go to the [latest version](https://github.com/shlinkio/shlink/releases/latest) and download the `shlink*_dist.zip` file that suits your needs. You will find one for every supported PHP version and with/without openswoole integration.
Go to the [latest version](https://github.com/shlinkio/shlink/releases/latest) and download the `shlink*_dist.zip` file that suits your needs. You will find one for every supported PHP version.

Finally, decompress the file in the location of your choice.

Expand Down
5 changes: 1 addition & 4 deletions bin/test/run-api-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export APP_ENV=test
export TEST_ENV=api
export TEST_RUNTIME="${TEST_RUNTIME:-"rr"}" # Openswoole is deprecated. Remove in v4.0.0
export TEST_RUNTIME="${TEST_RUNTIME:-"rr"}" # rr is the only runtime currently supported
export DB_DRIVER="${DB_DRIVER:-"postgres"}"
export GENERATE_COVERAGE="${GENERATE_COVERAGE:-"no"}"

Expand All @@ -13,11 +13,9 @@ mkdir data/log/api-tests
touch $OUTPUT_LOGS

# Try to stop server just in case it hanged in last execution
[ "$TEST_RUNTIME" = 'openswoole' ] && vendor/bin/laminas mezzio:swoole:stop
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr stop -f

echo 'Starting server...'
[ "$TEST_RUNTIME" = 'openswoole' ] && vendor/bin/laminas mezzio:swoole:start -d
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr serve -p -c=config/roadrunner/.rr.test.yml -w . \
-o=logs.output="${PWD}/${OUTPUT_LOGS}" \
-o=logs.channels.http.output="${PWD}/${OUTPUT_LOGS}" \
Expand All @@ -27,7 +25,6 @@ sleep 2 # Let's give the server a couple of seconds to start
vendor/bin/phpunit --order-by=random -c phpunit-api.xml --testdox --colors=always --log-junit=build/coverage-api/junit.xml $*
TESTS_EXIT_CODE=$?

[ "$TEST_RUNTIME" = 'openswoole' ] && vendor/bin/laminas mezzio:swoole:stop
[ "$TEST_RUNTIME" = 'rr' ] && bin/rr stop -c config/roadrunner/.rr.dev.yml -o=http.address=0.0.0.0:9999

# Exit this script with the same code as the tests. If tests failed, this script has to fail
Expand Down
9 changes: 3 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@
"mezzio/mezzio": "^3.17",
"mezzio/mezzio-fastroute": "^3.11",
"mezzio/mezzio-problem-details": "^1.13",
"mezzio/mezzio-swoole": "^4.8",
"mlocati/ip-lib": "^1.18",
"mobiledetect/mobiledetectlib": "^4.8",
"pagerfanta/core": "^3.8",
"pugx/shortid-php": "^1.1",
"ramsey/uuid": "^4.7",
"shlinkio/shlink-common": "dev-main#3f6b243 as 6.0",
"shlinkio/shlink-config": "^2.5",
"shlinkio/shlink-common": "dev-main#2323ff3 as 6.0",
"shlinkio/shlink-config": "dev-main#6b287b3 as 2.6",
"shlinkio/shlink-event-dispatcher": "^3.1",
"shlinkio/shlink-importer": "^5.2.1",
"shlinkio/shlink-installer": "dev-develop#9f0d7e5 as 9.0",
"shlinkio/shlink-installer": "dev-develop#2dee7db as 9.0",
"shlinkio/shlink-ip-geolocation": "^3.4",
"shlinkio/shlink-json": "^1.1",
"spiral/roadrunner": "^2023.3",
Expand All @@ -64,7 +63,6 @@
"devizzent/cebe-php-openapi": "^1.0.1",
"devster/ubench": "^2.1",
"infection/infection": "^0.27",
"openswoole/ide-helper": "~22.0.0",
"phpstan/phpstan": "^1.10",
"phpstan/phpstan-doctrine": "^1.3",
"phpstan/phpstan-phpunit": "^1.3",
Expand Down Expand Up @@ -130,7 +128,6 @@
"test:db:postgres": "DB_DRIVER=postgres composer test:db:sqlite",
"test:db:ms": "DB_DRIVER=mssql composer test:db:sqlite",
"test:api": "bin/test/run-api-tests.sh",
"test:api:openswoole": "TEST_RUNTIME=openswoole bin/test/run-api-tests.sh",
"test:api:ci": "GENERATE_COVERAGE=yes composer test:api",
"test:api:pretty": "GENERATE_COVERAGE=pretty composer test:api",
"test:cli": "APP_ENV=test DB_DRIVER=maria TEST_ENV=cli php vendor/bin/phpunit --order-by=random --colors=always --testdox -c phpunit-cli.xml --log-junit=build/coverage-cli/junit.xml",
Expand Down
2 changes: 1 addition & 1 deletion config/autoload/common.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

'debug' => false,

// Disabling config cache for cli, ensures it's never used for openswoole/RoadRunner, and also that console
// Disabling config cache for cli, ensures it's never used for RoadRunner, and also that console
// commands don't generate a cache file that's then used by php-fpm web executions
ConfigAggregator::ENABLE_CACHE => PHP_SAPI !== 'cli',

Expand Down
11 changes: 0 additions & 11 deletions config/autoload/logger.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,5 @@
],
],

// Deprecated. Remove in Shlink 4.0.0
'mezzio-swoole' => [
'swoole-http-server' => [
'logger' => [
// Let's disable mezio-swoole access logging, so that we can provide our own implementation,
// consistent for roadrunner and openswoole
'logger-name' => NullLogger::class,
],
],
],

];
})();
2 changes: 1 addition & 1 deletion config/autoload/router.global.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'base_path' => EnvVars::BASE_PATH->loadFromEnv(''),

'fastroute' => [
// Disabling config cache for cli, ensures it's never used for openswoole/RoadRunner, and also that console
// Disabling config cache for cli, ensures it's never used for RoadRunner, and also that console
// commands don't generate a cache file that's then used by php-fpm web executions
FastRouteRouter::CONFIG_CACHE_ENABLED => PHP_SAPI !== 'cli',
FastRouteRouter::CONFIG_CACHE_FILE => 'data/cache/fastroute_cached_routes.php',
Expand Down
34 changes: 0 additions & 34 deletions config/autoload/swoole.global.php

This file was deleted.

13 changes: 0 additions & 13 deletions config/autoload/swoole.local.php.dist

This file was deleted.

2 changes: 0 additions & 2 deletions config/autoload/url-shortener.local.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

declare(strict_types=1);

use function Shlinkio\Shlink\Config\runningInOpenswoole;
use function Shlinkio\Shlink\Config\runningInRoadRunner;

return [
Expand All @@ -12,7 +11,6 @@ return [
'schema' => 'http',
'hostname' => sprintf('localhost:%s', match (true) {
runningInRoadRunner() => '8800',
runningInOpenswoole() => '8080',
default => '8000',
}),
],
Expand Down
Loading

0 comments on commit 96ed7ca

Please sign in to comment.