File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -250,6 +250,11 @@ make import TRACKING=/tmp/zmr-tracking.csv FILES='…' # writes to $DATABASE_U
250250- One container: ` Dockerfile ` , which builds the PWA and a static Go binary on distroless. It
251251 listens on ` $PORT ` (default 8080). Health check: ` GET /healthz ` (pings the DB).
252252- Migrations run automatically at startup (goose, embedded).
253+ - ** Production SQL:** ` scripts/prod-psql ` connects to ` merch-db ` through its public TLS endpoint
254+ (enabled 2026-10-14), using ` PROD_DATABASE_URL ` from the shared ` .env ` . It is read-only by
255+ default; pass ` --write ` first to change data (` scripts/prod-psql --write -c "update …" ` ). Wrap
256+ writes in ` begin; … commit; ` , match rows by id * and* name (ids differ from dev), and never
257+ print the URL. If the password is rotated, rebuild the URL from ` get_database ` .
253258- Required env: ` DATABASE_URL ` , ` BASE_URL ` (public https origin), ` SESSION_SECRET ` ,
254259 ` HCA_CLIENT_ID ` , ` HCA_CLIENT_SECRET ` , ` THESEUS_API_KEY ` , ` ADMIN_EMAILS ` . Also needed:
255260 ` AIRTABLE_API_KEY ` for authors, ` HCB_SHIPPING_PAYMENT_URL ` for international payments,
Original file line number Diff line number Diff line change 1+ #! /bin/sh
2+ # psql against the PRODUCTION database (Orchard merch-db), using PROD_DATABASE_URL
3+ # from the shared .env (scripts/env-file). Read-only unless the first argument is
4+ # --write. Everything else goes to psql:
5+ # scripts/prod-psql -c 'select id, name from items order by id'
6+ # scripts/prod-psql --write -c "update items set … where id = 1"
7+ # Never echo the URL; it holds the password.
8+ set -e
9+ write=
10+ if [ " $1 " = " --write" ]; then write=1; shift ; fi
11+ env_file=$( dirname " $0 " ) /env-file
12+ url=$( sed -n ' s/^PROD_DATABASE_URL=//p' " $( " $env_file " ) " | tail -1)
13+ if [ -z " $url " ]; then
14+ echo " PROD_DATABASE_URL is not set in $( " $env_file " ) " >&2
15+ exit 1
16+ fi
17+ if [ -n " $write " ]; then
18+ PGOPTIONS=' -c statement_timeout=30000' exec psql " $url " -v ON_ERROR_STOP=1 " $@ "
19+ fi
20+ PGOPTIONS=' -c default_transaction_read_only=on -c statement_timeout=30000' exec psql " $url " -v ON_ERROR_STOP=1 " $@ "
You can’t perform that action at this time.
0 commit comments