From b8419704dfd6c773b4f9eb1711e7df8a197f68f3 Mon Sep 17 00:00:00 2001 From: sergiu Date: Wed, 2 Jul 2025 13:53:50 +0300 Subject: [PATCH 1/2] Issue #19: Added server setup and usage in readme.md Signed-off-by: sergiu --- README.md | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/README.md b/README.md index 26461e8..b80167a 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,117 @@ Install `dotkernel/queue` by executing the following Composer command: composer require dotkernel/queue ``` +## Setup + +In order to setup the server run the following commands: + +Install Valkey +```shell +sudo dnf install valkey +``` + +Start Valkey service +```shell +sudo systemctl start valkey +``` + +Enable Valkey to start automatically at system boot. +```shell +sudo systemctl enable valkey +``` + +Install php-redis extension, which allows PHP to communicate with Valkey/Redis. +```shell +sudo dnf install php-redis +``` + +Restart Apache HTTP Server and PHP-FPM +```shell +sudo systemctl restart httpd +sudo systemctl restart php-fpm +``` + +Check whether the redis extension is loaded in PHP +```shell +php -m | grep redis +``` + +Install build tools and development packages +```shell +sudo dnf install php-devel php-pear gcc make +``` + +Install the Brotli compression library and its development headers +```shell +sudo dnf install brotli brotli-devel +``` + +Check if pkg-config can locate the libbrotlienc library +```shell +pkg-config --libs libbrotlienc +``` + +Ensure pkg-config can find .pc config files by updating the environment variable with the correct path +```shell +export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:$PKG_CONFIG_PATH +``` + +Install the Swoole PHP extension via PECL +> Note: PECL options should be left default. +```shell +sudo pecl install swoole +``` + +Navigate to PHP’s config files +```shell +cd /etc/php.d/ +``` + +Create a new config file for the swoole extension. +```shell +sudo touch 60-swoole.ini +``` + +Open the file in your preferred editor +```shell +sudo nano 60-swoole.ini +``` + +Add the following extension and save +```shell +extension=swoole.so +``` + +Restart services +```shell +sudo systemctl restart php-fpm +sudo systemctl restart httpd +``` +Check if swoole extension is loaded in PHP +```shell +php -m | grep swoole +``` + +## Usage + +In order to start or stop the swoole server to you can run the following commands +```shell +php bin/cli.php swoole:start +``` +```shell +php bin/cli.php swoole:stop +``` + +In order to start the messenger server run the following command +```shell +php bin/cli.php messenger:start +``` + +To test if everything is working properly you can simulate sending a message via TCP by running the following command +```shell +echo "Hello" | socat - TCP:localhost:8556 +``` + ## Documentation Documentation is available at: https://docs.dotkernel.org/queue-documentation From 4c94b5e1f1981b59e96620d8ab652df9cb5871d7 Mon Sep 17 00:00:00 2001 From: sergiu Date: Wed, 2 Jul 2025 16:21:39 +0300 Subject: [PATCH 2/2] more specific instructions Signed-off-by: sergiu --- README.md | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b80167a..88b44c5 100644 --- a/README.md +++ b/README.md @@ -18,19 +18,40 @@ [![Qodana](https://github.com/dotkernel/queue/actions/workflows/qodana_code_quality.yml/badge.svg?branch=main)](https://github.com/dotkernel/queue/actions/workflows/qodana_code_quality.yml) [![PHPStan](https://github.com/dotkernel/queue/actions/workflows/static-analysis.yml/badge.svg?branch=main)](https://github.com/dotkernel/queue/actions/workflows/static-analysis.yml) -## Installation +## Clone the project -Install `dotkernel/queue` by executing the following Composer command: +Using your terminal, navigate inside the directory you want to download the project files into. Make sure that the directory is empty before proceeding to the download process. Once there, run the following command: ```shell -composer require dotkernel/queue +git clone https://github.com/dotkernel/queue.git . ``` ## Setup -In order to setup the server run the following commands: +After you have finished cloning the project, before installing the dependencies, you need to setup the server. Using the command line, go to your system root directory, then type the following commands: -Install Valkey +Start with updating your system +```shell + sudo dnf update -y +``` + +Installing Apache HTTP Server +```shell +sudo dnf install httpd httpd-tools -y +``` + +Start and enable the Apache service +```shell +sudo systemctl start httpd +sudo systemctl enable httpd +``` + +To check Apache service status run the following command +```shell + sudo systemctl status httpd +``` + +Once you have installed Apache you can proceed to install Valkey ```shell sudo dnf install valkey ``` @@ -117,6 +138,11 @@ Check if swoole extension is loaded in PHP php -m | grep swoole ``` +After the server setup is complete, you can move on to installing the project dependencies, go to your application's root directory and run the following command. +```shell +composer install +``` + ## Usage In order to start or stop the swoole server to you can run the following commands