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

pm2 start #15

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

pm2 start #15

wants to merge 9 commits into from

Conversation

mdestafadilah
Copy link

ini contoh penggunaan dengan PM2 pak. mohon di acc yak.

Copy link
Owner

@mimamch mimamch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

butuh beberapa penyesuaian karena mengutamakan general use yaitu tidak semua menggunakan PM2 untuk production serta developer yang masih awam dan tidak terbiasa menggunakan PM2

README.md Outdated
Start with PM2 ~ Tested with Ubuntu 20 server

```bash
# example of PATH_PM2 is /www/server/nodejs/v18.13.0/bin/pm2
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ini malah bikin bingung pak

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bagian mana pak?


```bash
# example of PATH_PM2 is /www/server/nodejs/v18.13.0/bin/pm2
sudo PATH_PM2 start ecosystem.config.js
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lebih baik langsung panggil instance pm2 dibanding bingung nyari apa itu PATH_PM2

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

karena ada beberapa server multiple nodejs pak

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nodejs versioning udh dihandle sama nvm jadi tidak perlu install banyak nodejs dan install pm2 disetiap versi node

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gak semua server punya nvm pak, saya termasuk, install nodejs manual.

# 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)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sepertinya tidak urgent untuk memilih FORK atau CLUSTER pak, lebih baik default saja

apps : [
{
name : "Start WA-Gateway with PM2",
script : "./index.js",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer jalankan script yang ada di package.json supaya tidak call 2 kali
diganti "npm start" aja cukup

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cukup 1 kalo pak. bisa pilih, yarn start atau dengan pm2.

{
name : "Start WA-Gateway with PM2",
script : "./index.js",
instances : "1",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instance tidak perlu karena default sudah 1

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

betul

name : "Start WA-Gateway with PM2",
script : "./index.js",
instances : "1",
exec_mode : "fork",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tidak perlu karena default sudah mode FORK

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

betul

script : "./index.js",
instances : "1",
exec_mode : "fork",
env: {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ENV tidak perlu karena sudah di inisialkan pada file .env

module.exports = {
apps : [
{
name : "Start WA-Gateway with PM2",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nama terlalu panjang dan tidak deskriptif, karena akan menjadi instance name pada list process pm2, prefer simple yang mewakili instance aplikasi yang berjalan seperti : "wa-gateway"

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boleh pak

README.md Outdated
@@ -46,6 +46,15 @@ Start the server
npm run start
```

Start with PM2 ~ Tested with Ubuntu 20 server
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cocoknya diganti "Or Start as Background Process with PM2: Process Manager (For Production)"

Kata OR dibutuhkan karena dapat memilih antara opsi diatasnya atau opsi ini

dan diberikan label "Optional" serta keterangan jika step ini hanya dibutuhkan jika butuh menjalankan pada production dan butuh berjalan pada backround process

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudah di up pak

@mdestafadilah
Copy link
Author

butuh beberapa penyesuaian karena mengutamakan general use yaitu tidak semua menggunakan PM2 untuk production serta developer yang masih awam dan tidak terbiasa menggunakan PM2

optional pak, run project dengan nodejs biasa juga bisa masih, saya pake methode ini karena sering kali project crash, kalo di pm2 otomatis running kalo server mati

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants