Skip to main content
Deploy Pongo on your own VPS or bare metal server for complete control over your infrastructure.

Requirements

System Requirements

  • OS: Ubuntu 22.04+ / Debian 11+ / CentOS 8+ (or any Linux distribution)
  • RAM: Minimum 1GB, 2GB+ recommended
  • Storage: 5GB+ for application and data
  • CPU: 1+ cores
  • Network: Public IP address and open ports 80/443

Software Requirements

  • Bun: Latest version (runtime)
  • Node.js: 18+ (alternative to Bun)
  • PostgreSQL: 14+ (recommended) or SQLite
  • Nginx: Latest (reverse proxy)
  • systemd: For process management
  • Git: For deployment

Installation

1

Install Bun

curl -fsSL https://bun.sh/install | bash
source ~/.bashrc
2

Install PostgreSQL (optional)

# Ubuntu/Debian
sudo apt update
sudo apt install postgresql postgresql-contrib

# Start and enable
sudo systemctl start postgresql
sudo systemctl enable postgresql

# Create database and user
sudo -u postgres psql
CREATE DATABASE pongo;
CREATE USER pongo WITH PASSWORD 'your-password';
GRANT ALL PRIVILEGES ON DATABASE pongo TO pongo;
\q
3

Clone repository

cd /opt
sudo git clone https://github.com/TimMikeladze/pongo.git
cd pongo
4

Install dependencies

bun install --frozen-lockfile
5

Configure environment

cp .env.example .env
nano .env
Set the following variables:
.env
DATABASE_URL=postgres://pongo:your-password@localhost:5432/pongo
ACCESS_CODE=your-secret-password
NODE_ENV=production
NEXT_PUBLIC_URL=https://your-domain.com
6

Run database migrations

# PostgreSQL
bun run db:pg:migrate

# SQLite (if using)
bun run db:sqlite:migrate
7

Build the application

bun run build

Process Management with systemd

Create systemd service files to manage Pongo processes.

Web Dashboard Service

Create /etc/systemd/system/pongo-web.service:
pongo-web.service
[Unit]
Description=Pongo Web Dashboard
After=network.target postgresql.service

[Service]
Type=simple
User=www-data
WorkingDirectory=/opt/pongo
Environment="NODE_ENV=production"
EnvironmentFile=/opt/pongo/.env
ExecStart=/root/.bun/bin/bun run start
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier=pongo-web

[Install]
WantedBy=multi-user.target

Scheduler Service

Create /etc/systemd/system/pongo-scheduler.service:
pongo-scheduler.service
[Unit]
Description=Pongo Monitor Scheduler
After=network.target postgresql.service

[Service]
Type=simple
User=www-data
WorkingDirectory=/opt/pongo
Environment="NODE_ENV=production"
EnvironmentFile=/opt/pongo/.env
ExecStart=/root/.bun/bin/bun scheduler
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier=pongo-scheduler

[Install]
WantedBy=multi-user.target

Archiver Service (Optional)

Create /etc/systemd/system/pongo-archiver.service:
pongo-archiver.service
[Unit]
Description=Pongo Data Archiver
After=network.target postgresql.service

[Service]
Type=simple
User=www-data
WorkingDirectory=/opt/pongo
Environment="NODE_ENV=production"
EnvironmentFile=/opt/pongo/.env
ExecStart=/root/.bun/bin/bun archiver
Restart=always
RestartSec=10
StandardOutput=journal
StandardError=journal
SyslogIdentifier=pongo-archiver

[Install]
WantedBy=multi-user.target

Enable and Start Services

# Reload systemd
sudo systemctl daemon-reload

# Enable services to start on boot
sudo systemctl enable pongo-web
sudo systemctl enable pongo-scheduler
sudo systemctl enable pongo-archiver  # if using

# Start services
sudo systemctl start pongo-web
sudo systemctl start pongo-scheduler
sudo systemctl start pongo-archiver  # if using

# Check status
sudo systemctl status pongo-web
sudo systemctl status pongo-scheduler

Nginx Reverse Proxy

Configure Nginx as a reverse proxy with SSL termination.

Install Nginx and Certbot

sudo apt update
sudo apt install nginx certbot python3-certbot-nginx

Configure Nginx

Create /etc/nginx/sites-available/pongo:
pongo
server {
    listen 80;
    server_name your-domain.com;

    # Redirect HTTP to HTTPS
    return 301 https://$server_name$request_uri;
}

server {
    listen 443 ssl http2;
    server_name your-domain.com;

    # SSL certificates (will be configured by certbot)
    ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;

    # SSL configuration
    ssl_protocols TLSv1.2 TLSv1.3;
    ssl_ciphers HIGH:!aNULL:!MD5;
    ssl_prefer_server_ciphers on;

    # Logs
    access_log /var/log/nginx/pongo-access.log;
    error_log /var/log/nginx/pongo-error.log;

    # Proxy to Next.js
    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_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_cache_bypass $http_upgrade;
    }

    # Optional: Scheduler API
    location /scheduler/ {
        proxy_pass http://localhost:3001/;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

Enable Site and Obtain SSL Certificate

# Enable site
sudo ln -s /etc/nginx/sites-available/pongo /etc/nginx/sites-enabled/

# Test configuration
sudo nginx -t

# Obtain SSL certificate
sudo certbot --nginx -d your-domain.com

# Reload Nginx
sudo systemctl reload nginx

Auto-Renewal

Certbot automatically sets up certificate renewal. Test it:
sudo certbot renew --dry-run

Firewall Configuration

# Allow SSH, HTTP, HTTPS
sudo ufw allow 22/tcp
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

# Enable firewall
sudo ufw enable

# Check status
sudo ufw status

Monitoring and Logs

View Logs

# Web dashboard logs
sudo journalctl -u pongo-web -f

# Scheduler logs
sudo journalctl -u pongo-scheduler -f

# All Pongo services
sudo journalctl -t pongo-web -t pongo-scheduler -f

# Nginx logs
sudo tail -f /var/log/nginx/pongo-access.log
sudo tail -f /var/log/nginx/pongo-error.log

Service Status

# Check service status
sudo systemctl status pongo-web
sudo systemctl status pongo-scheduler

# Restart services
sudo systemctl restart pongo-web
sudo systemctl restart pongo-scheduler

Backup and Restore

PostgreSQL Backup

# Backup
sudo -u postgres pg_dump pongo > backup-$(date +%Y%m%d).sql

# Restore
sudo -u postgres psql pongo < backup-20250101.sql

Automated Backups

Create /opt/pongo/backup.sh:
backup.sh
#!/bin/bash
BACKUP_DIR="/opt/pongo/backups"
mkdir -p $BACKUP_DIR

# Backup database
sudo -u postgres pg_dump pongo | gzip > "$BACKUP_DIR/pongo-$(date +%Y%m%d-%H%M%S).sql.gz"

# Delete backups older than 30 days
find $BACKUP_DIR -name "pongo-*.sql.gz" -mtime +30 -delete
Add to crontab:
sudo chmod +x /opt/pongo/backup.sh
sudo crontab -e

# Add line:
0 2 * * * /opt/pongo/backup.sh

Updating Pongo

1

Pull latest changes

cd /opt/pongo
sudo git pull origin main
2

Install dependencies

bun install --frozen-lockfile
3

Run migrations

bun run db:pg:migrate
4

Rebuild application

bun run build
5

Restart services

sudo systemctl restart pongo-web
sudo systemctl restart pongo-scheduler

Troubleshooting

Services won’t start

  1. Check logs: sudo journalctl -u pongo-web -n 50
  2. Verify environment variables: sudo cat /opt/pongo/.env
  3. Check file permissions: sudo chown -R www-data:www-data /opt/pongo

Database connection errors

  1. Verify PostgreSQL is running: sudo systemctl status postgresql
  2. Test connection: psql -h localhost -U pongo -d pongo
  3. Check DATABASE_URL format in .env

Nginx errors

  1. Test configuration: sudo nginx -t
  2. Check logs: sudo tail -f /var/log/nginx/error.log
  3. Verify port 3000 is listening: sudo netstat -tlnp | grep 3000

High memory usage

  1. Check process memory: sudo systemctl status pongo-web
  2. Adjust database connection pool size
  3. Consider upgrading server resources

Security Recommendations

  • Keep system packages updated: sudo apt update && sudo apt upgrade
  • Use strong passwords for ACCESS_CODE and database
  • Restrict SSH access: Disable password auth, use SSH keys
  • Enable automatic security updates
  • Configure fail2ban to prevent brute force attacks
  • Regular backup verification
  • Monitor logs for suspicious activity
  • Use a dedicated user (not root) for running services

Build docs developers (and LLMs) love