From 907fb62a7dde75491384f3d7e629af087fd7bbc1 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 1 May 2024 02:12:05 +0300 Subject: [PATCH] update readme --- README.md | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 90a5138..4087222 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,50 @@ To read messages, use KevaChat [webapp](https://github.com/kevachat/webapp), [ge * [kevachat/kevacoin-php](https://github.com/kevachat/kevacoin-php) - KevaCoin library for PHP 8 * [cboden/ratchet](https://github.com/ratchetphp/Ratchet) - Asynchronous Socket server * [gregwar/captcha](https://github.com/Gregwar/Captcha) - Captcha library to prevent spam abuse -* [ixnode/php-cli-image](https://github.com/ixnode/php-cli-image) - Library converts captcha to ASCII/CLI format \ No newline at end of file +* [ixnode/php-cli-image](https://github.com/ixnode/php-cli-image) - Library converts captcha to ASCII/CLI format + +## Install + +* `git clone https://github.com/kevachat/npsapp.git` +* `cd npsapp` +* `composer update` + +## Setup + +* `cd npsapp` +* `cp config/example.json config/name.json` - edit connection and provide room namespace + +## Launch + +* `php src/app.php name.json` - where `name.json` argument is any config, placed at `config` folder + +### Autostart + +Launch server as the `systemd` service + +You can create as many servers as wanted by providing separated config for each instance! + +Following example require `npsapp` installed into the home directory of `npsapp` user (`useradd -m npsapp`) + +1. `sudo nano /etc/systemd/system/npsapp.service` - create new service: + +``` npsapp.service +[Unit] +After=network.target + +[Service] +Type=simple +User=npsapp +Group=npsapp +ExecStart=/usr/bin/php /home/npsapp/npsapp/src/app.php name.json +StandardOutput=file:/home/npsapp/debug.log +StandardError=file:/home/npsapp/error.log +Restart=on-failure + +[Install] +WantedBy=multi-user.target +``` + +2. `sudo systemctl daemon-reload` - reload systemd configuration +3. `sudo systemctl enable npsapp` - enable `npsapp` service on system startup +4. `sudo systemctl start npsapp` - start `npsapp` server \ No newline at end of file