Skip to content

Commit d387c11

Browse files
committed
add documentation
1 parent be8df26 commit d387c11

File tree

8 files changed

+193
-1
lines changed

8 files changed

+193
-1
lines changed

COPYRIGHT.md

Lines changed: 0 additions & 1 deletion
This file was deleted.

OSSMETADATA

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
osslifecycle=active

daemon/messenger.service

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=Swoole startup service
3+
After=swoole.service
4+
5+
[Service]
6+
Type=forking
7+
Restart=on-failure
8+
RestartSec=5
9+
User=queue
10+
Group=queue
11+
WorkingDirectory=/home/dotkernel/queue/
12+
ExecStart=/usr/bin/php /home/dotkernel/queue/bin/cli.php messenger:start
13+
14+
[Install]
15+
WantedBy=swoole.service

daemon/swoole.service

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=Swoole startup service
3+
After=network.target
4+
5+
[Service]
6+
Type=forking
7+
Restart=on-failure
8+
RestartSec=5
9+
User=queue
10+
Group=queue
11+
WorkingDirectory=/home/dotkernel/queue/
12+
ExecStart=/usr/bin/php /home/dotkernel/queue/bin/cli.php swoole:start
13+
14+
[Install]
15+
WantedBy=multi-user.target

docs/book/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../README.md

docs/book/v1/installation.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
## INSTALLATION
2+
3+
### git clone
4+
5+
`git clone -b default-queue https://github.com/dotkernel/queue.git`
6+
7+
### Edit .dist files from config/autoload folder
8+
9+
- local.php.dist
10+
- log.local.dist
11+
- messenger.local.php.dist
12+
- swoole.local.php.dist
13+
14+
## Run Composer
15+
16+
`composer install --no-dev`
17+
18+
### Create services ( daemon)
19+
20+
- Edit the files from `/daemon` folder and set proper paths
21+
- copy them in /etc/systemd/system/
22+
23+
`sudo cp /home/dotkernel/queue/daemon\swoole.service`
24+
25+
`sudo cp /home/dotkernel/queue/daemon\messenger.service`
26+
27+
28+
### Start the daemon
29+
30+
`sudo systemctl daemon-reload`
31+
32+
`sudo systemctl enable swoole.service`
33+
34+
`sudo systemctl start swoole.service`
35+
36+
`sudo systemctl status swoole.service`
37+
38+
39+
### Testing the installation
40+
41+
Send a request from your local machine
42+
43+
`echo "Hello" | socat -T1 - TCP:SERVER-IP:8556`

docs/book/v1/overview.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
> [!IMPORTANT]
2+
> Dotkernel component used to queue tasks to be processed asynchronously based on [netglue/laminas-messenger](https://github.com/netglue/laminas-messenger)
3+
4+
## Badges
5+
6+
![OSS Lifecycle](https://img.shields.io/osslifecycle/dotkernel/queue)
7+
![PHP from Packagist (specify version)](https://img.shields.io/packagist/php-v/dotkernel/queue/main)
8+
9+
[![GitHub issues](https://img.shields.io/github/issues/dotkernel/queue)](https://github.com/dotkernel/queue/issues)
10+
[![GitHub forks](https://img.shields.io/github/forks/dotkernel/queue)](https://github.com/dotkernel/queue/network)
11+
[![GitHub stars](https://img.shields.io/github/stars/dotkernel/queue)](https://github.com/dotkernel/queue/stargazers)
12+
[![GitHub license](https://img.shields.io/github/license/dotkernel/queue)](https://github.com/dotkernel/queue/blob/main/LICENSE.md)
13+
14+
[![Build Status](https://github.com/mezzio/mezzio-skeleton/actions/workflows/continuous-integration.yml/badge.svg)](https://github.com/mezzio/mezzio-skeleton/actions/workflows/continuous-integration.yml)
15+
[![codecov](https://codecov.io/gh/dotkernel/queue/graph/badge.svg?token=pexSf4wIhc)](https://codecov.io/gh/dotkernel/queue)
16+
[![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)
17+
[![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)

docs/book/v1/server-setup.md

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
## Server setup
2+
3+
> Below instructions are working only on **AlmaLinux 9**
4+
>
5+
>For other OS's need to be adapted accordingly
6+
7+
## Starting point
8+
A server with AlmaLinux 9 freshly installed, with root access and updated
9+
10+
### Update OS
11+
dnf update
12+
13+
### Create a new user with sudo permissions
14+
15+
`useradd dotkernel`
16+
17+
`passwd dotkernel`
18+
19+
`usermod -aG wheel dotkernel`
20+
21+
### reboot
22+
23+
### SSH to the server as new user
24+
25+
### Install various utilities
26+
27+
`sudo dnf install -y dnf-utils`
28+
29+
`sudo dnf install zip unzip socat wget`
30+
31+
### PHP
32+
33+
`sudo dnf install -y https://rpms.remirepo.net/enterprise/remi-release-9.rpm`
34+
35+
`sudo dnf module enable php:remi-8.4`
36+
37+
`sudo dnf install -y php php-cli php-common php-intl`
38+
39+
### Start PHP-FPM
40+
41+
`sudo systemctl start php-fpm`
42+
43+
`sudo systemctl enable php-fpm`
44+
45+
### Install and verify swoole
46+
47+
`sudo dnf install php-pecl-swoole6`
48+
49+
`php -i | grep swoole`
50+
51+
### Valkey
52+
53+
`sudo dnf install valkey`
54+
55+
`sudo systemctl enable valkey`
56+
57+
`sudo systemctl start valkey`
58+
59+
`sudo valkey-cli ping`
60+
61+
### Valkey PHP module
62+
63+
`sudo dnf install php-pecl-redis`
64+
65+
`php -i | grep redis`
66+
67+
### GIT
68+
69+
`sudo dnf install git`
70+
71+
### Composer
72+
`wget https://getcomposer.org/installer -O composer-installer.php`
73+
74+
`sudo chmod 777 /usr/local/bin`
75+
76+
`php composer-installer.php --filename=composer --install-dir=/usr/local/bin`
77+
78+
### Firewall setup
79+
80+
In order to add a minimum level of security, a firewall needs to be installed and allows
81+
connections from outside only to certain ports, from certain IP's.
82+
83+
> Firewall setup is not mandatory
84+
85+
`sudo dnf install firewalld`
86+
87+
`sudo systemctl enable firewalld`
88+
89+
> Before starting the firewall, be sure you will not be locked outside
90+
91+
`sudo firewall-offline-cmd --zone=public --add-port=22/tcp --permanent`
92+
93+
`sudo systemctl start firewalld`
94+
95+
> By default, Swoole runs on port 8556. You can change that in the configuration file.
96+
97+
`sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="YOUR_IP_ADDRESS" port port="8556" protocol="tcp" accept'`
98+
99+
`sudo firewall-cmd --reload`
100+
101+
## NOW THE SERVER IS READY

0 commit comments

Comments
 (0)