Automated pm2 process spawn

This commit is contained in:
Pitu 2019-03-12 04:45:47 +00:00
parent 6aee90e375
commit 390eeb9b07
3 changed files with 32 additions and 9 deletions

View File

@ -25,13 +25,10 @@ This guide asumes a lot of things, including that you know your way around linux
Lolisafe is now installed, configured and ready. Now you need to serve it to the public by using a domain name.
6. Check the [nginx](docs/nginx.md) file for a sample configuration that has every step to run lolisafe securely on production.
7. After you finish setting up nginx, you need to start lolisafe by using pm2. If you want to use something else, figure out how. Run the following commands:
```bash
pm2 start npm --name "lolisafe.api" -- run api
pm2 start npm --name "lolisafe.site" -- run site
```
(More info on why pm2 [here](docs/pm2.md))
After you finish setting up nginx, you need to start lolisafe by using pm2. If you want to use something else, figure out how. (More info on why pm2 [here](docs/pm2.md))
7. Run `pm2 start pm2.json`:
8. Profit
### Cloudflare

View File

@ -4,8 +4,8 @@ The best way to keep the service running in case of crashes or unexpected issues
The recommended way to set it up is to run the commands below, one for the API and the other for the site.
```
pm2 start npm --name "lolisafe.api" -- run api
pm2 start npm --name "lolisafe.site" -- run site
pm2 start npm --name "lolisafe-api" -- run api
pm2 start npm --name "lolisafe-site" -- run site
```
All set, if you want to check the logs you can `pm2 logs lolisafe.api` or similar.
All set, if you want to check the logs you can `pm2 logs lolisafe-api` or similar.

26
pm2.json Normal file
View File

@ -0,0 +1,26 @@
{
"apps" : [
{
"name": "lolisafe-api",
"script": "npm",
"args": "run api",
"env": {
"NODE_ENV": "production"
},
"env_production" : {
"NODE_ENV": "production"
}
},
{
"name": "lolisafe-website",
"script": "npm",
"args": "run site",
"env": {
"NODE_ENV": "production"
},
"env_production" : {
"NODE_ENV": "production"
}
}
]
}