Worker Box
Overview
Section titled “Overview”The Worker Box is the existing Hetzner CPX22 (€15/month) — no new server needed. It handles workloads unsuitable for Cloudflare Workers/Pages, managed via Dokploy (already installed):
- CPU-intensive tasks (OpenImmo XML parsing, 50 MB ZIP)
- Long-running operations (floorplan OCR, PDF generation with puppeteer)
- Scheduled jobs (pg_dump backup, TLS certificate status check)
- Direct PostgreSQL access (Wire protocol via
pgpool)
Cloudflare Images handles routine image resizing, WebP/AVIF conversion, and thumbnail generation on-the-fly. Only floorplan OCR, labeling, and PDF generation require the CPX22.
Why a Separate Worker Box?
Section titled “Why a Separate Worker Box?”Cloudflare Workers have these limitations that make them unsuitable for all workloads:
| Limitation | Worker Box Solution |
|---|---|
| 30s CPU time limit per invocation | No time limit on VPS |
| No filesystem writes (tmpfs only) | Full filesystem access |
No node:child_process | Can run shell commands |
| No native PostgreSQL wire protocol | Full pg pool access |
| Memory limits (128MB–1GB) | 4GB+ RAM available |
Job Queue
Section titled “Job Queue”The Worker Box polls a jobs table in PostgreSQL for queued work:
jobs { id: uuid PK organization_id, project_id type: 'openimmo.import' | 'image.label' | 'ecb.refresh' | ... status: 'queued' | 'running' | 'done' | 'failed' payload, result: jsonb attempts: int}Job Types
Section titled “Job Types”| Job Type | Description | Worker Box Action |
|---|---|---|
openimmo.import | Parse OpenImmo XML ZIP | Extract XML, parse units, insert/update DB, process images |
image.label | Auto-classify unit images | Apply filename heuristics + optional Vision API |
ecb.refresh | Fetch ECB reference rates | HTTP fetch ECB SDW API, update portal_settings |
Deployment
Section titled “Deployment”The Worker Box runs as a Docker Compose stack managed by Dokploy (already running on the CPX22). Dokploy handles:
- Dockerfile-based builds from GitHub
- Environment variables managed in UI
- Logs for the worker container
- Restart policy (container keeps running after reboot)
It uses:
pgpool for direct database access (not Neon HTTP)- AWS SDK S3 for R2 operations
node:cryptofor hashing and validation