From 7e74d06cdd115af6db16636af987026c6a11c66b Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 5 Dec 2021 10:08:10 +0100 Subject: [PATCH 1/2] Added support for openswoole and migrated docker images from swoole to openswoole --- .github/workflows/ci.yml | 20 ++++++++++---------- .github/workflows/publish-release.yml | 2 +- Dockerfile | 10 +++++----- README.md | 4 ++-- composer.json | 8 ++++---- config/autoload/logger.local.php.dist | 2 +- config/autoload/url-shortener.local.php.dist | 2 +- data/infra/swoole.Dockerfile | 12 ++++++------ docker/README.md | 2 +- docker/docker-entrypoint.sh | 2 +- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c8d7d47..94ebcc9e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1 + extensions: openswoole-4.8.1 coverage: none - run: composer install --no-interaction --prefer-dist - run: composer cs @@ -39,7 +39,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1 + extensions: openswoole-4.8.1 coverage: none - run: composer install --no-interaction --prefer-dist - run: composer stan @@ -58,7 +58,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1 + extensions: openswoole-4.8.1 coverage: pcov ini-values: pcov.directory=module - if: ${{ matrix.php-version == '8.1' }} @@ -88,7 +88,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1 + extensions: openswoole-4.8.1 coverage: pcov ini-values: pcov.directory=module - if: ${{ matrix.php-version == '8.1' }} @@ -120,7 +120,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1 + extensions: openswoole-4.8.1 coverage: none - if: ${{ matrix.php-version == '8.1' }} run: composer install --no-interaction --prefer-dist --ignore-platform-req=php @@ -144,7 +144,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1 + extensions: openswoole-4.8.1 coverage: none - if: ${{ matrix.php-version == '8.1' }} run: composer install --no-interaction --prefer-dist --ignore-platform-req=php @@ -168,7 +168,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1 + extensions: openswoole-4.8.1 coverage: none - if: ${{ matrix.php-version == '8.1' }} run: composer install --no-interaction --prefer-dist --ignore-platform-req=php @@ -196,7 +196,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1, pdo_sqlsrv-5.10.0beta2 + extensions: openswoole-4.8.1, pdo_sqlsrv-5.10.0beta2 coverage: none - if: ${{ matrix.php-version == '8.1' }} run: composer install --no-interaction --prefer-dist --ignore-platform-req=php @@ -222,7 +222,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1 + extensions: openswoole-4.8.1 coverage: pcov ini-values: pcov.directory=module - if: ${{ matrix.php-version == '8.1' }} @@ -257,7 +257,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.7.1 + extensions: openswoole-4.8.1 coverage: pcov ini-values: pcov.directory=module - if: ${{ matrix.php-version == '8.1' }} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index b45ee370..56a60e5b 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -20,7 +20,7 @@ jobs: with: php-version: ${{ matrix.php-version }} tools: composer - extensions: swoole-4.6.7 + extensions: openswoole-4.8.1 - if: ${{ matrix.swoole == 'yes' }} run: ./build.sh ${GITHUB_REF#refs/tags/v} - if: ${{ matrix.swoole == 'no' }} diff --git a/Dockerfile b/Dockerfile index 91d0361f..c0b803b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,7 @@ FROM php:8.0.9-alpine3.14 as base ARG SHLINK_VERSION=latest ENV SHLINK_VERSION ${SHLINK_VERSION} -ENV SWOOLE_VERSION 4.7.1 +ENV OPENSWOOLE_VERSION 4.8.1 ENV PDO_SQLSRV_VERSION 5.10.0beta2 ENV MS_ODBC_SQL_VERSION 17.5.2.2 ENV LC_ALL "C" @@ -40,10 +40,10 @@ RUN if [ $(uname -m) == "x86_64" ]; then \ rm msodbcsql17_${MS_ODBC_SQL_VERSION}-1_amd64.apk ; \ fi -# Install swoole +# Install openswoole RUN apk add --no-cache --virtual .phpize-deps ${PHPIZE_DEPS} && \ - pecl install swoole-${SWOOLE_VERSION} && \ - docker-php-ext-enable swoole && \ + pecl install openswoole-${OPENSWOOLE_VERSION} && \ + docker-php-ext-enable openswoole && \ apk del .phpize-deps @@ -65,7 +65,7 @@ LABEL maintainer="Alejandro Celaya " COPY --from=builder /etc/shlink . RUN ln -s /etc/shlink/bin/cli /usr/local/bin/shlink -# Expose default swoole port +# Expose default openswoole port EXPOSE 8080 # Copy config specific for the image diff --git a/README.md b/README.md index ce91829f..4fe5f5cf 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ First, make sure the host where you are going to run shlink fulfills these requi * PHP 8.0 * The next PHP extensions: json, curl, pdo, intl, gd and gmp. - * apcu extension is recommended if you don't plan to use swoole. + * apcu extension is recommended if you don't plan to use swoole or openswoole. * xml extension is required if you want to generate QR codes in svg format. * MySQL, MariaDB, PostgreSQL, Microsoft SQL Server or SQLite. * The web server of your choice with PHP integration (Apache or Nginx recommended). @@ -49,7 +49,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 swoole 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 and with/without swoole/openswoole integration. Finally, decompress the file in the location of your choice. diff --git a/composer.json b/composer.json index 94d2536f..880f1d50 100644 --- a/composer.json +++ b/composer.json @@ -47,11 +47,11 @@ "pugx/shortid-php": "^0.7", "ramsey/uuid": "^3.9", "rlanvin/php-ip": "3.0.0-rc2", - "shlinkio/shlink-common": "^4.1", - "shlinkio/shlink-config": "^1.3.1", - "shlinkio/shlink-event-dispatcher": "^2.2", + "shlinkio/shlink-common": "dev-main#2f3ac05 as 4.2", + "shlinkio/shlink-config": "^1.4", + "shlinkio/shlink-event-dispatcher": "dev-main#3925299 as 2.3", "shlinkio/shlink-importer": "^2.4", - "shlinkio/shlink-installer": "^6.2.1", + "shlinkio/shlink-installer": "dev-develop#e3f2e64 as 6.3", "shlinkio/shlink-ip-geolocation": "^2.2", "symfony/console": "^5.4", "symfony/filesystem": "^5.4", diff --git a/config/autoload/logger.local.php.dist b/config/autoload/logger.local.php.dist index 4aa46c68..1da0384b 100644 --- a/config/autoload/logger.local.php.dist +++ b/config/autoload/logger.local.php.dist @@ -5,7 +5,7 @@ declare(strict_types=1); use Monolog\Handler\StreamHandler; use Monolog\Logger; -$isSwoole = extension_loaded('swoole'); +$isSwoole = extension_loaded('openswoole'); // For swoole, send logs to standard output $handler = $isSwoole diff --git a/config/autoload/url-shortener.local.php.dist b/config/autoload/url-shortener.local.php.dist index f34245fb..20140a9b 100644 --- a/config/autoload/url-shortener.local.php.dist +++ b/config/autoload/url-shortener.local.php.dist @@ -2,7 +2,7 @@ declare(strict_types=1); -$isSwoole = extension_loaded('swoole'); +$isSwoole = extension_loaded('openswoole'); return [ diff --git a/data/infra/swoole.Dockerfile b/data/infra/swoole.Dockerfile index 0ceb2030..9cae5e73 100644 --- a/data/infra/swoole.Dockerfile +++ b/data/infra/swoole.Dockerfile @@ -3,7 +3,7 @@ MAINTAINER Alejandro Celaya ENV APCU_VERSION 5.1.20 ENV INOTIFY_VERSION 3.0.0 -ENV SWOOLE_VERSION 4.7.1 +ENV OPENSWOOLE_VERSION 4.8.1 ENV PDO_SQLSRV_VERSION 5.10.0beta2 ENV MS_ODBC_SQL_VERSION 17.5.2.2 @@ -54,12 +54,12 @@ RUN mkdir -p /usr/src/php/ext/inotify \ && docker-php-ext-install inotify \ && rm /tmp/inotify.tar.gz -# Install swoole, pcov and mssql driver +# Install openswoole, pcov and mssql driver RUN wget https://download.microsoft.com/download/e/4/e/e4e67866-dffd-428c-aac7-8d28ddafb39b/msodbcsql17_${MS_ODBC_SQL_VERSION}-1_amd64.apk && \ apk add --allow-untrusted msodbcsql17_${MS_ODBC_SQL_VERSION}-1_amd64.apk && \ apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS unixodbc-dev && \ - pecl install swoole-${SWOOLE_VERSION} pdo_sqlsrv-${PDO_SQLSRV_VERSION} pcov && \ - docker-php-ext-enable swoole pdo_sqlsrv pcov && \ + pecl install openswoole-${OPENSWOOLE_VERSION} pdo_sqlsrv-${PDO_SQLSRV_VERSION} pcov && \ + docker-php-ext-enable openswoole pdo_sqlsrv pcov && \ apk del .phpize-deps && \ rm msodbcsql17_${MS_ODBC_SQL_VERSION}-1_amd64.apk @@ -72,12 +72,12 @@ RUN chmod 777 /home VOLUME /home/shlink WORKDIR /home/shlink -# Expose swoole port +# Expose openswoole port EXPOSE 8080 CMD \ # Install dependencies if the vendor dir does not exist if [[ ! -d "./vendor" ]]; then /usr/local/bin/composer install ; fi && \ - # When restarting the container, swoole might think it is already in execution + # 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 diff --git a/docker/README.md b/docker/README.md index 9f97642c..7c9d3957 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 [swoole](https://www.swoole.co.uk/), which can be linked to external databases to persist data. +It exposes a shlink instance served with [openswoole](https://www.swoole.co.uk/), which can be linked to external databases to persist data. ## Usage diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 8847b757..dff3ae98 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -30,6 +30,6 @@ if [ $ENABLE_PERIODIC_VISIT_LOCATE ]; then /usr/sbin/crond & fi -# When restarting the container, swoole might think it is already in execution +# 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 From b855ea92a9455aaadf6ade9fe675812dd28b30b1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sun, 5 Dec 2021 10:09:06 +0100 Subject: [PATCH 2/2] Updated changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 57d95a4a..7715ac7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this ## [Unreleased] ### Added -* *Nothing* +* [#1204](https://github.com/shlinkio/shlink/issues/1204) Added support for `openswoole` and migrated official docker image to `openswoole`. ### Changed * [#1218](https://github.com/shlinkio/shlink/issues/1218) Updated to symfony/mercure 0.6.