Skip to content

Worker Box

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 pg pool)

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.

Cloudflare Workers have these limitations that make them unsuitable for all workloads:

LimitationWorker Box Solution
30s CPU time limit per invocationNo time limit on VPS
No filesystem writes (tmpfs only)Full filesystem access
No node:child_processCan run shell commands
No native PostgreSQL wire protocolFull pg pool access
Memory limits (128MB–1GB)4GB+ RAM available

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 TypeDescriptionWorker Box Action
openimmo.importParse OpenImmo XML ZIPExtract XML, parse units, insert/update DB, process images
image.labelAuto-classify unit imagesApply filename heuristics + optional Vision API
ecb.refreshFetch ECB reference ratesHTTP fetch ECB SDW API, update portal_settings

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:

  • pg pool for direct database access (not Neon HTTP)
  • AWS SDK S3 for R2 operations
  • node:crypto for hashing and validation