Add a same-origin API proxy route at `/api/pb/[...path]` to forward requests to PocketBase, resolving mixed content blocking issues when the Next.js app is served over HTTPS but PocketBase uses HTTP. Update environment variables to separate the public client-facing URL and internal server-side PocketBase upstream URL, and update all env config examples and deployment files to match the new setup. Clean up the app paths manifest to include the new API route and remove a stale entry.
64 lines
4.3 KiB
Bash
64 lines
4.3 KiB
Bash
# ─── Coolify env vars — Diesel Depot (FILLED IN) ───────────────────────────
|
|
# Paste each non-commented line into Coolify's "Environment Variables" panel.
|
|
# Coolify sets $PORT and the public domain automatically — do NOT add them.
|
|
# One variable per line. No spaces around `=`. No quotes.
|
|
|
|
# ╔══════════════════════════════════════════════════════════════════════╗
|
|
# ║ REQUIRED — paste these into Coolify ║
|
|
# ╚══════════════════════════════════════════════════════════════════════╝
|
|
|
|
# The URL the browser hits to reach PocketBase.
|
|
#
|
|
# Set this to the SAME-ORIGIN proxy: "/api/pb". The Next.js app exposes
|
|
# an /api/pb/[...path] route that forwards to PB. This is required when
|
|
# the app is served over HTTPS but PB is on a plain-HTTP host — browsers
|
|
# block HTTPS pages from calling HTTP URLs (mixed content), so the login
|
|
# API call would fail with the generic "Invalid email or password" error
|
|
# otherwise. The proxy is server-to-server, no mixed-content rules apply.
|
|
#
|
|
# Override this to the direct PB URL only if BOTH the app AND PB are on
|
|
# HTTPS (e.g. PB also hosted on Coolify with its own https domain).
|
|
NEXT_PUBLIC_POCKETBASE_URL=/api/pb
|
|
|
|
# The server-side upstream for the /api/pb proxy. This is the absolute
|
|
# URL of the actual PB instance — kept separate from the public URL so
|
|
# the client never needs to know the real PB host. Falls back to a
|
|
# sensible default if unset, so you only need to override this if you
|
|
# migrate PB to a different host.
|
|
PB_INTERNAL_URL=http://pocketbase-zinlbpsext2ro0lgb2558vfy.169.239.180.130.sslip.io
|
|
|
|
# Superuser auth token for managing dd_ collections. Only needed if you
|
|
# wire the migration scripts (npm run pb:create / pb:seed) into a Coolify
|
|
# "one-off command" to bootstrap collections on first deploy. The token
|
|
# is a long-lived superuser token — rotate it in the PB admin UI after
|
|
# initial setup if you want to remove it from Coolify's env store.
|
|
# Token scope: collectionId=pbc_3142635823 (the _superusers collection),
|
|
# type=auth, expires 2032-11-24.
|
|
PB_ADMIN_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjb2xsZWN0aW9uSWQiOiJwYmNfMzE0MjYzNTgyMyIsImV4cCI6MTc4NDYyOTE1OCwiaWQiOiI4bjdrNmE1NmVrMng5ZzEiLCJyZWZyZXNoYWJsZSI6dHJ1ZSwidHlwZSI6ImF1dGgifQ.SjnBjkeKvi6cVspoqi_fgmQOROCz1VoLFh4BW7-DKS4
|
|
|
|
# ╔══════════════════════════════════════════════════════════════════════╗
|
|
# ║ OPTIONAL — uncomment if you need to override Coolify's defaults ║
|
|
# ╚══════════════════════════════════════════════════════════════════════╝
|
|
|
|
# Coolify injects PORT automatically. Only set if you need a different value.
|
|
# PORT=3000
|
|
|
|
# Bind address inside the container. Leave as 0.0.0.0 to accept Coolify's proxy.
|
|
# HOSTNAME=0.0.0.0
|
|
|
|
# NODE_ENV=production
|
|
|
|
# Skips the Next.js anonymous telemetry ping.
|
|
# NEXT_TELEMETRY_DISABLED=1
|
|
|
|
# ╔══════════════════════════════════════════════════════════════════════╗
|
|
# ║ POST-DEPLOY MIGRATION (one-off command in Coolify) ║
|
|
# ╚══════════════════════════════════════════════════════════════════════╝
|
|
# After the first deploy succeeds:
|
|
# 1. Open the Diesel Depot service in Coolify
|
|
# 2. Go to the "Terminal" or "Commands" tab
|
|
# 3. Run: npm run pb:create (creates the dd_ collections — idempotent)
|
|
# npm run pb:seed (seeds the 2 depots + owner user)
|
|
# The PB_ADMIN_TOKEN above is used for those.
|
|
# After seeding, you can rotate the superuser token in PB and remove
|
|
# PB_ADMIN_TOKEN from Coolify's env store.
|