deckhearth/docs/DOKPLOY_DEPLOY.md
Randall Stillwell 6fcefa042f
Some checks failed
Preview smoke / Should run? (pull_request) Has been cancelled
CI / Lint (pull_request) Has been cancelled
CI / Schema map up to date (pull_request) Has been cancelled
CI / Forbidden patterns (9 checks) (pull_request) Has been cancelled
CI / Migrations apply (node-pg-migrate) (pull_request) Has been cancelled
CI / Unit tests (vitest) (pull_request) Has been cancelled
Convoy metrics gate / Require role-event telemetry on convoy PRs (pull_request) Has been cancelled
PR Health rollup / Aggregate gate status (pull_request) Has been cancelled
Preview smoke / Playwright smoke (pull_request) Has been cancelled
feat(pricing): wire Lorcast (Lorcana) + TCGdex (Pokemon) + docs
- lib/card-import/lorcana-bulk.js: Lorcast per-card pricing via api.lorcast.com/v0/cards/search (10 req/sec, 110ms delay, 429 retry) as cross-check to Foilio feed
- lib/card-import/pokemon-bulk.js: TCGdex pricing (already wired via lib/pricing/tcgdex-client.js)
- test/lib/card-import-lorcana-bulk.test.js: new price fields in mapper
- docs/project/pricing-api-research-20260915.md: final verified source matrix
- docs/DOKPLOY_DEPLOY.md: pricing API env vars
2026-09-18 10:07:23 -05:00

3.6 KiB

Deck Hearth on Dokploy (CT 112)

Homelab deploy: Postgres + Redis + MinIO on CT 102, app on Dokploy, public URL via CT 100 Traefik → CT 112.

1. Prerequisites (CT 102)

  • deckhearth Postgres — provision-deckhearth.sh
  • MinIO bucket — provision-deckhearth-minio.sh (axiom-server)
  • Neon data copy — npm run migrate-neon-to-homelab (one-time; run once then archive Neon. Script reads NEON_DATABASE_URL (source) and POSTGRES_URL_DIRECT (target). Requires pg_dump + pg_restore on PATH. If starting fresh with no Neon data, skip this step.)

2. Dokploy application

Dashboard: https://dokploy.stillwell.cloud

Setting Value
Source Git (Forgejo/GitHub) → this repo
Build type Dockerfile
Dockerfile path Dockerfile (repo root — must be pushed to GitHub)
Branch main (production)
Domain in Dokploy http://deckhearth.stillwell.cloud (use http://, not https://)
Port 3000

3. Environment variables (Dokploy → Environment)

# Database (CT 102)
POSTGRES_URL=postgresql://deckhearth:YOUR_PASSWORD@192.168.68.102:5432/deckhearth

# Redis rate limits (CT 102, DB index 5)
REDIS_URL=redis://:YOUR_REDIS_PASSWORD@192.168.68.102:6379/5

# MinIO object storage (CT 102)
S3_ENDPOINT=http://192.168.68.102:9000
S3_ACCESS_KEY_ID=deckhearth-app
S3_SECRET_ACCESS_KEY=YOUR_MINIO_SECRET
S3_BUCKET=deckhearth
S3_PUBLIC_BASE_URL=https://cdn.stillwell.cloud/deckhearth
S3_REGION=us-east-1

# Auth
JWT_SECRET=openssl rand -base64 32

# Pricing APIs (free / paid — add keys to Dokploy secrets / .env.local only)
# Lorcast (Lorcana) — free, 10 req/sec; no key needed
# TCGdex (Pokemon) — free REST at api.tcgdex.net/v2/en; no key needed
# TCG API (tcgapi.dev) — free tier 100 req/day; requires API key (create at tcgapi.dev)
TCGAPI_KEY=<redacted — set when using paid/universal feed>
# RapidAPI — Lorcana-Prices (tcggopro/api/lorcana-prices-api) — paid; only if needed
# LORCANA_PRICES_API_KEY=<redacted — set only when RapidAPI subscription active>

# AI (kept on Vercel AI Gateway)
AI_GATEWAY_API_KEY=vck_…

# Email (external — Resend until self-hosted)
RESEND_API_KEY=re_…

# Cron (n8n on CT 105 hits this weekly)
CRON_SECRET=openssl rand -base64 24

# Optional
NODE_ENV=production

4. Traefik (CT 100)

Route added in axiom-server/proxmox/ct100/traefik/config/dynamic/ct112-dokploy.yml:

  • Host: deckhearth.stillwell.cloud
  • Backend: http://192.168.68.112:80 (Dokploy Traefik)

After editing locally: ./proxmox/scripts/sync.sh push-traefik

5. Catalog sync cron (replaces Vercel Cron)

Vercel vercel.json crons are removed. Schedule in n8n (CT 105) or cron:

curl -fsS -H "Authorization: Bearer $CRON_SECRET" \
  https://deckhearth.stillwell.cloud/api/cron/sync-catalog

Weekly: 0 6 * * 1 (Mondays 06:00).

6. Decommission Vercel

  1. Run the data copy first — npm run migrate-neon-to-homelab (see § 1). If there is no Neon data to migrate, skip to step 2.
  2. Verify DNS — confirm deckhearth.stillwell.cloud resolves to Traefik (CT 100). Already configured for *.stillwell.cloud → CT 100; verify in your DNS provider or AdGuard.
  3. Delete the Vercel project at vercel.com. After confirming the Dokploy deployment is stable and serving traffic, delete the Vercel project to stop billing and auto-deploys.
  4. Remove old env vars from Vercel dashboard — Neon connection string, Blob storage, Upstash/Redis vars are no longer used by the app.

7. Local dev

Same env vars in .env.local with homelab URLs (LAN required).

npm run dev