Replaced references to regular swoole by openswoole

This commit is contained in:
Alejandro Celaya 2022-01-23 11:29:53 +01:00
parent 1f90af3aec
commit 0e6790cdab
7 changed files with 21 additions and 21 deletions

View File

@ -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 db:migrate` to get database migrations up to date.
* Run `./indocker bin/cli api-key:generate` to get your first API key generated. * 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 swoole. Once you finish this, you will have the project exposed in ports `8000` through nginx+php-fpm and `8080` through openswoole.
> Note: The `indocker` shell script is a helper tool used to run commands inside the main docker container. > Note: The `indocker` shell script is a helper tool used to run commands inside the main docker container.
@ -80,7 +80,7 @@ The purposes of every folder are:
* `data`: Common runtime-generated git-ignored assets, like logs, caches, etc. * `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. * `docs`: Any project documentation is stored here, like API spec definitions or architectural decision records.
* `module`: Contains a subfolder for every module in the project. Modules contain the source code, tests and configurations for every context in the project. * `module`: Contains a subfolder 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 swoole. * `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.
## Project tests ## Project tests
@ -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. 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 swoole, 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 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. These are the best tests to catch regressions, and to verify everything behaves as expected.

View File

@ -37,11 +37,11 @@ First, make sure the host where you are going to run shlink fulfills these requi
* PHP 8.0 or 8.1 * PHP 8.0 or 8.1
* The next PHP extensions: json, curl, pdo, intl, gd and gmp. * The next PHP extensions: json, curl, pdo, intl, gd and gmp.
* apcu extension is recommended if you don't plan to use swoole or openswoole. * apcu extension is recommended if you don't plan to use openswoole.
* xml extension is required if you want to generate QR codes in svg format. * 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. * sockets and bcmath extensions are required if you want to integrate with a RabbitMQ instance.
* MySQL, MariaDB, PostgreSQL, Microsoft SQL Server or SQLite. * MySQL, MariaDB, PostgreSQL, Microsoft SQL Server or SQLite.
* The web server of your choice with PHP integration (Apache or Nginx recommended). * [Openswoole](https://openswoole.com/) or the web server of your choice with PHP integration (Apache or Nginx recommended).
### Download ### Download
@ -51,7 +51,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. 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/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 and with/without openswoole integration.
Finally, decompress the file in the location of your choice. Finally, decompress the file in the location of your choice.

View File

@ -10,7 +10,7 @@ fi
version=$1 version=$1
noSwoole=$2 noSwoole=$2
phpVersion=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;') phpVersion=$(php -r 'echo PHP_MAJOR_VERSION . "." . PHP_MINOR_VERSION;')
[[ $noSwoole ]] && swooleSuffix="" || swooleSuffix="_swoole" [[ $noSwoole ]] && swooleSuffix="" || swooleSuffix="_openswoole"
distId="shlink${version}_php${phpVersion}${swooleSuffix}_dist" distId="shlink${version}_php${phpVersion}${swooleSuffix}_dist"
builtContent="./build/${distId}" builtContent="./build/${distId}"
projectdir=$(pwd) projectdir=$(pwd)
@ -34,7 +34,7 @@ ${composerBin} self-update
${composerBin} install --no-dev --prefer-dist $composerFlags ${composerBin} install --no-dev --prefer-dist $composerFlags
if [[ $noSwoole ]]; then if [[ $noSwoole ]]; then
# If generating a dist not for swoole, uninstall mezzio-swoole # If generating a dist not for openswoole, uninstall mezzio-swoole
${composerBin} remove mezzio/mezzio-swoole --with-all-dependencies --update-no-dev $composerFlags ${composerBin} remove mezzio/mezzio-swoole --with-all-dependencies --update-no-dev $composerFlags
fi fi

View File

@ -8,8 +8,8 @@ return [
'debug' => false, 'debug' => false,
// Disabling config cache for cli, ensures it's never used for swoole and also that console commands don't generate // Disabling config cache for cli, ensures it's never used for openswoole and also that console commands don't
// a cache file that's then used by non-swoole web executions // generate a cache file that's then used by non-openswoole web executions
ConfigAggregator::ENABLE_CACHE => PHP_SAPI !== 'cli', ConfigAggregator::ENABLE_CACHE => PHP_SAPI !== 'cli',
]; ];

View File

@ -1,4 +1,4 @@
/var/log/shlink/shlink_swoole.log { /var/log/shlink/shlink_openswoole.log {
su root root su root root
daily daily
missingok missingok
@ -8,6 +8,6 @@
notifempty notifempty
create 0640 root root create 0640 root root
postrotate postrotate
/etc/init.d/shlink_swoole restart /etc/init.d/shlink_openswoole restart
endscript endscript
} }

View File

@ -1,26 +1,26 @@
#!/bin/bash #!/bin/bash
### BEGIN INIT INFO ### BEGIN INIT INFO
# Provides: shlink_swoole # Provides: shlink_openswoole
# Required-Start: $local_fs $network $named $time $syslog # Required-Start: $local_fs $network $named $time $syslog
# Required-Stop: $local_fs $network $named $time $syslog # Required-Stop: $local_fs $network $named $time $syslog
# Default-Start: 2 3 4 5 # Default-Start: 2 3 4 5
# Default-Stop: 0 1 6 # Default-Stop: 0 1 6
# Description: Shlink non-blocking server with swoole # Description: Shlink non-blocking server with openswoole
### END INIT INFO ### END INIT INFO
SCRIPT=/path/to/shlink/vendor/bin/laminas\ mezzio:swoole:start SCRIPT=/path/to/shlink/vendor/bin/laminas\ mezzio:swoole:start
RUNAS=root RUNAS=root
PIDFILE=/var/run/shlink_swoole.pid PIDFILE=/var/run/shlink_openswoole.pid
LOGDIR=/var/log/shlink LOGDIR=/var/log/shlink
LOGFILE=${LOGDIR}/shlink_swoole.log LOGFILE=${LOGDIR}/shlink_openswoole.log
start() { start() {
if [[ -f "$PIDFILE" ]] && kill -0 $(cat "$PIDFILE"); then if [[ -f "$PIDFILE" ]] && kill -0 $(cat "$PIDFILE"); then
echo 'Shlink with swoole already running' >&2 echo 'Shlink with openswoole already running' >&2
return 1 return 1
fi fi
echo 'Starting shlink with swoole' >&2 echo 'Starting shlink with openswoole' >&2
mkdir -p "$LOGDIR" mkdir -p "$LOGDIR"
touch "$LOGFILE" touch "$LOGFILE"
local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!" local CMD="$SCRIPT &> \"$LOGFILE\" & echo \$!"
@ -30,10 +30,10 @@ start() {
stop() { stop() {
if [[ ! -f "$PIDFILE" ]] || ! kill -0 $(cat "$PIDFILE"); then if [[ ! -f "$PIDFILE" ]] || ! kill -0 $(cat "$PIDFILE"); then
echo 'Shlink with swoole not running' >&2 echo 'Shlink with openswoole not running' >&2
return 1 return 1
fi fi
echo 'Stopping shlink with swoole' >&2 echo 'Stopping shlink with openswoole' >&2
kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE" kill -15 $(cat "$PIDFILE") && rm -f "$PIDFILE"
echo 'Shlink stopped' >&2 echo 'Shlink stopped' >&2
} }

View File

@ -5,7 +5,7 @@
This image provides an easy way to set up [shlink](https://shlink.io) on a container-based runtime. 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://www.swoole.co.uk/), which can be linked to external databases to persist data. It exposes a shlink instance served with [openswoole](https://openswoole.com/), which can be linked to external databases to persist data.
## Usage ## Usage