Skip to content

Hosting & Infrastructure

This document describes the hosting infrastructure for the Freeze Design webshop, including provider choices, cost breakdown, and scaling options.

Current Infrastructure

Two live environments

Staging (https://staging.freezedesign.nl, behind basic auth, docker-compose.staging.yml) and production (https://www.freezedesign.nl, docker-compose.prod.yml on a Hetzner CX43) are both live. Production runs tagged releases from main, deployed with scripts/deploy-production.sh (v1.60 on 2026-11-06); the shop went live on 2026-09-30. freezedesign.nl and prod.freezedesign.nl redirect to www. Each environment is one VPS; /opt/webshop holds the compose file, env file, scripts and nginx config that the deploy workflows copy there.

The table describes both environments.

Component Provider Details
VPS Hetzner Cloud (Nuremberg) Staging: 8 GB RAM / 4 vCPU (PostgreSQL tuned with shared_buffers=512MB). Production: CX43, 16 GB RAM / 8 vCPU (docker-compose.prod.yml sums container mem_limits to roughly 3.75 GB)
Media storage DigitalOcean Spaces ams3, buckets freeze-production-media / freeze-staging-media, served straight from the bucket (MEDIA_URL points at <bucket>.ams3.digitaloceanspaces.com); versioning on since 2026-09-28, and scripts/backup-media.sh copies the bucket with rclone to a second bucket
Database backups DigitalOcean Spaces Hourly AES-256-GCM encrypted pg_dump uploads (BACKUP_S3_*, bucket freeze-production-backups on production); tiered retention 24 hourly / 7 daily / 4 weekly, see Disaster Recovery
SSL Let's Encrypt Free; renewed weekly by ssl-renewal.yml for both environments plus a root crontab on each VPS (see Disaster Recovery)
DNS Openprovider (registrar) freezedesign.nl, www, prod and staging point straight at the VPSes; no Cloudflare proxy
CDN / DDoS none nginx limit_req zones only. A Cloudflare front was designed (Cloudflare CDN) but not put in use; the production-readiness review (item II-2) advised closing it, because a nameserver move touches the DNSSEC configured at go-live
Monitoring Sentry, PostHog, Discord Sentry (backend + frontend projects per environment), PostHog analytics via /ingest (one project for both environments, environment property on every event), Discord webhooks for deploys, backups, payments, errors and the Informer bookkeeping link; external uptime monitoring is still an open todo (externe-uptime-monitor)
Datacenter Germany EU location for GDPR compliance

VPS sizing

Checked on the servers on 2026-09-28: staging has 8 GB RAM and 4 vCPU, production 16 GB RAM and 8 vCPU. The compose files use far less than that: staging tunes PostgreSQL to shared_buffers=512MB, and docker-compose.prod.yml sums container mem_limits to roughly 3.75 GB (db 1 GB, backend 1 GB, celery 768 MB, frontend 512 MB, redis 256 MB, celery-beat 256 MB; nginx has no limit). There is room to grow without a bigger machine. scripts/provision-server.sh adds a 4 GB swap file as a safety net.

The application runs as 7 Docker containers orchestrated by Docker Compose (service names from docker-compose.prod.yml; staging uses the same names):

  1. nginx (nginx:1.31.6-alpine) -- reverse proxy, SSL termination, rate limiting, static file serving; config bind-mounted from nginx/nginx.conf (nginx.staging.conf on staging). /api/agent/ only admits the Freeze AI VM's tailnet IP (on staging without basic auth); see agent API
  2. backend (ghcr.io/voorman/webshop_freeze_design/backend, python:3.14-slim) -- Django/Gunicorn on port 8000, REST API under /api/, Django admin under /django-admin/
  3. frontend (ghcr.io/voorman/webshop_freeze_design/frontend, node:26-alpine) -- Next.js server-side rendering on port 3000, shop and /admin
  4. db (postgres:15-alpine) -- PostgreSQL 15 with SSL and per-environment tuning
  5. redis (redis:7-alpine) -- cache and Celery broker
  6. celery -- asynchronous task worker (concurrency 2 on production, 1 on staging; --max-memory-per-child=262144 in both, mem_limit 768m on production since #990)
  7. celery-beat -- periodic task scheduler (backups, payment checks, mails); HeartbeatScheduler with a healthcheck, restarted by cron when unhealthy (scripts/restart-unhealthy.sh, see Monitoring)
flowchart LR
    U[Browser] -->|HTTPS| DNS["DNS at Openprovider<br/>www / apex / prod / staging"]
    DNS --> NG
    subgraph VPS["Hetzner VPS (/opt/webshop, Docker Compose)"]
        NG["nginx :80/:443<br/>TLS, redirects, rate limits"]
        NG -->|/| FE["frontend<br/>Next.js :3000"]
        NG -->|"/api/, /django-admin/, /_allauth/"| BE["backend<br/>Django/Gunicorn :8000"]
        NG -->|"/static/"| ST[(static volume)]
        FE -->|server-side fetch| BE
        BE --> DB[(db<br/>PostgreSQL 15)]
        BE --> RD[(redis)]
        CW["celery worker"] --> DB
        CW --> RD
        CB["celery-beat"] --> RD
    end
    BE -->|media, S3 API| SP["DigitalOcean Spaces (ams3)<br/>media bucket"]
    U -->|product images| SP
    CW -->|hourly encrypted backups| BK["Spaces backup bucket"]
    BE --> MO[Mollie]
    BE --> SE[Sentry]
    FE --> SE
    FE -->|/ingest| PH[PostHog]
    CW --> DC[Discord webhooks]
    CB -. schedules .-> CW

Both environments have this shape; the k6 gate, E2E runs and the deploy workflows reach the VPS over SSH from GitHub Actions (.github/CI-CD.md).

Provider Comparison

Reference pricing for Hetzner Cloud tiers and competitors (early-2026 list prices, kept for the sizing decision). Staging runs on the 8 GB / 4 vCPU tier (~EUR 7.49), production on a CX43 (16 GB / 8 vCPU).

Provider Tier vCPU RAM Storage Traffic Price/mo
Hetzner ~2 GB 2 2 GB 40 GB NVMe 20 TB ~EUR 3.79
Hetzner ~4 GB 2 4 GB 40 GB NVMe 20 TB ~EUR 4.99
Hetzner 8 GB (staging) 4 8 GB 80 GB NVMe 20 TB ~EUR 7.49
Hetzner 16 GB, CX43 (production) 8 16 GB 160 GB NVMe 20 TB ~EUR 14.99
DigitalOcean Basic shared 2 4 GB 80 GB SSD 4 TB ~EUR 22
Contabo Cloud VPS S 4 8 GB 75 GB NVMe Unlimited EUR 4.99

Prices as of early 2026. DigitalOcean price estimated from USD 24/month.

Why Hetzner

Technical Fit

PostgreSQL is tuned per environment. The staging configuration (docker-compose.staging.yml) was tuned for a ~2 GB box and still runs with those values on the 8 GB VPS:

  • shared_buffers=512MB, effective_cache_size=1536MB
  • work_mem=4MB, maintenance_work_mem=128MB
  • max_connections=50

The production configuration (docker-compose.prod.yml) was written for ~4 GB (container mem_limits sum to roughly 3.75 GB) and runs on the 16 GB CX43 with plenty of headroom:

  • shared_buffers=1GB, effective_cache_size=3GB
  • work_mem=8MB, maintenance_work_mem=256MB
  • max_connections=50

The remaining memory covers Django/Gunicorn workers, Next.js, Redis, Celery, Nginx, and Docker overhead.

20 TB/month traffic far exceeds expected demand for a custom apparel e-commerce site.

NVMe storage is sufficient because media files live on DigitalOcean Spaces and database backups go to a separate Spaces bucket. The VPS only stores application code, Docker images, and the PostgreSQL data directory.

Cost Advantage

  • Significantly cheaper than DigitalOcean for equivalent or better specs
  • No hidden fees: IPv4 address included, firewall free, snapshots inexpensive
  • Contabo offers similar specs, but Hetzner has a stronger track record for performance consistency and customer support

EU Compliance

  • German datacenter locations
  • ISO 27001 certified
  • Meets GDPR data residency requirements for EU-based customers

Full TCO Breakdown (Monthly)

Service Provider Cost
VPS staging (8 GB / 4 vCPU) Hetzner Cloud ~EUR 7.49
VPS production (CX43, 16 GB / 8 vCPU) Hetzner Cloud ~EUR 14.99 (tier list price)
Volume (20 GB) Hetzner EUR 1.04
Snapshot backups (10 GB est.) Hetzner EUR 0.12
Domain (freezedesign.nl) Yearly / 12 ~EUR 0.75
SSL certificates Let's Encrypt FREE
Monitoring Sentry and PostHog free tiers (no external uptime monitor yet) FREE
CDN none —
Media storage DigitalOcean Spaces ~EUR 5.00
Database backups and media copy DigitalOcean Spaces included in the Spaces subscription
Total ~EUR 29-30/month

Annual cost: approximately EUR 350/year. Volume and snapshot lines are estimates; check the Hetzner invoice for the real amounts.

Pricing Notes

  • Hetzner volumes: EUR 0.052/GB/month (20 GB = EUR 1.04)
  • Hetzner snapshots: EUR 0.012/GB/month (10 GB = EUR 0.12)
  • DigitalOcean Spaces: 250 GB storage + 1 TB transfer included for USD 5/month
  • Database backups share the Spaces subscription with media (250 GB included); an hourly dump of an empty-catalog database is about 40 KB

Database Strategy

Decision: PostgreSQL in Docker container (not managed).

Why Docker PostgreSQL

  1. Hetzner does not offer managed PostgreSQL. Keeping the database on the same VPS avoids cross-provider latency and simplifies the architecture.
  2. Already proven. The application was developed and tested with Docker PostgreSQL. Production tuning parameters are baked into docker-compose.prod.yml.
  3. Automated backups. Hourly pg_dump to DigitalOcean Spaces with tiered retention, AES-256-GCM encrypted. Scheduled by Celery Beat (backend/config/celery.py) — see Disaster Recovery.
  4. No additional cost. Managed database services start at USD 15/month, which would more than double the TCO.

Configuration

  • Image: postgres:15-alpine (official PostgreSQL Docker image)
  • SSL/TLS: Enabled with self-signed certificates (certs/server.crt, server.key) for container-to-container encryption
  • Backups: Automated hourly dumps to DigitalOcean Spaces (see Disaster Recovery); production deploys run safe_migrate --dry-run first, which takes a backup before a destructive migration
  • Health checks: pg_isready with 30-second intervals; max_connections=50

Managed Database Alternative

If future requirements demand managed PostgreSQL (automated failover, compliance mandates, database size exceeding VPS capacity):

Provider Plan Starting Price
DigitalOcean Managed Database 1 GB / 1 vCPU ~USD 15/month
AWS RDS for PostgreSQL db.t4g.micro ~USD 15-20/month

Migration path: standard pg_dump / pg_restore, then update DATABASE_URL in the application environment.

Scaling Options

Vertical: Upgrade VPS Plan

The simplest scaling path. Hetzner allows live plan upgrades with brief downtime (5-10 minutes for VPS resize). No code changes required.

Tier vCPU RAM Storage Price/mo
~2 GB 2 2 GB 40 GB ~EUR 3.79
~4 GB 2 4 GB 40 GB ~EUR 4.99
~8 GB (staging) 4 8 GB 80 GB ~EUR 7.49
~16 GB (production, CX43) 8 16 GB 160 GB ~EUR 14.99
~32 GB 16 32 GB 320 GB ~EUR 29.99

After upgrading, adjust the PostgreSQL tuning parameters and mem_limits in docker-compose.prod.yml to take advantage of the additional RAM; the current values were written for a 4 GB machine.

Managed Database

Offload PostgreSQL to a managed service while keeping the application on Hetzner:

  • Migrate to DigitalOcean Managed PostgreSQL or AWS RDS
  • Update DATABASE_URL environment variable
  • Estimated total: EUR 7.49 (Hetzner) + ~EUR 14 (managed DB) = ~EUR 22/month

Consider this when:

  • Automated failover and high availability become requirements
  • The database outgrows the VPS disk or memory
  • Compliance mandates separation of compute and data

Horizontal: Multiple VPS Instances

For significant traffic growth:

  • Hetzner Load Balancer (EUR 5.49/month) distributing across multiple application VPS instances
  • Managed or dedicated database server
  • Redis Cluster or managed Redis for shared session/cache state
  • A CDN (the Cloudflare design in Cloudflare CDN) for static assets; today nginx serves them with long cache headers

This level of scaling is unlikely to be needed in the foreseeable future for a custom apparel e-commerce site.

Why DigitalOcean Spaces for Media

Media storage uses DigitalOcean Spaces rather than Hetzner Object Storage:

  1. Already configured. The Django storage backend (django-storages S3Storage, enabled via USE_SPACES / DO_SPACES_* env vars) runs on staging and production.
  2. ams3 (Amsterdam) region. EU datacenter, consistent with GDPR requirements.
  3. Simple pricing. Flat USD 5/month for 250 GB storage and 1 TB outbound transfer. No per-request fees to worry about.
  4. Direct serving. MEDIA_URL points at the bucket's own domain (<bucket>.ams3.digitaloceanspaces.com/media/), so product images never pass through the VPS; nginx's /media/ location only serves the local media volume.

Switching to Hetzner Object Storage would save approximately EUR 1-2/month but would require reconfiguring the storage backend and re-uploading all media files. Not worth the effort at current scale.