Skip to content
/ pong Public

Microservice skeleton architecture using swoole and redis

License

Notifications You must be signed in to change notification settings

dotkernel/pong

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pong

Application for Queue , using swoole and Lamins

Installing DotKernel pong

Composer

Installation instructions:

If you have never used composer before make sure you read the Composer Basic Usage section in Composer's documentation

Choosing an installation path for DotKernel pong

Example:

  • absolute path /var/www/pong
  • or relative path pong (equivalent with ./pong)

Installing DotKernel pong

After choosing the path for DotKernel (pong will be used for the remainder of this example) it must be installed.

Installing DotKernel pong using git clone

This method requires more manual input, but it ensures that the default branch is installed, even if it is not released. Run the following command:

$ git clone https://github.com/dotkernel/pong.git .

The dependencies have to be installed separately, by running this command

$ composer install

The setup asks for configuration settings regarding injections (type 0 and hit enter) and a confirmation to use this setting for other packages (type y and hit enter)

Configuration - First Run

  • Remove the .dist extension from the files config/autoload/local.php.dist, config/autoload/redis.local.php.dist, config/autoload/swoole.local.php.dist
  • Edit config/autoload/local.php according to your dev machine

Testing (Running)

Note: Do not enable dev mode in production

  • Run the following commands in your project's directory ( in different tabs ):
$ redis-cli
$ php bin/dot-swoole start
$ php bin/cli.php process
$ php bin/cli.php result

NOTE: If you are still getting exceptions or errors regarding some missing services, try running the following command

$ php bin/clear-config-cache.php

Daemons (services) files content

app-main.service
[Unit]
Description=pong startup service
StartLimitIntervalSec=1

[Service]
#The dummy program will exit
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target
app-process-queue.service
[Unit]
Description=Queue startup service
After=mysqld.service
PartOf=app-main.service
StartLimitIntervalSec=1

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/php /var/www/html/app-directory/bin/cli.php process

[Install]
WantedBy=app-main.service
app-result-queue.service
[Unit]
Description=Queue result service
After=mysqld.service
PartOf=app-main.service
StartLimitIntervalSec=1

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/php /var/www/html/app-directory/bin/cli.php result

[Install]
WantedBy=app-main.service
app-swoole.service
[Unit]
Description=pong startup service
After=mysqld.service
PartOf=app-main.service
StartLimitIntervalSec=1

[Service]
Type=simple
Restart=always
RestartSec=1
User=root
ExecStart=/usr/bin/php /var/www/html/app-directory/bin/dot-swoole start
ExecStop=/usr/bin/php /var/www/html/app-directory/bin/dot-swoole stop

[Install]
WantedBy=app-main.service

About

Microservice skeleton architecture using swoole and redis

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages