Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation #60

Merged
merged 3 commits into from
Feb 22, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 41 additions & 19 deletions docs/Writerside/topics/Production.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,31 @@ 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;
+ }

...
}
```
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
Expand All @@ -189,28 +198,42 @@ 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:

```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
```

Expand All @@ -221,15 +244,14 @@ 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
killasgroup=true
user=www-data
numprocs=1
redirect_stderr=true
stdout_logfile=/home/ninshiki/worker-pulse.log
```


Expand Down
Loading