From fbd82d9585988744d6586f0840f4f1f463e59b44 Mon Sep 17 00:00:00 2001 From: simrspersahabatan Date: Thu, 20 Jul 2023 11:28:17 +0700 Subject: [PATCH 1/4] pm2 start --- README.md | 7 +++++++ ecosystem.config.js | 14 ++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 ecosystem.config.js diff --git a/README.md b/README.md index 0a03e74..e525b47 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,13 @@ Start the server npm run start ``` +Start with PM2 ~ Tested with Ubuntu 20 server + +```bash +# example of PATH_PM2 is /www/server/nodejs/v18.13.0/bin/pm2 +sudo PATH_PM2 start ecosystem.config.js +``` + Open On Browser & Start New Session ```bash diff --git a/ecosystem.config.js b/ecosystem.config.js new file mode 100644 index 0000000..f982caf --- /dev/null +++ b/ecosystem.config.js @@ -0,0 +1,14 @@ +module.exports = { + apps : [ + { + name : "Start WA-Gateway with PM2", + script : "./index.js", + instances : "1", + exec_mode : "cluster", + env: { + NODE_ENV: "production", + PORT: 3007 + } + } + ] + } \ No newline at end of file From 29201b242d35ae9748e2033593e0869d2d75d79e Mon Sep 17 00:00:00 2001 From: simrspersahabatan Date: Thu, 20 Jul 2023 11:40:31 +0700 Subject: [PATCH 2/4] fork or cluster --- README.md | 2 ++ ecosystem.config.js | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e525b47..15dd363 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ Start with PM2 ~ Tested with Ubuntu 20 server ```bash # example of PATH_PM2 is /www/server/nodejs/v18.13.0/bin/pm2 sudo PATH_PM2 start ecosystem.config.js + +* FORK or CLUSTER ? -> readmore [here](https://stackoverflow.com/a/36177256) ``` Open On Browser & Start New Session diff --git a/ecosystem.config.js b/ecosystem.config.js index f982caf..a5e11bd 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -4,7 +4,7 @@ module.exports = { name : "Start WA-Gateway with PM2", script : "./index.js", instances : "1", - exec_mode : "cluster", + exec_mode : "fork", env: { NODE_ENV: "production", PORT: 3007 From 670b744507933dcf06003eb5295325ad29af0d34 Mon Sep 17 00:00:00 2001 From: simrspersahabatan Date: Thu, 20 Jul 2023 13:16:49 +0700 Subject: [PATCH 3/4] typo name --- ecosystem.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecosystem.config.js b/ecosystem.config.js index a5e11bd..c0e71b7 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -1,7 +1,7 @@ module.exports = { apps : [ { - name : "Start WA-Gateway with PM2", + name : "Start as Background Process with PM2", script : "./index.js", instances : "1", exec_mode : "fork", From c63cee99b054f17979abf624cabbc712aae21a0e Mon Sep 17 00:00:00 2001 From: simrspersahabatan Date: Thu, 7 Sep 2023 16:06:17 +0700 Subject: [PATCH 4/4] https://github.com/mimamch/wa-gateway/pull/15#discussion_r1268962535 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 15dd363..04cef6d 100644 --- a/README.md +++ b/README.md @@ -46,10 +46,10 @@ Start the server npm run start ``` -Start with PM2 ~ Tested with Ubuntu 20 server +Or Start as Background Process with PM2: Process Manager (For Production) ~ Tested with Ubuntu 20 server ```bash -# example of PATH_PM2 is /www/server/nodejs/v18.13.0/bin/pm2 +# example of PATH_PM2 is /www/server/nodejs/v18.13.0/bin/pm2 or you can use pm2 instance sudo PATH_PM2 start ecosystem.config.js * FORK or CLUSTER ? -> readmore [here](https://stackoverflow.com/a/36177256)