This guide explains how to deploy the PeachyGang website and dashboard on a Linux VPS using Node.js v20, MongoDB, PM2, Nginx, Nano and SSL via Let's Encrypt.
Make sure peachyganggg.com and api.peachyganggg.com both point to your VPS IP via A records.
sudo apt update && sudo apt upgrade -y
sudo apt install -y git curl build-essential ufw nginx nanocurl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
npm install -g pm2curl -fsSL https://pgp.mongodb.com/server-7.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-7.0.gpg --dearmor
echo "deb [ signed-by=/usr/share/keyrings/mongodb-server-7.0.gpg ] https://repo.mongodb.org/apt/ubuntu $(lsb_release -sc)/mongodb-org/7.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list
sudo apt update
sudo apt install -y mongodb-org
sudo systemctl start mongod
sudo systemctl enable mongodcd /var/www
git clone https://github.com/yuuslokrobjakkroval/peachy-dashboard-backend.git
cd peachy-dashboard-backend
nano .envPaste:
BOT_TOKEN=...
BOT_CLIENT_ID=1342317947573633077
BOT_CLIENT_SECRET=...
MONGODB_URI=mongodb://localhost:27017/peachy
PORT=8080
PRODUCTION=true
WEB_URL=https://peachyganggg.com
API_ENDPOINT=https://discord.com/api/v10npm install
npm run build
pm2 start dist/main.js --name peachy-backend
pm2 savecd /var/www
git clone https://github.com/yuuslokrobjakkroval/peachy-gang.git
cd peachy-gang
nano .envPaste:
APP_URL=https://peachyganggg.com
NEXT_PUBLIC_API_ENDPOINT=https://api.peachyganggg.com
BOT_CLIENT_ID=1342317947573633077
BOT_CLIENT_SECRET=...npm install
npm run build
pm2 start "npm run start" --name peachy-frontend
pm2 savesudo nano /etc/nginx/sites-available/peachygangPaste:
server {
listen 80;
server_name peachyganggg.com;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
server {
listen 80;
server_name api.peachyganggg.com;
location / {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
sudo ln -s /etc/nginx/sites-available/peachygang /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl reload nginxsudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d peachyganggg.com -d api.peachyganggg.comsudo certbot renew --dry-runpm2 ls
sudo systemctl status nginx
sudo ufw statussudo ufw allow OpenSSH
sudo ufw allow 80
sudo ufw allow 443
sudo ufw enable- Frontend: https://peachyganggg.com
- Backend: https://api.peachyganggg.com