1

I want to install pm2-logrotate on linux machine where the machine is not having internet connectivity

https://www.npmjs.com/package/pm2-logrotate

3 Answers3

1

To make an offline installer, you need to make your own tar.gz file.

First, you need to download the Source code (tar.gz) from Pm2 GitHub

Extract the tar.gz file and this will create a folder with the source inside

Rename the main folder (normally named pm2-logrotate-2.7.0) to module and create the pm2-logrotate-2.7.0.tar.gz file again with the module folder

The struct of the files inside of the tar.gz will be something like:

module
|- .gitignore
|- CHANGELOG.md
|- README.md
|- app.js
|- node_modules
|- package-lock.json
|- package.json
|- pres
|- test

Then you can use the command pm2 install pm2-logrotate-2.7.0.tar.gz without getting errors

Zero
  • 533
  • 3
  • 13
  • I know this is an old unanswered question but I think this might help someone like me who worked almost 1 day just doing this – Zero Apr 14 '22 at 20:17
1

1.Download source code tar.gz pm2-logrotate

2.Install modules in code, Copy code to the same server environment(in network)

tar -xzvf pm2-logrotate-2.7.0.tar.gz
cd pm2-logrotate-2.7.0/
npm install
tar -czvf pm2-logrotate.tar.gz pm2-logrotate-2.7.0

3.Copy pm2-logrotate.tar.gz to offline server to .pm2/modules

cd ~/.pm2/modules/
tar -xzvf pm2-logrotate.tar.gz
pm2 module:generate pm2-logrotate
cd pm2-logrotate
pm2 install .

4.Add conf in to .pm2/module_conf.json

{ 
   "pm2-logrotate": {
        "max_size": "10M",
        "retain": "30",
        "compress": false,
        "dateFormat": "YYYY-MM-DD_HH-mm-ss",
        "workerInterval": "30",
        "rotateInterval": "0 0 * * *",
        "rotateModule": true
    },
    "module-db-v2": {
        "pm2-logrotate": {}
    }

}

Run pm2 conf pm2-logrotate can see pm2-logrotate config

Reset conf

pm2 set pm2-logrotate:max_size 100M
gkfonline
  • 11
  • 2
0
pm2 install pm2-logrotate-2.7.0.tgz
onerinas
  • 198
  • 1
  • 1
  • 11