-
Install PM2 globally:
npm install -g pm2
-
Build and start the bot with PM2:
npm run build pm2 start npm --name "Kat-Wallet-Bot" -- start
-
Save the PM2 process list to keep the bot running after closing SSH:
pm2 save
When you have new changes to deploy:
-
Pull the latest changes from the main branch:
git pull origin main
-
Rebuild and restart the bot:
npm run build pm2 restart Kat-Wallet-Bot
- View running processes:
pm2 list
- Monitor bot in real-time:
pm2 monit
- View bot logs:
pm2 logs Kat-Wallet-Bot
- Stop the bot:
pm2 stop Kat-Wallet-Bot
- Remove the bot from PM2:
pm2 delete Kat-Wallet-Bot
Remember to run pm2 save
after making changes to ensure the current process list is saved for automatic restarts.