Clone Repository
Setup SSH Key for GitHub
Clone the Repository
Install Dependencies
Install backend dependencies using Bun:Bun is significantly faster than npm/yarn for installing dependencies.
Configure Environment
Copy the example environment file and configure it:PM2 Process Manager Setup
PM2 manages the backend API and background workers with automatic restarts and monitoring.Create PM2 Ecosystem File
Createecosystem.config.js in the backend directory:
Create Logs Directory
Start Applications with PM2
PM2 Management Commands
View Processes
Manage Processes
View Logs
Nginx Configuration
Create Node.js Site (CloudPanel)
Configure Site
- Domain Name:
api.archive.example.com - Site User:
archive-api - App: Select Node.js
- Node.js Version: Latest (20.x)
- App Port:
3000 - Site Root:
/home/archive-api/htdocs(auto-filled)
Manual Nginx Configuration
If not using CloudPanel, create Nginx configuration manually:/etc/nginx/sites-available/archive-api
SSL Certificate Setup
Via CloudPanel (Recommended)
Manual SSL with Certbot
Verify Deployment
Check API Health
Check PM2 Status
Troubleshooting
API Not Responding
Workers Not Processing Jobs
High Memory Usage
Next Steps
Monitoring
Set up monitoring, logs, and backups
Configuration
Configure environment variables