domaino/docker-compose.yml
agent bf4c619074 Production URLs: recommend URL_PORT=:443, strip default ports
A missing URL_PORT defaults to :8080, and deploy panels often can't store
an empty value, so production kept ORIGIN=https://admin.<domain>:8080 and
the admin login still failed with "Cross-site POST form submissions are
forbidden" (reproduced against production). URL_PORT=:443 is non-empty
and adapter-node normalises it away (new URL().origin).

The PUBLIC_* URLs are used verbatim in saved image URLs, email links and
the admin's View link, so they now go through baseUrl(), which drops
default ports and trailing slashes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KgF3Kf47LjPGHKQHszpUAv
2026-10-07 14:56:53 +00:00

109 lines
4.3 KiB
YAML

services:
pocketbase:
# Pinned: schema (pb_schema.json) and migrations target this version's
# format/JS API. Upgrade deliberately — read the PocketBase changelog,
# back up pb_data, then bump the tag and test migrations locally.
image: docker.io/spectado/pocketbase:0.23.12
container_name: massage-pocketbase
restart: unless-stopped
# Internal only — accessed via the caddy reverse proxy
expose:
- "80"
volumes:
- pocketbase:/pb_data
# Versioned schema changes; PocketBase applies pending ones on start.
- ./pocketbase/pb_migrations:/pb_migrations:ro,Z
# Shop API (baskets, slot holds, Stripe payments, orders) — the only
# place commerce data is written. See pocketbase/pb_hooks/shop/lib.js.
- ./pocketbase/pb_hooks:/pb_hooks:ro,Z
environment:
STRIPE_SECRET_KEY: ${STRIPE_SECRET_KEY:-}
STRIPE_WEBHOOK_SECRET: ${STRIPE_WEBHOOK_SECRET:-}
STRIPE_CURRENCY: ${STRIPE_CURRENCY:-eur}
# Shared with app-public: lets it record booking-email status on orders.
INTERNAL_API_SECRET: ${INTERNAL_API_SECRET:-}
app-admin:
build:
context: .
dockerfile: app-admin/Dockerfile
container_name: massage-app-admin
restart: unless-stopped
depends_on:
- pocketbase
environment:
PORT: 3001
POCKETBASE_INTERNAL_URL: http://pocketbase:80
# Browser-facing URLs. They must match the address bar exactly, or
# SvelteKit rejects logins/forms ("Cross-site POST form submissions are
# forbidden"). Behind a TLS proxy: URL_SCHEME=https and URL_PORT=:443
# (the default port is dropped, giving https://admin.<domain>). If
# URL_PORT is not set at all it defaults to :8080 (local dev).
PUBLIC_POCKETBASE_URL: ${URL_SCHEME:-http}://db.${DOMAIN:-localhost}${URL_PORT-:8080}
ORIGIN: ${URL_SCHEME:-http}://admin.${DOMAIN:-localhost}${URL_PORT-:8080}
PUBLIC_SITE_URL: ${URL_SCHEME:-http}://www.${DOMAIN:-localhost}${URL_PORT-:8080}
BODY_SIZE_LIMIT: 52428800 # 50MB — import payload embeds all images as base64
STRIPE_CURRENCY: ${STRIPE_CURRENCY:-eur}
# Booking emails (Brevo SMTP relay) — admin needs these for resend/test sends
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASS: ${SMTP_PASS:-}
EMAIL_FROM: ${EMAIL_FROM:-}
EMAIL_FROM_NAME: ${EMAIL_FROM_NAME:-}
SITE_TIMEZONE: ${SITE_TIMEZONE:-Europe/Oslo}
# Internal only — served via the caddy reverse proxy
expose:
- "3001"
app-public:
build:
context: .
dockerfile: app-public/Dockerfile
container_name: massage-app-public
restart: unless-stopped
depends_on:
- pocketbase
environment:
PORT: 3000
POCKETBASE_INTERNAL_URL: http://pocketbase:80
PUBLIC_POCKETBASE_URL: ${URL_SCHEME:-http}://db.${DOMAIN:-localhost}${URL_PORT-:8080}
ORIGIN: ${URL_SCHEME:-http}://www.${DOMAIN:-localhost}${URL_PORT-:8080}
# No PocketBase or Stripe secrets here: shop writes happen in PocketBase
# (pb_hooks/shop). The publishable key is public by design.
PUBLIC_STRIPE_PUBLISHABLE_KEY: ${PUBLIC_STRIPE_PUBLISHABLE_KEY:-}
STRIPE_CURRENCY: ${STRIPE_CURRENCY:-eur}
INTERNAL_API_SECRET: ${INTERNAL_API_SECRET:-}
# Booking emails (Brevo SMTP relay) — sent from the Stripe webhook
SMTP_HOST: ${SMTP_HOST:-}
SMTP_PORT: ${SMTP_PORT:-587}
SMTP_USER: ${SMTP_USER:-}
SMTP_PASS: ${SMTP_PASS:-}
EMAIL_FROM: ${EMAIL_FROM:-}
EMAIL_FROM_NAME: ${EMAIL_FROM_NAME:-}
SITE_TIMEZONE: ${SITE_TIMEZONE:-Europe/Oslo}
# Internal only — served via the caddy reverse proxy
expose:
- "3000"
caddy:
image: docker.io/library/caddy:2-alpine
container_name: massage-caddy
restart: unless-stopped
ports:
- "8080:8080"
environment:
DOMAIN: ${DOMAIN:-localhost}
# Scheme used in Caddyfile site addresses. "http" = plain HTTP on :8080
# (matches the ORIGIN vars below). Switch to "https" only if you also
# update ORIGIN/PUBLIC_* URLs and provide a cert issuer.
CADDY_SCHEME: ${CADDY_SCHEME:-http}
volumes:
- ./Caddyfile:/etc/caddy/Caddyfile:ro,Z
depends_on:
- app-admin
- app-public
- pocketbase
volumes:
pocketbase: