type
entity
created
Tue Apr 07 2026 02:00:00 GMT+0200 (Central European Summer Time)
updated
Tue Apr 07 2026 02:00:00 GMT+0200 (Central European Summer Time)
sources
raw/articles/STATUS, raw/notes/activeContext, raw/articles/DISCOVERIES
tags
entity pm2 processes infrastructure deployment

PM2 Marketplace Stack

abstract
The Paper Surplus Marketplace runs as three PM2-managed processes: the gunicorn API server (port 8910), a Celery worker for async task processing, and a Celery beat scheduler for periodic tasks -- all behind an nginx reverse proxy at b2bpaper.xdvu.com/mvp/.

Overview

PM2 is the process manager for the marketplace backend. It handles auto-restart on crashes, log management, and process monitoring. The Angular frontend is not a PM2 process -- it compiles to static files served directly by nginx.

Process Table

PM2 Name Process Port Purpose
marketplace-api gunicorn 8910 Django REST API serving 69+ endpoints
marketplace-celery-worker Celery worker N/A Processes async tasks from Redis queue
marketplace-celery-beat Celery beat N/A Triggers scheduled/periodic tasks

Process Details

marketplace-api (Gunicorn)

The main API server running Django 6.0.2 + DRF 3.16.1 via gunicorn. Binds to port 8910 on localhost. Nginx reverse-proxies requests from https://b2bpaper.xdvu.com/mvp/ to this port.

What it serves:

Backend path: /home/claude/customers/b2bpaper-app/backend/

marketplace-celery-worker

The Celery worker consumes tasks from the Redis queue (DB 1). It handles:

marketplace-celery-beat

The Celery beat process triggers scheduled tasks at configured intervals:

Nginx Configuration

The nginx config at /etc/nginx/sites-available/b2bpaper.xdvu.com handles:

/mvp/api/  → proxy_pass to localhost:8910  (Django API)
/mvp/admin/ → proxy_pass to localhost:8910  (Django Admin)
/mvp/app/  → alias to Angular build output  (static files)
/mvp/      → proxy_pass to localhost:8910  (redirects to Swagger)

The Angular frontend is built to /var/www/hub/b2bpaper-app/ (or the dist directory) and served as static files -- no PM2 process needed.

Common PM2 Commands

# View all processes
pm2 list

# View logs
pm2 logs marketplace-api
pm2 logs marketplace-celery-worker
pm2 logs marketplace-celery-beat

# Restart a process
pm2 restart marketplace-api

# Restart all marketplace processes
pm2 restart marketplace-api marketplace-celery-worker marketplace-celery-beat

# Monitor CPU/memory
pm2 monit

Dependencies Between Processes

nginx
  │
  ├── marketplace-api (gunicorn, port 8910)
  │     │
  │     ├── PostgreSQL (marketplace DB)
  │     └── Redis (DB 1, caching)
  │
  ├── marketplace-celery-worker
  │     │
  │     ├── Redis (DB 1, task queue)
  │     ├── PostgreSQL (marketplace DB)
  │     └── Paper PDF Extractor (localhost:8925, for datasheet processing)
  │
  └── marketplace-celery-beat
        │
        └── Redis (DB 1, schedule storage)

Related Services (Not PM2-Managed by Marketplace)

Service Port What
Paper PDF Extractor 8925 Flask + Gemini Flash for PDF extraction
PostgreSQL 5432 Primary database
Redis 6379 Cache and message broker
Nginx 80/443 Reverse proxy

Sources

Related