1. ⚙️ Initial VPS Preparation
Connect to your VPS via SSH and run the following commands to update system dependencies and install the correct Node.js version.Step 1: Update Packages
Step 2: Install Node.js v24 (LTS)
Install Node.js utilizing the official NodeSource binaries:Step 3: Install PM2 Globally
Install the PM2 process manager globally on the system:2. 📂 Project Deployment
- Transfer your configured Razor Bot Source Code and Razor Docs folders to your VPS (either using SFTP/FileZilla or by pushing to a private GitHub repository and cloning it).
- Navigate into the project folder on your VPS:
- Compile all packages:
3. 🚀 Daemonizing Processes with PM2
Instead of starting withnpm start (which exits as soon as your SSH console session terminates), we will run the processes in the background using PM2.
Starting the Razor Bot
Launch the bot loader script and name the processrazor-bot:
6488.
4. 🔒 Persisting Across Reboots
If your VPS hosting provider does emergency maintenance and reboots your server, PM2 can automatically restore your running processes. Run the startup generator command:🛠️ Handy PM2 Commands
Use these commands to monitor and manage your bot and docs processes on the VPS:| Command | Description |
|---|---|
pm2 status | View a list of all active processes, their IDs, CPU usage, and memory consumption. |
pm2 logs razor-bot | Open live console logs for the bot (great for debugging errors). |
pm2 logs razor-docs | Open live console logs for the documentation site. |
pm2 restart razor-bot | Reload the bot (use this whenever you update config.js or files). |
pm2 stop razor-bot | Temporarily halt the bot process. |
pm2 delete razor-bot | Fully remove the process from PM2’s management list. |
