From 6ba57d859afdfaabaafe17eee11744d3acf510fc Mon Sep 17 00:00:00 2001 From: MarJose123 <18107626+MarJose123@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:18:54 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20docs(`docs/Writerside/?= =?UTF-8?q?topics/Production.md`):=20Update=20Supervisor=20configuration?= =?UTF-8?q?=20for=20production=20environment.=20=20Added=20websocket=20wor?= =?UTF-8?q?ker=20and=20adjusted=20queue=20worker=20configurations.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Writerside/topics/Production.md | 51 +++++++++++++++++----------- 1 file changed, 32 insertions(+), 19 deletions(-) diff --git a/docs/Writerside/topics/Production.md b/docs/Writerside/topics/Production.md index 4ee8fce..0e5d0a8 100644 --- a/docs/Writerside/topics/Production.md +++ b/docs/Writerside/topics/Production.md @@ -159,18 +159,18 @@ Once the Certbot run successfully, restart your nginx services `sudo systemctl r server { ... - location / { -+ proxy_http_version 1.1; -+ proxy_set_header Host $http_host; -+ proxy_set_header Scheme $scheme; -+ proxy_set_header SERVER_PORT $server_port; -+ proxy_set_header REMOTE_ADDR $remote_addr; -+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; -+ proxy_set_header Upgrade $http_upgrade; -+ proxy_set_header Connection "Upgrade"; - -+ proxy_pass http://0.0.0.0:8080; - } ++ location /app { ++ proxy_http_version 1.1; ++ proxy_set_header Host $http_host; ++ proxy_set_header Scheme $scheme; ++ proxy_set_header SERVER_PORT $server_port; ++ proxy_set_header REMOTE_ADDR $remote_addr; ++ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ++ proxy_set_header Upgrade $http_upgrade; ++ proxy_set_header Connection "Upgrade"; + ++ proxy_pass http://0.0.0.0:8080; ++ } ... } @@ -189,12 +189,27 @@ you may create any number of configuration files that instruct supervisor how yo Once the configuration file has been created, you may update the Supervisor configuration and start the processes using the following commands: ```bash sudo supervisorctl reread - sudo supervisorctl update -sudo supervisorctl start "ninshiki-worker-*" ``` +###### Websocket +Let's create a `ninshiki-worker-websocket.conf` file that starts and monitors `reverb:start` processes: +```bash +[program:ninshiki-worker-websocket] +process_name=%(program_name)s_%(process_num)02d +command=php /var/www/backend-ninshiki.com/artisan reverb:start --host=127.0.0.1 --port=8080 --no-interaction +autostart=true +autorestart=true +stopasgroup=true +killasgroup=true +user=www-data +numprocs=1 +redirect_stderr=true +stopwaitsecs=3600 +``` + + ###### Queues Let's create a `ninshiki-worker-queue.conf` file that starts and monitors `queue:work` processes: @@ -202,15 +217,14 @@ Let's create a `ninshiki-worker-queue.conf` file that starts and monitors `queue ```bash [program:ninshiki-worker-queue] process_name=%(program_name)s_%(process_num)02d -command=php /www/backend-ninshiki.com/artisan queue:work --sleep=3 --tries=3 --max-time=3600 +command=php /var/www/backend-ninshiki.com/artisan queue:work --sleep=3 --tries=3 --max-time=3600 autostart=true autorestart=true stopasgroup=true killasgroup=true user=www-data -numprocs=8 +numprocs=3 redirect_stderr=true -stdout_logfile=/home/ninshiki/worker-queue.log stopwaitsecs=3600 ``` @@ -221,7 +235,7 @@ Let's create a `ninshiki-worker-pulse.conf` file that starts and monitors `pulse ```bash [program:ninshiki-worker-pulse] process_name=%(program_name)s_%(process_num)02d -command=php /www/backend-ninshiki.com/artisan pulse:check +command=php /var/www/backend-ninshiki.com/artisan pulse:check autostart=true autorestart=true stopasgroup=true @@ -229,7 +243,6 @@ killasgroup=true user=www-data numprocs=1 redirect_stderr=true -stdout_logfile=/home/ninshiki/worker-pulse.log ``` From abb66fb1b237e16cb7df6cdedb01c98cdb0f7cb0 Mon Sep 17 00:00:00 2001 From: MarJose123 <18107626+MarJose123@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:21:35 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20docs(`docs/Writerside/?= =?UTF-8?q?topics/Production.md`):=20Added=20instructions=20for=20setting?= =?UTF-8?q?=20up=20the=20Reverb=20environment=20variables.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/Writerside/topics/Production.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/docs/Writerside/topics/Production.md b/docs/Writerside/topics/Production.md index 0e5d0a8..df94a61 100644 --- a/docs/Writerside/topics/Production.md +++ b/docs/Writerside/topics/Production.md @@ -175,6 +175,15 @@ server { ... } ``` +Your `.env` file for the reverb should look like this. +```bash +REVERB_APP_ID=xxxx +REVERB_APP_KEY=xxxxx +REVERB_APP_SECRET=xxxxx +REVERB_HOST=ninshiki.example.com +REVERB_PORT=8080 +REVERB_SCHEME=https #or 'http' if you are not in SSL +``` ## Supervisor