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

[FEATURE] Using npm start #662

Closed
martadinata666 opened this issue Jun 23, 2022 · 3 comments · Fixed by #657
Closed

[FEATURE] Using npm start #662

martadinata666 opened this issue Jun 23, 2022 · 3 comments · Fixed by #657

Comments

@martadinata666
Copy link
Collaborator

martadinata666 commented Jun 23, 2022

Is your feature request related to a problem? Please describe.
By default the youtubedl-m use PM2 runtime, that need installed manually npm install -g pm2 that need use root permission. By using npm start in package.json. We can include pm2 in backend dependencies and set npm start to pm2-runtime --raw pm2.config.js then dropping the need install pm2-runtime with root permission.

Looking from

"start": "nodemon app.js",
seems youtubedl-m used to be using nodemon and spoiler: i tried and it not working.

Describe the solution you'd like

  1. Change npm start to pm2-runtime --raw pm2.config.js
  2. Add pm2-runtime to backend dependencies

Additional context
Using npm start will likely easier reproducible runtime, as user doesn't need to manually install pm2.

#657

@Tzahi12345
Copy link
Owner

I removed all references to nodemon: 0ffd702

I'm not an npm expert, but I'm not positive that adding pm2-runtime to package.json in backend will work (https://stackoverflow.com/a/10813149/8088021). The instructions on the npm page also only say to use the -g.

Does npm start circumvent this somehow by including commands from node_modules?

@martadinata666
Copy link
Collaborator Author

martadinata666 commented Jun 24, 2022

I tried locally it work fine, npm will include command from node_modules.
This some behaviour covered when pm2 installed locally.

debian@18fc2d8d6978:~/youtubedl-material$ cat package.json | grep start
    "start": "pm2-runtime --raw pm2.config.js",
      "restart_update.json",
      "restart_general.json"
debian@18fc2d8d6978:~/youtubedl-material$ pm2-runtime --raw pm2.config.js
bash: pm2-runtime: command not found
debian@18fc2d8d6978:~/youtubedl-material$ npm start

> backend@1.0.0 start
> pm2-runtime --raw pm2.config.js

2022-06-24T11:56:47: PM2 log: Launching in no daemon mode
2022-06-24T11:56:47: PM2 log: [Watch] Start watching YoutubeDL-Material
2022-06-24T11:56:47: PM2 log: App [YoutubeDL-Material:0] starting in -fork mode-
2022-06-24T11:56:47: PM2 log: App [YoutubeDL-Material:0] online
2022-06-24T04:56:48.209Z INFO: Config items set using ENV variables.
2022-06-24T04:56:48.876Z INFO: YoutubeDL-Material v4.2 started on PORT 8080

The caveat is, when run the binaries directly need to use npx.

debian@18fc2d8d6978:~/youtubedl-material$ pm2 list
bash: pm2: command not found
debian@18fc2d8d6978:~/youtubedl-material$ npx pm2 list
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0  │ YoutubeDL-Material │ fork     │ 1    │ online    │ 0%       │ 87.7mb   │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
debian@18fc2d8d6978:~/youtubedl-material$ 

But it just preferences, as i prefer reduce usage of root installation much as possible.

@Tzahi12345
Copy link
Owner

Implemented in #657!

Commit: fecefde

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 a pull request may close this issue.

2 participants