- 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
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:
- 69+ REST API endpoints across 11 resource groups
- JWT authentication (login/refresh)
- Swagger/OpenAPI documentation at /mvp/api/docs/
- Django Admin at /mvp/admin/
- Role-based permissions (admin, mill_user, buyer_user)
Backend path: /home/claude/customers/b2bpaper-app/backend/
marketplace-celery-worker
The Celery worker consumes tasks from the Redis queue (DB 1). It handles:
- Ingestion batch processing (parse, validate)
- Email polling for surplus list ingestion
- Auto-commit of trusted mill batches
- Matching algorithm execution when triggered by new surplus
- Newsletter generation and delivery
- Exclusivity window management
- Datasheet upload processing (sends PDFs to Extractor)
marketplace-celery-beat
The Celery beat process triggers scheduled tasks at configured intervals:
- Email polling every 5 minutes
- Exclusivity window expiry checks
- Pre-production item auto-transitions
- Newsletter scheduling based on buyer frequency preferences
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
- raw/articles/STATUS -- infrastructure overview and live URLs
- raw/notes/activeContext -- operational status of Celery processes
- raw/articles/DISCOVERIES -- backend integration notes
Related
- wiki/concepts/celery-beat-tasks -- detailed scheduled task descriptions
- wiki/concepts/database-credentials-and-roles -- database connections
- wiki/entities/paper-pdf-extractor -- the Extractor service called by the worker
- wiki/summaries/status-summary -- overall deployment status
- wiki/concepts/seed-accounts -- the endpoints these processes serve
- wiki/summaries/frontend-spec-summary -- Angular deployment (static, no PM2)