Add monitor/setup/serverlite_node.sh

This commit is contained in:
Quynh Nguyen 2025-05-15 04:30:48 +00:00
parent 0aa1665855
commit 4b4ae6f1a9

View File

@ -0,0 +1,47 @@
#!/bin/bash
#*************serverlite nodejs****************************
echo "install serverlite nodejs"
cd /root
git clone http://gitea.beetai.com/dongpd/BiFace_Server_Config_API.git
#sudo apt-get install -y nodejs npm
#sudo apt-get install -y nodejs-dev node-gyp libssl1.0-dev
#sudo apt install -y npm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.2/install.sh | bash
chmod +x ~/.nvm/nvm.sh
. ~/.bashrc
nvm install 16
npm install pm2@5.4.2 -g n
#sudo n stable
pm2 install pm2-logrotate
cd BiFace_Server_Config_API
npm install
cd /root/monitor/setup/
pm2 ecosystem
echo "
module.exports = {
apps : [
{
name: 'Server_lite',
cwd: '/root/BiFace_Server_Config_API',
script: 'server.js',
args: '',
interpreter: 'node',
restart_delay: 1000,
cron_restart: '0 0 * * *',
watch: false,
time: true
}
]
};
" > ecosystem.config.js
pm2 reload ecosystem.config.js
pm2 startup
pm2 save